tags shouldn't consume trailing whitespace

parslet
Jordan Orelli 9 years ago
parent fcf1ef95ea
commit 59d0e25829

@ -15,11 +15,11 @@ module Bristlecode
rule(:bold_open) { str('[b]') | str('[B]') }
rule(:bold_close) { str('[/b]') | str('[/B]') | eof }
rule(:bold) { bold_open >> children.as(:bold) >> bold_close >> space? }
rule(:bold) { bold_open >> children.as(:bold) >> bold_close }
rule(:italic_open) { str('[i]') | str('[I]') }
rule(:italic_close) { str('[/i]') | str('[/I]') | eof }
rule(:italic) { italic_open >> children.as(:italic) >> italic_close >> space? }
rule(:italic) { italic_open >> children.as(:italic) >> italic_close }
rule(:eof) { any.absent? }
rule(:tag) { bold | italic }
@ -29,8 +29,8 @@ module Bristlecode
rule(:tag_delim) { tag_open | tag_close }
rule(:text) { (tag_delim.absent? >> any).repeat(1).as(:text) }
rule(:children) { space? >> elem.repeat >> space? }
rule(:doc) { space? >> elem.repeat.as(:doc) >> space? }
rule(:children) { space? >> elem.repeat }
rule(:doc) { space? >> elem.repeat.as(:doc) }
root(:doc)
end

Loading…
Cancel
Save