summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2009-01-31 18:30:44 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2009-01-31 18:30:44 +0000
commit9b27f59fc265d281eefec11bf9fb6f453ea93508 (patch)
treee9cc00fba659da36478993b21030d2d7ae43734a
parentcdd3b67a055fa8dd6363317a62fdf18c7763b043 (diff)
Gobble space after Plain blocks containing only raw html inline.
Otherwise following header blocks are not parsed correctly, since the parser sees blank space before them. Resolves Issue #124. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1534 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs2
-rw-r--r--tests/markdown-reader-more.native5
-rw-r--r--tests/markdown-reader-more.txt6
3 files changed, 11 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 896f5832e..18a8eda07 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -612,7 +612,7 @@ para = try $ do
return $ Para $ normalizeSpaces result
plain :: GenParser Char ParserState Block
-plain = many1 inline >>= return . Plain . normalizeSpaces
+plain = many1 inline >>~ spaces >>= return . Plain . normalizeSpaces
--
-- raw html
diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native
index c3c745510..3160f0cd3 100644
--- a/tests/markdown-reader-more.native
+++ b/tests/markdown-reader-more.native
@@ -10,5 +10,8 @@ Pandoc (Meta [] [] "")
, Para [Link [Str "baz"] ("/foo%20foo",""),Space,Link [Str "bam"] ("/foo%20fee",""),Space,Link [Str "bork"] ("/foo/zee%20zob","title")]
, Header 2 [Str "Horizontal",Space,Str "rules",Space,Str "with",Space,Str "spaces",Space,Str "at",Space,Str "end"]
, HorizontalRule
-, HorizontalRule ]
+, HorizontalRule
+, Header 2 [Str "Raw",Space,Str "HTML",Space,Str "before",Space,Str "header"]
+, Plain [HtmlInline "<a>",HtmlInline "</a>"]
+, Header 3 [Str "my",Space,Str "header"] ]
diff --git a/tests/markdown-reader-more.txt b/tests/markdown-reader-more.txt
index ccc9d3a0a..d2315046f 100644
--- a/tests/markdown-reader-more.txt
+++ b/tests/markdown-reader-more.txt
@@ -41,3 +41,9 @@
-- - -- -- -
+## Raw HTML before header
+
+<a></a>
+
+### my header
+