class AsciidoctorBibtex::BibitemMacro
Class to hold information about a bibitem macro. A bibtem macro has only text and key
This class also provides a class method to extract macros from a line of text.
Constants
- BIBITEM_KEY
matches a bibitem key
- BIBITEM_MACRO
matches the full macro
Attributes
key[R]
text[R]
Public Class Methods
extract_macros(line)
click to toggle source
Given a line, return a list of BibitemMacro
instances
# File lib/asciidoctor-bibtex/bibitem_macro.rb, line 29 def self.extract_macros(line) result = [] full = BIBITEM_MACRO.match line while full text = full[0] key = full[1] result << BibitemMacro.new(text, key) # look for next citation on line full = BIBITEM_MACRO.match full.post_match end result end
new(text, key)
click to toggle source
Create a BibitemMacro
object
text: the full macro text matched by BIBITEM_MACRO
key: bibitem key
# File lib/asciidoctor-bibtex/bibitem_macro.rb, line 48 def initialize(text, key) @text = text @key = key end