Module: Coradoc::Parser::Asciidoc::DocumentAttributes

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

Instance Method Summary collapse

Instance Method Details

#attribute_nameObject



6
7
8
# File 'lib/coradoc/parser/asciidoc/document_attributes.rb', line 6

def attribute_name
  match("[a-zA-Z0-9_-]").repeat(1)
end

#attribute_valueObject



10
11
12
# File 'lib/coradoc/parser/asciidoc/document_attributes.rb', line 10

def attribute_value
  text | str("") >> str("\n").absent?
end

#document_attributeObject



19
20
21
22
# File 'lib/coradoc/parser/asciidoc/document_attributes.rb', line 19

def document_attribute
  str(":") >> attribute_name.as(:key) >> str(":") >>
    space? >> (attribute_value | str("")).as(:value) >> line_ending
end

#document_attributesObject



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

def document_attributes
  (document_attribute.repeat(1)
    ).as(:document_attributes)
end