Class: Jekyll::Scholar::BibliographyTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::Scholar::BibliographyTag
- Includes:
- Utilities
- Defined in:
- lib/jekyll/scholar/tags/bibliography.rb
Instance Attribute Summary
Attributes included from Utilities
#bibtex_file, #config, #context, #query, #site
Instance Method Summary collapse
-
#initialize(tag_name, arguments, tokens) ⇒ BibliographyTag
constructor
A new instance of BibliographyTag.
- #render(context) ⇒ Object
Methods included from Utilities
#base_url, #bibliography, #bibtex_options, #bibtex_path, #cite, #cite_details, #cited_references, #content_tag, #details_file_for, #details_link_for, #details_path, #entries, #extend_path, #generate_details?, #link_to, #set_context_to
Constructor Details
#initialize(tag_name, arguments, tokens) ⇒ BibliographyTag
Returns a new instance of BibliographyTag.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/jekyll/scholar/tags/bibliography.rb', line 7 def initialize(tag_name, arguments, tokens) super @config = Scholar.defaults.dup @bibtex_file, @query = arguments.strip.split(/\s*filter:\s*/) if @bibtex_file == 'cited' @bibtex_file = nil @cited = true end end |
Instance Method Details
#render(context) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/jekyll/scholar/tags/bibliography.rb', line 19 def render(context) set_context_to context references = entries if @cited references = cited_references.map do |key| references.detect { |e| e.key == key } end end references.map! do |entry| reference = CiteProc.process entry.to_citeproc, :style => config['style'], :locale => config['locale'], :format => 'html' reference = content_tag :span, reference, :id => entry.key if generate_details? reference << link_to(details_link_for(entry), config['details_link'], :class => config['details_link_class']) end content_tag :li, reference end content_tag :ol, references.join("\n"), :class => config['bibliography_class'] end |