Class: Jekyll::Scholar::BibTeXConverter
- Inherits:
-
Converter
- Object
- Converter
- Jekyll::Scholar::BibTeXConverter
- Includes:
- Utilities
- Defined in:
- lib/jekyll/scholar/converters/bibtex.rb
Class Attribute Summary collapse
-
.extension ⇒ Object
readonly
Returns the value of attribute extension.
-
.pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Attributes included from Utilities
#context, #max, #offset, #prefix, #site, #text
Instance Method Summary collapse
- #convert(content) ⇒ Object
-
#initialize(config = {}) ⇒ BibTeXConverter
constructor
A new instance of BibTeXConverter.
- #matches(extension) ⇒ Object
- #output_ext(extension) ⇒ Object
Methods included from Utilities
#allow_locale_overrides?, #base_url, #bibliography, #bibliography_list_tag, #bibliography_stale?, #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_entries, #cited_keys, #cited_only?, #cited_references, #clear?, #content_tag, #csl_renderer, #details_link, #details_link_for, #details_path, #details_path_for, #entries, #extend_path, #generate_details?, #generate_details_link?, #group, #group?, #group_by, #group_compare, #group_keys, #group_name, #group_order, #group_order=, #group_tags, #group_value, #grouper, #interpolate, #join_strings?, #keys, #labels, #limit_entries?, #link_target_for, #link_to, #liquid_template, #liquidify, #load_repository, #load_style, #locales, #locators, #match_fields, #missing_reference, #month_names, #nocite, #optparse, #query, #raw_bibtex_filters, #reference_data, #reference_tag, #reference_tagname, #relative, #remove_duplicates?, #render_bibliography, #render_citation, #replace_strings?, #repository, #repository?, #repository_file_delimiter, #repository_link_for, #repository_links_for, #repository_path, #scholar_source, #set_context_to, #skip_sort?, #sort, #sort_keys, #sort_order, #split_arguments, #style, #styles, #suppress_author?, #type_aliases, #type_names, #type_order, #update_dependency_tree
Constructor Details
#initialize(config = {}) ⇒ BibTeXConverter
Returns a new instance of BibTeXConverter.
18 19 20 21 22 |
# File 'lib/jekyll/scholar/converters/bibtex.rb', line 18 def initialize(config = {}) super @config = Scholar.defaults.merge(@config['scholar'] || {}) @markdown = Jekyll::Converters::Markdown.new(config) end |
Class Attribute Details
.extension ⇒ Object (readonly)
Returns the value of attribute extension.
15 16 17 |
# File 'lib/jekyll/scholar/converters/bibtex.rb', line 15 def extension @extension end |
.pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
15 16 17 |
# File 'lib/jekyll/scholar/converters/bibtex.rb', line 15 def pattern @pattern end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/jekyll/scholar/converters/bibtex.rb', line 9 def config @config end |
Instance Method Details
#convert(content) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/jekyll/scholar/converters/bibtex.rb', line 32 def convert(content) content = BibTeX.parse(content, :strict => true, :include => [:meta_content], :filter => config['bibtex_filters']).map do |b| if b.respond_to?(:to_citeproc) render_bibliography b else b.is_a?(BibTeX::MetaContent) ? b.to_s : '' end end @markdown.convert(content.join("\n")) end |
#matches(extension) ⇒ Object
24 25 26 |
# File 'lib/jekyll/scholar/converters/bibtex.rb', line 24 def matches(extension) extension =~ BibTeXConverter.pattern end |
#output_ext(extension) ⇒ Object
28 29 30 |
# File 'lib/jekyll/scholar/converters/bibtex.rb', line 28 def output_ext(extension) BibTeXConverter.extension end |