Module: Coradoc::Parser::Asciidoc::Block
Instance Method Summary collapse
- #block ⇒ Object
- #block_content(n_deep = 2) ⇒ Object
- #block_id ⇒ Object
- #block_style(delimiter = "*", repeater = 4, type = nil) ⇒ Object
- #block_title ⇒ Object
- #block_type(type) ⇒ Object
- #example_block ⇒ Object
- #pass_block ⇒ Object
- #quote_block ⇒ Object
- #sidebar_block ⇒ Object
- #source_block ⇒ Object
Instance Method Details
#block ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/coradoc/parser/asciidoc/block.rb', line 6 def block | example_block | source_block | quote_block | pass_block end |
#block_content(n_deep = 2) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/coradoc/parser/asciidoc/block.rb', line 30 def block_content(n_deep = 2) c = block_image | list | text_line | empty_line.as(:line_break) c = c | block_content(n_deep - 1) if (n_deep > 0) c.repeat(1) end |
#block_id ⇒ Object
58 59 60 61 |
# File 'lib/coradoc/parser/asciidoc/block.rb', line 58 def block_id (match('^\[') >> str("[") >> str('[').absent? >> keyword.as(:id) >> str("]]") | str("[#") >> keyword.as(:id) >> str("]")) >> newline end |
#block_style(delimiter = "*", repeater = 4, type = nil) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/coradoc/parser/asciidoc/block.rb', line 63 def block_style(delimiter = "*", repeater = 4, type = nil) block_id.maybe >> block_title.maybe >> newline.maybe >> (attribute_list >> newline ).maybe >> block_id.maybe >> (attribute_list >> newline ).maybe >> str(delimiter).repeat(repeater).as(:delimiter) >> newline >> if type == :pass (text_line | empty_line.as(:line_break)).repeat(1).as(:lines) else block_content.as(:lines) end >> str(delimiter).repeat(repeater) >> newline end |
#block_title ⇒ Object
47 48 49 |
# File 'lib/coradoc/parser/asciidoc/block.rb', line 47 def block_title match('^\\.') >> space.absent? >> text.as(:title) >> newline end |
#block_type(type) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/coradoc/parser/asciidoc/block.rb', line 51 def block_type(type) (match('^\[') >> str("[").absent? >> str(type).as(:type) >> str("]")) | (match('^\[') >> keyword.as(:type) >> str("]")) >> newline end |
#example_block ⇒ Object
43 44 45 |
# File 'lib/coradoc/parser/asciidoc/block.rb', line 43 def example_block block_style("=") end |
#pass_block ⇒ Object
18 19 20 |
# File 'lib/coradoc/parser/asciidoc/block.rb', line 18 def pass_block block_style("+", 4, :pass) end |
#quote_block ⇒ Object
26 27 28 |
# File 'lib/coradoc/parser/asciidoc/block.rb', line 26 def quote_block block_style("_") end |
#sidebar_block ⇒ Object
39 40 41 |
# File 'lib/coradoc/parser/asciidoc/block.rb', line 39 def block_style("*") end |
#source_block ⇒ Object
14 15 16 |
# File 'lib/coradoc/parser/asciidoc/block.rb', line 14 def source_block block_style("-", 2) end |