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

#escaped_xrefObject

AsciiDoc escape: ‘<<` produces the literal text `<<` without firing the cross-reference rule. Without this, documentation that shows AsciiDoc xref syntax as a literal example gets rewritten into a broken link to a non-existent anchor.



22
23
24
# File 'lib/coradoc/asciidoc/parser/citation.rb', line 22

def escaped_xref
  str('\\') >> str('<<').as(:text)
end