bibtex.rb 573 Bytes
Newer Older
Sylvester Keil's avatar
Sylvester Keil committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
module Jekyll
  class Scholar

    class BibTeXTag < Liquid::Block
      include Scholar::Utilities

      def initialize(tag_name, arguments, tokens)
        super

        @config = Scholar.defaults.dup
        @keys, arguments = split_arguments arguments

        optparse(arguments)
      end

      def render(context)
        set_context_to context
        
        BibTeX.parse(super, bibtex_options).map { |entry|
          reference_tag entry

        }.join("\n")
      end
    end

  end
end

Liquid::Template.register_tag('bibtex', Jekyll::Scholar::BibTeXTag)