Module: Coradoc::Parser::Asciidoc::Paragraph

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

Instance Method Summary collapse

Instance Method Details

#line_not_text?Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
# File 'lib/coradoc/parser/asciidoc/paragraph.rb', line 6

def line_not_text?
  line_start? >>
  attribute_list.absent? >>
  block_delimiter.absent? >>
  list.absent? >>
  # list_prefix.absent? >>
  section_id.absent? >>
  section_prefix.absent?
end

#paragraphObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/coradoc/parser/asciidoc/paragraph.rb', line 25

def paragraph
  ( block_id.maybe >>
    block_title.maybe >>
    (attribute_list >> newline).maybe >>
    (line_not_text? >> paragraph_text_line.repeat(1,1) >> any.absent? |
      (line_not_text? >> paragraph_text_line >> newline_single.as(:line_break)).repeat(1) >>
      (line_not_text? >> paragraph_text_line.repeat(1,1)).repeat(0,1)
    ).as(:lines) >>
    newline.repeat(0)
  ).as(:paragraph)
end

#paragraph_attributesObject



37
38
39
40
41
# File 'lib/coradoc/parser/asciidoc/paragraph.rb', line 37

def paragraph_attributes
  str("[") >>
    keyword.as(:key) >> str("=") >>
    word.as(:value) >> str("]") >> newline
end

#paragraph_text_lineObject



16
17
18
19
20
21
22
23
# File 'lib/coradoc/parser/asciidoc/paragraph.rb', line 16

def paragraph_text_line
  line_not_text? >>
  (asciidoc_char_with_id.absent? | text_id ) >>
  literal_space? >>
  (line_not_text? >>
    text_formatted.as(:text) # >>
  ) | term | term2
end