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

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

Instance Method Summary collapse

Instance Method Details

#attribute_nameObject



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

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

#attribute_valueObject



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

def attribute_value
  text | str("")
end

#digitsObject

rule(:inline_element) { text } rule(:text) { match(“”).repeat(1) }



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

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

#emailObject



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

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

#empty_lineObject

rule(:space) { match(‘s’) } rule(:space?) { spaces.maybe } rule(:spaces) { space.repeat(1) }



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

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

def line_break

match["\r\n"]

end



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

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

#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



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

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



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

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

#wordsObject



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

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