Class: AsciidoctorBibtex::Asciidoctor::BibliographyBlockMacro
- Inherits:
-
Asciidoctor::Extensions::BlockMacroProcessor
- Object
- Asciidoctor::Extensions::BlockMacroProcessor
- AsciidoctorBibtex::Asciidoctor::BibliographyBlockMacro
- Defined in:
- lib/asciidoctor-bibtex/extensions.rb
Overview
BibliographyBlockMacro
The ‘bibliography::[] block macro` processor.
This macro processor does only half the work. It just parse the macro and set bibtex file and style if found in the macro. The macro is then expanded to a special paragraph, which is then replaced with generated references by the treeprocessor.
Instance Method Summary collapse
Instance Method Details
#process(parent, target, attrs) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/asciidoctor-bibtex/extensions.rb', line 33 def process(parent, target, attrs) # NOTE: bibtex-file and bibtex-style set by this macro shall be # overridable by document attributes and commandline arguments. So we # respect the convention here. if target && (!parent.document.attr? 'bibtex-file') parent.document.set_attribute 'bibtex-file', target end if attrs.key?(:style) && (!parent.document.attr? 'bibtex-style') parent.document.set_attribute 'bibtex-style', attrs[:style] end if attrs.key?(:locale) && (!parent.document.attr? 'bibtex-locale') parent.document.set_attribute 'bibtex-locale', attrs[:locale] end create_paragraph parent, BibliographyBlockMacroPlaceholder, {} end |