diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-02-12 02:47:24 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-02-12 02:47:24 +0000 |
commit | 0c21e4342c50f8d2f039035a6ed315a5ed957cc9 (patch) | |
tree | 4fc0930c0f4249f8a7f951b18a9c8e0ec8313391 | |
parent | eecaec51f9c95832707fa4e2fbf761def1f5cb65 (diff) | |
download | pandoc-0c21e4342c50f8d2f039035a6ed315a5ed957cc9.tar.gz |
HTML reader: Be forgiving in parsing a bare list within a list.
The following is not valid xhtml, but the intent is clear:
<ol>
<li>one</li>
<ol><li>sub</li></ol>
<li>two</li>
</ol>
We'll treat the <ol> as if it's in a <li>.
Resolves Issue #215.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1836 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r-- | src/Text/Pandoc/Readers/HTML.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 58762c35f..f3c3b9882 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -600,7 +600,9 @@ orderedList = try $ do _ -> DefaultStyle return (read sta, sty') spaces - items <- sepEndBy1 (blocksIn "li") spaces + -- note: if they have an <ol> or <ul> not in scope of a <li>, + -- treat it as a list item, though it's not valid xhtml... + items <- sepEndBy1 (blocksIn "li" <|> liftM (:[]) list) spaces htmlEndTag "ol" return $ OrderedList (start, style, DefaultDelim) items @@ -608,7 +610,9 @@ bulletList :: GenParser Char ParserState Block bulletList = try $ do htmlTag "ul" spaces - items <- sepEndBy1 (blocksIn "li") spaces + -- note: if they have an <ol> or <ul> not in scope of a <li>, + -- treat it as a list item, though it's not valid xhtml... + items <- sepEndBy1 (blocksIn "li" <|> liftM (:[]) list) spaces htmlEndTag "ul" return $ BulletList items |