Module: Coradoc::Parser::Asciidoc::AttributeList
Instance Method Summary collapse
- #attribute_list(name = :attribute_list) ⇒ Object
- #named_attribute ⇒ Object
- #named_attribute_name ⇒ Object
- #named_attribute_value ⇒ 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
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 53 def attribute_list(name = :attribute_list) 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
14 15 16 17 18 19 20 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 14 def named_attribute (match('[a-zA-Z0-9_-]').repeat(1).as(: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_many ⇒ Object
28 29 30 31 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 28 def named_many (named_attribute.repeat(1,1) >> (str(",") >> space.maybe >> named_attribute).repeat(0)) end |
#positional_attribute ⇒ Object
22 23 24 25 26 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 22 def positional_attribute (match['a-zA-Z0-9_\-%'].repeat(1) >> str("=").absent? ).as(:positional) end |
#positional_many ⇒ Object
44 45 46 47 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 44 def positional_many (positional_attribute.repeat(1,1) >> (str(",") >> space.maybe >> positional_attribute).repeat(0)) end |
#positional_many_named_many ⇒ Object
38 39 40 41 42 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 38 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
33 34 35 36 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 33 def positional_one_named_many (positional_attribute.repeat(1,1) >> (str(",") >> space.maybe >> named_attribute).repeat(1)) end |
#positional_zero_or_one ⇒ Object
49 50 51 |
# File 'lib/coradoc/parser/asciidoc/attribute_list.rb', line 49 def positional_zero_or_one positional_attribute.repeat(0,1) end |