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
#config, #context, #max, #prefix, #site, #text
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, #bibliography_tag, #bibliography_template, #bibtex_file, #bibtex_files, #bibtex_filters, #bibtex_options, #bibtex_path, #bibtex_paths, #citation_item_for, #citation_number, #cite, #cite_details, #cited_keys, #cited_only?, #cited_references, #content_tag, #details_file_for, #details_link_for, #details_path, #entries, #extend_path, #generate_details?, #interpolate, #join_strings?, #keys, #limit_entries?, #link_to, #liquid_template, #liquidify, #load_repository, #locators, #missing_reference, #optparse, #query, #reference_tag, #reference_tagname, #render_bibliography, #render_citation, #renderer, #replace_strings?, #repository, #repository?, #repository_link_for, #repository_links_for, #repository_path, #set_context_to, #skip_sort?, #sort, #split_arguments, #style, #suppress_author?
Constructor Details
#initialize(tag_name, arguments, tokens) ⇒ BibliographyTag
Returns a new instance of BibliographyTag.
7 8 9 10 11 12 13 |
# File 'lib/jekyll/scholar/tags/bibliography.rb', line 7 def initialize(tag_name, arguments, tokens) super @config = Scholar.defaults.dup optparse(arguments) end |
Instance Method Details
#render(context) ⇒ Object
15 16 17 18 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 46 47 |
# File 'lib/jekyll/scholar/tags/bibliography.rb', line 15 def render(context) set_context_to context items = entries if cited_only? items = if skip_sort? cited_references.uniq.map do |key| items.detect { |e| e.key == key } end else entries.select do |e| cited_references.include? e.key end end end items = items.take(max.to_i) if limit_entries? bibliography = items.each_with_index.map { |entry, index| reference = bibliography_tag(entry, index + 1) if generate_details? reference << link_to(details_link_for(entry), config['details_link'], :class => config['details_link_class']) end content_tag config['bibliography_item_tag'], reference }.join("\n") content_tag config['bibliography_list_tag'], bibliography, :class => config['bibliography_class'] end |