我正在使用Text.ParserCombinators.Parsec和Text.XHtml来解析这样的输入:
这是第一段示例\n 有两行\n \n 这是第二段\n
我的输出应该是:
<p>This is the first paragraph example\n
with two lines\n</p>
<p>And this is the second paragraph\n</p>
我定义:
line= do{
;t<-manyTill (anyChar) newline
;return t
}
paragraph = do{
t<-many1 (line)
;return ( p << t )
}
但它返回:
<p>This is the first paragraph example\n
with two lines\n\n And this is the second paragraph\n</p>
怎么了?有任何想法吗?
谢谢!