Module: Coradoc::Parser::Asciidoc::Citation

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

Instance Method Summary collapse

Instance Method Details

#cross_referenceObject



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

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

#xref_anchorObject



5
6
7
# File 'lib/coradoc/parser/asciidoc/citation.rb', line 5

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

#xref_argObject



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

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



9
10
11
# File 'lib/coradoc/parser/asciidoc/citation.rb', line 9

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