Sha256: c71ca961669691e41741d55bc26dbdca989cff2e1593a8997f11b965af2dc733
Contents?: true
Size: 1.8 KB
Versions: 3
Compression:
Stored size: 1.8 KB
Contents
module Coradoc module Parser module Asciidoc module AttributeList def named_attribute_name attribute_name end def named_attribute_value match('[^\],]').repeat(1) end 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 def positional_attribute (match['a-zA-Z0-9_\-%'].repeat(1) >> str("=").absent? ).as(:positional) end def named_many (named_attribute.repeat(1,1) >> (str(",") >> space.maybe >> named_attribute).repeat(0)) end def positional_one_named_many (positional_attribute.repeat(1,1) >> (str(",") >> space.maybe >> named_attribute).repeat(1)) end 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 def positional_many (positional_attribute.repeat(1,1) >> (str(",") >> space.maybe >> positional_attribute).repeat(0)) end def positional_zero_or_one positional_attribute.repeat(0,1) end 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 end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
coradoc-1.1.3 | lib/coradoc/parser/asciidoc/attribute_list.rb |
coradoc-1.1.2 | lib/coradoc/parser/asciidoc/attribute_list.rb |
coradoc-1.1.1 | lib/coradoc/parser/asciidoc/attribute_list.rb |