Haskell Parse Paragraph and em element with Parsec
Posted
by Martin
on Stack Overflow
See other posts from Stack Overflow
or by Martin
Published on 2010-04-25T01:32:58Z
Indexed on
2010/04/25
1:43 UTC
Read the original article
Hit count: 467
I'm using Text.ParserCombinators.Parsec and Text.XHtml to parse an input like this:
this is the beginning of the paragraph --this is an emphasized text-- and this is the end\n
And my output should be:
<p>this is the beginning of the paragraph <em>this is an emphasized text</em> and this is the end\n</p>
This code parses and returns an emphasized element
em = do{
;count 2 (char '-') ;
;s <- manyTill anyChar (count 2 (char '-'))
;return (emphasize << s)
}
But I don't know how to get the paragraphs with emphasized items
Any ideas?
Thanks!!
© Stack Overflow or respective owner