Module: Coradoc::Parser::Asciidoc::Base

Included in:
Content, DocumentAttributes, Header, Section
Defined in:
lib/coradoc/parser/asciidoc/base.rb

Instance Method Summary collapse

Instance Method Details

#attribute_nameObject



65
66
67
# File 'lib/coradoc/parser/asciidoc/base.rb', line 65

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

#attribute_valueObject



69
70
71
# File 'lib/coradoc/parser/asciidoc/base.rb', line 69

def attribute_value
  text | str("")
end

#dateObject



77
78
79
80
# File 'lib/coradoc/parser/asciidoc/base.rb', line 77

def date
  digit.repeat(2, 4) >> str("-") >>
    digit.repeat(1, 2) >> str("-") >> digit.repeat(1, 2)
end

#digitObject



37
38
39
# File 'lib/coradoc/parser/asciidoc/base.rb', line 37

def digit
  match("[0-9]")
end

#digitsObject



41
42
43
# File 'lib/coradoc/parser/asciidoc/base.rb', line 41

def digits
  match("[0-9]").repeat(1)
end

#emailObject



61
62
63
# File 'lib/coradoc/parser/asciidoc/base.rb', line 61

def email
  word >> str("@") >> word >> str(".") >> word
end

#empty_lineObject



33
34
35
# File 'lib/coradoc/parser/asciidoc/base.rb', line 33

def empty_line
  match("^\n")
end

#endlineObject



21
22
23
# File 'lib/coradoc/parser/asciidoc/base.rb', line 21

def endline
  newline | any.absent?
end

#keywordObject



29
30
31
# File 'lib/coradoc/parser/asciidoc/base.rb', line 29

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

#line_endingObject



17
18
19
# File 'lib/coradoc/parser/asciidoc/base.rb', line 17

def line_ending
  match("[\n]")
end

#newlineObject



25
26
27
# File 'lib/coradoc/parser/asciidoc/base.rb', line 25

def newline
  match["\r\n"].repeat(1)
end

#rich_textObject



57
58
59
# File 'lib/coradoc/parser/asciidoc/base.rb', line 57

def rich_text
  (match("[a-zA-Z0-9_-]") | str(".") | str("*") | match("@")).repeat(1)
end

#rich_textsObject



53
54
55
# File 'lib/coradoc/parser/asciidoc/base.rb', line 53

def rich_texts
  rich_text >> (space? >> rich_text).repeat
end

#spaceObject



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

def space
  match('\s').repeat(1)
end

#space?Boolean

Returns:

  • (Boolean)


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

def space?
  space.maybe
end

#special_characterObject



73
74
75
# File 'lib/coradoc/parser/asciidoc/base.rb', line 73

def special_character
  match("^[*_:=-]") | str("[#") | str("[[")
end

#textObject



13
14
15
# File 'lib/coradoc/parser/asciidoc/base.rb', line 13

def text
  match("[^\n]").repeat(1)
end

#wordObject



45
46
47
# File 'lib/coradoc/parser/asciidoc/base.rb', line 45

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

#wordsObject



49
50
51
# File 'lib/coradoc/parser/asciidoc/base.rb', line 49

def words
  word >> (space? >> word).repeat
end