Module: Coradoc::Parser::Asciidoc::AttributeList
- Included in:
- Base
- Defined in:
- lib/coradoc/parser/asciidoc/attribute_list.rb
Instance Method Summary collapse
- #attribute_list(name = :attribute_list) ⇒ Object
- #named_attribute ⇒ Object
- #named_attribute_name ⇒ Object
- #named_attribute_value ⇒ Object
- #named_key ⇒ Object
- #named_many ⇒ Object
- #positional_attribute ⇒ Object
- #positional_many ⇒ Object
- #positional_many_named_many ⇒ Object
- #positional_one_named_many ⇒ Object
- #positional_zero_or_one ⇒ Object
Instance Method Details
#attribute_list(name = :attribute_list) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 58 def attribute_list(name = :attribute_list) str('[').present? >> str('[') >> str("[").absent? >> ( named_many | positional_one_named_many | positional_many_named_many | positional_many | positional_zero_or_one ).as(:attribute_array).as(name) >> str("]") end |
#named_attribute ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 19 def named_attribute ( named_key >> str(' ').maybe >> str("=") >> str(' ').maybe >> match['a-zA-Z0-9_\- \"'].repeat(1).as(:named_value) >> str(' ').maybe ).as(:named) end |
#named_attribute_name ⇒ Object
6 7 8 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 6 def named_attribute_name attribute_name end |
#named_attribute_value ⇒ Object
10 11 12 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 10 def named_attribute_value match('[^\],]').repeat(1) end |
#named_key ⇒ Object
14 15 16 17 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 14 def named_key (str('reviewer') | match('[a-zA-Z0-9_-]').repeat(1)).as(:named_key) end |
#named_many ⇒ Object
33 34 35 36 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 33 def named_many (named_attribute.repeat(1,1) >> (str(",") >> space.maybe >> named_attribute).repeat(0)) end |
#positional_attribute ⇒ Object
27 28 29 30 31 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 27 def positional_attribute (match['a-zA-Z0-9_\-%'].repeat(1) >> str("=").absent? ).as(:positional) end |
#positional_many ⇒ Object
49 50 51 52 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 49 def positional_many (positional_attribute.repeat(1,1) >> (str(",") >> space.maybe >> positional_attribute).repeat(0)) end |
#positional_many_named_many ⇒ Object
43 44 45 46 47 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 43 def positional_many_named_many (positional_attribute.repeat(1,1) >> (str(",") >> space.maybe >> positional_attribute).repeat(1) >> (str(",") >> space.maybe>> named_attribute).repeat(1)) end |
#positional_one_named_many ⇒ Object
38 39 40 41 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 38 def positional_one_named_many (positional_attribute.repeat(1,1) >> (str(",") >> space.maybe >> named_attribute).repeat(1)) end |
#positional_zero_or_one ⇒ Object
54 55 56 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 54 def positional_zero_or_one positional_attribute.repeat(0,1) end |