Module: Coradoc::AsciiDoc::Parser::Citation

Included in:
Base
Defined in:
lib/coradoc/asciidoc/parser/citation.rb

Instance Method Summary collapse

Instance Method Details

#cross_referenceObject

In ‘<<target,text>>`, the target is everything up to the first comma or closing `>`. The text is everything else up to `>` — it can contain commas, quotes, and any other punctuation.



10
11
12
13
14
15
16
# File 'lib/coradoc/asciidoc/parser/citation.rb', line 10

def cross_reference
  (str('<<') >>
    match('[^,>]').repeat(1).as(:href) >>
    (str(',') >> match('[^>]').repeat(0).as(:text)).maybe >>
    str('>>')
  ).as(:cross_reference)
end