preformat: one \n is not enough. Fix parsing of input containing \r\n line endings.

This commit is contained in:
Michael Teichgräber 2012-04-29 23:47:53 +02:00
parent f721084df0
commit 4cfb83f5d7

View File

@ -73,7 +73,7 @@ L:
tree = p.processRawBlocks(tree) tree = p.processRawBlocks(tree)
f.FormatBlock(tree) f.FormatBlock(tree)
switch s { switch s {
case "", "\n", "\n\n": case "", "\n", "\r\n", "\n\n", "\r\n\n", "\n\n\n", "\r\n\n\n":
break L break L
} }
} }
@ -169,6 +169,6 @@ func (p *Parser) preformat(r io.Reader) (s string) {
b.Write(buf[i0:n]) b.Write(buf[i0:n])
} }
b.WriteString("\n") b.WriteString("\n\n")
return b.String() return b.String()
} }