lib/flannel/block.treetop in flannel-0.2.11 vs lib/flannel/block.treetop in flannel-0.2.12
- old
+ new
@@ -1,24 +1,24 @@
grammar Block
rule document
- block* {
+ ( block / not_flannel)* {
def content
elements.map{ |element| element.content}
end
}
end
rule block
block_header block_text? {
def content
- elements.map{ |element| element.respond_to?(:content) ? element.content : nil}.compact
+ [ :block, elements.map{ |element| element.respond_to?(:content) ? element.content : nil}.compact ]
end
}
end
rule block_header
- block_start block_type block_id? parent_id? attribute_list? [\n]* {
+ block_start block_type block_id? parent_id? attribute_list? [\s]* ":" [\n]? {
def content
elements.map{ |element| element.respond_to?(:content) ? element.content : nil}.compact
end
}
end
@@ -38,19 +38,19 @@
end
}
end
rule block_type
- ( paragraph / feed / preformatted / list / header / blockquote ) {
+ ( feed / preformatted / list / header / blockquote / paragraph ) {
def content
[:block_type, text_value.to_sym ]
end
}
end
rule paragraph
- "paragraph" { def content; text_value; end }
+ "paragraph" { def text_value; "paragraph"; end }
end
rule header
( header_one / header_two / header_three / header_four / header_five / header_six ) { def content; text_value; end }
end
@@ -142,13 +142,13 @@
text_value
end
}
end
- #rule beginning_of_line
- # {
- # def content
- # nil
- # end
- # }
- #end
+ rule not_flannel
+ (!(block_header) .)+ {
+ def content
+ [:plain_text, text_value.strip ]
+ end
+ }
+ end
end
\ No newline at end of file