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



21
22
23
24
25
26
27
28
# File 'lib/coradoc/asciidoc/parser/citation.rb', line 21

def cross_reference
  (str('<<') >> xref_anchor >>
  ((str(',') >> xref_arg).repeat(1) |
    (str(',') >> xref_str).repeat(1)
  ).maybe >>
    str('>>')
  ).as(:cross_reference)
end

#xref_anchorObject



7
8
9
# File 'lib/coradoc/asciidoc/parser/citation.rb', line 7

def xref_anchor
  match('[^,>]').repeat(1).as(:href_arg).repeat(1, 1)
end

#xref_argObject



15
16
17
18
19
# File 'lib/coradoc/asciidoc/parser/citation.rb', line 15

def xref_arg
  (str('section') | str('paragraph') | str('clause') | str('annex') | str('table')).as(:key) >>
    match('[ =]').as(:delimiter) >>
    match('[^,>=]').repeat(1).as(:value)
end

#xref_strObject



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

def xref_str
  match('[^,>]').repeat(1).as(:text)
end