diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 054d9eb72..f9a738e94 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -153,15 +153,15 @@ htmlScript = try (do rest <- manyTill anyChar (htmlEndTag "script") return (open ++ rest ++ "")) -rawHtmlBlock = do - notFollowedBy (do {choice [htmlTag "/body", htmlTag "/html"]; return ' '}) +rawHtmlBlock = try (do + notFollowedBy' (choice [htmlTag "/body", htmlTag "/html"]) body <- choice [htmlScript, anyHtmlBlockTag, htmlComment, xmlDec, definition] sp <- (many space) state <- getState if stateParseRaw state then return (RawHtml (body ++ sp)) else - return Null + return Null) htmlComment = try (do string "\n" +, CodeBlock "" , Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"] , Para [Str "Code:"] -, CodeBlock "
}\n"
+, CodeBlock " { }"
, Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "use",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "every",Space,Str "line,",Space,Str "as",Space,Str "with",Space,Str "blockquotes,",Space,Str "but",Space,Str "all",Space,Str "that",Space,Str "you",Space,Str "need",Space,Str "is",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "the",Space,Str "block",Space,Str "and",Space,Str "any",Space,Str "preceding",Space,Str "blank",Space,Str "lines."]
, Key [Str "1"] (Src "/url" "")
, Key [Str "2"] (Src "http://example.com/?foo=1&bar=2" "")
diff --git a/tests/rst-reader.native b/tests/rst-reader.native
index fb63e5e60..43c12ad98 100644
--- a/tests/rst-reader.native
+++ b/tests/rst-reader.native
@@ -25,7 +25,7 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":",Space,Str
, BlockQuote
[ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It's",Space,Str "indented",Space,Str "with",Space,Str "a",Space,Str "tab."]
, Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"]
- , CodeBlock "sub status {\n print \"working\";\n}\n"
+ , CodeBlock "sub status {\n print \"working\";\n}"
, Para [Str "List",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"]
, OrderedList
[ [ Plain [Str "item",Space,Str "one"] ]
@@ -38,10 +38,10 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":",Space,Str
] ]
, Header 1 [Str "Code",Space,Str "Blocks"]
, Para [Str "Code",Str ":"]
-, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n"
-, CodeBlock "this code block is indented by one tab\n"
+, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}"
+, CodeBlock "this code block is indented by one tab"
, Para [Str "And",Str ":"]
-, CodeBlock " this block is indented by two tabs\n\n These should not be escaped: \\$ \\\\ \\> \\[ \\{\n"
+, CodeBlock " this block is indented by two tabs\n\n These should not be escaped: \\$ \\\\ \\> \\[ \\{"
, Header 1 [Str "Lists"]
, Header 2 [Str "Unordered"]
, Para [Str "Asterisks",Space,Str "tight",Str ":"]
@@ -166,7 +166,7 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":",Space,Str
, Key [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] (Src "http://example.com/?foo=1&bar=2" "")
, Para [Str "Autolinks",Str ":",Space,Link [Str "http://example.com/?foo=1&bar=2"] (Src "http://example.com/?foo=1&bar=2" ""),Space,Str "and",Space,Link [Str "nobody@nowhere.net"] (Src "mailto:nobody@nowhere.net" ""),Str "."]
, Para [Str "But",Space,Str "not",Space,Str "here",Str ":"]
-, CodeBlock "http://example.com/\n"
+, CodeBlock "http://example.com/"
, Header 1 [Str "Images"]
, Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902)",Str ":"]
, Plain [Image [Str "image"] (Src "lalune.jpg" "")]
diff --git a/tests/testsuite.native b/tests/testsuite.native
index 8ec543e89..99b6ab79b 100644
--- a/tests/testsuite.native
+++ b/tests/testsuite.native
@@ -26,7 +26,7 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, BlockQuote
[ Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
- , CodeBlock "sub status {\n print \"working\";\n}\n"
+ , CodeBlock "sub status {\n print \"working\";\n}"
, Para [Str "A",Space,Str "list:"]
, OrderedList
[ [ Plain [Str "item",Space,Str "one"] ]
@@ -42,7 +42,7 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, Para [Str "Box",Str "-",Str "style:"]
, BlockQuote
[ Para [Str "Example:"]
- , CodeBlock "sub status {\n print \"working\";\n}\n" ]
+ , CodeBlock "sub status {\n print \"working\";\n}" ]
, BlockQuote
[ OrderedList
[ [ Plain [Str "do",Space,Str "laundry"] ]
@@ -57,9 +57,9 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, HorizontalRule
, Header 1 [Str "Code",Space,Str "Blocks"]
, Para [Str "Code:"]
-, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab\n"
+, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab"
, Para [Str "And:"]
-, CodeBlock " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{\n"
+, CodeBlock " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{"
, HorizontalRule
, Header 1 [Str "Lists"]
, Header 2 [Str "Unordered"]
@@ -173,9 +173,9 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, Plain [Str "foo"]
, RawHtml "\n"
, Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]
-, CodeBlock "\n foo\n\n"
+, CodeBlock "\n foo\n"
, Para [Str "As",Space,Str "should",Space,Str "this:"]
-, CodeBlock "foo\n"
+, CodeBlock "foo"
, Para [Str "Now,",Space,Str "nested:"]
, RawHtml "\n \n \n "
, Plain [Str "foo"]
@@ -185,11 +185,11 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, Para [Str "Multiline:"]
, RawHtml "\n\n\n"
, Para [Str "Code",Space,Str "block:"]
-, CodeBlock "\n"
+, CodeBlock ""
, Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"]
, RawHtml " \n"
, Para [Str "Code:"]
-, CodeBlock "
\n"
+, CodeBlock "
"
, Para [Str "Hr's:"]
, RawHtml "
\n\n
\n\n
\n\n
\n\n
\n\n
\n\n
\n\n
\n\n
\n"
, HorizontalRule
@@ -286,7 +286,7 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, Key [Str "once"] (Src "/url" "")
, Key [Str "twice"] (Src "/url" "")
, Key [Str "thrice"] (Src "/url" "")
-, CodeBlock "[not]: /url\n"
+, CodeBlock "[not]: /url"
, Key [Str "b"] (Src "/url/" "")
, Para [Str "Foo",Space,Link [Str "bar"] (Ref []),Str "."]
, Para [Str "Foo",Space,Link [Str "biz"] (Src "/url/" "Title with "quote" inside"),Str "."]
@@ -309,7 +309,7 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
[ Para [Str "Blockquoted:",Space,Link [Str "http://example.com/"] (Src "http://example.com/" "")] ]
, Para [Str "Auto",Str "-",Str "links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code " "]
-, CodeBlock "or here: \n"
+, CodeBlock "or here: "
, HorizontalRule
, Header 1 [Str "Images"]
, Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
@@ -325,5 +325,5 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, Note "longnote"
[ Para [Str "Here's",Space,Str "the",Space,Str "other",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."]
, Para [Str "Caret",Space,Str "characters",Space,Str "are",Space,Str "used",Space,Str "to",Space,Str "indicate",Space,Str "that",Space,Str "the",Space,Str "blocks",Space,Str "all",Space,Str "belong",Space,Str "to",Space,Str "a",Space,Str "single",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "block",Space,Str "quotes)."]
- , CodeBlock " { }\n"
+ , CodeBlock " { }"
, Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "use",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "every",Space,Str "line,",Space,Str "as",Space,Str "with",Space,Str "blockquotes,",Space,Str "but",Space,Str "all",Space,Str "that",Space,Str "you",Space,Str "need",Space,Str "is",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "the",Space,Str "block",Space,Str "and",Space,Str "any",Space,Str "preceding",Space,Str "blank",Space,Str "lines."] ] ]
diff --git a/tests/writer.native b/tests/writer.native
index 8ec543e89..99b6ab79b 100644
--- a/tests/writer.native
+++ b/tests/writer.native
@@ -26,7 +26,7 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, BlockQuote
[ Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
- , CodeBlock "sub status {\n print \"working\";\n}\n"
+ , CodeBlock "sub status {\n print \"working\";\n}"
, Para [Str "A",Space,Str "list:"]
, OrderedList
[ [ Plain [Str "item",Space,Str "one"] ]
@@ -42,7 +42,7 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, Para [Str "Box",Str "-",Str "style:"]
, BlockQuote
[ Para [Str "Example:"]
- , CodeBlock "sub status {\n print \"working\";\n}\n" ]
+ , CodeBlock "sub status {\n print \"working\";\n}" ]
, BlockQuote
[ OrderedList
[ [ Plain [Str "do",Space,Str "laundry"] ]
@@ -57,9 +57,9 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, HorizontalRule
, Header 1 [Str "Code",Space,Str "Blocks"]
, Para [Str "Code:"]
-, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab\n"
+, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab"
, Para [Str "And:"]
-, CodeBlock " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{\n"
+, CodeBlock " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{"
, HorizontalRule
, Header 1 [Str "Lists"]
, Header 2 [Str "Unordered"]
@@ -173,9 +173,9 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, Plain [Str "foo"]
, RawHtml "\n"
, Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]
-, CodeBlock "\n foo\n\n"
+, CodeBlock "\n foo\n"
, Para [Str "As",Space,Str "should",Space,Str "this:"]
-, CodeBlock "foo\n"
+, CodeBlock "foo"
, Para [Str "Now,",Space,Str "nested:"]
, RawHtml "\n \n \n "
, Plain [Str "foo"]
@@ -185,11 +185,11 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, Para [Str "Multiline:"]
, RawHtml "\n\n\n"
, Para [Str "Code",Space,Str "block:"]
-, CodeBlock "\n"
+, CodeBlock ""
, Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"]
, RawHtml " \n"
, Para [Str "Code:"]
-, CodeBlock "
\n"
+, CodeBlock "
"
, Para [Str "Hr's:"]
, RawHtml "
\n\n
\n\n
\n\n
\n\n
\n\n
\n\n
\n\n
\n\n
\n"
, HorizontalRule
@@ -286,7 +286,7 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, Key [Str "once"] (Src "/url" "")
, Key [Str "twice"] (Src "/url" "")
, Key [Str "thrice"] (Src "/url" "")
-, CodeBlock "[not]: /url\n"
+, CodeBlock "[not]: /url"
, Key [Str "b"] (Src "/url/" "")
, Para [Str "Foo",Space,Link [Str "bar"] (Ref []),Str "."]
, Para [Str "Foo",Space,Link [Str "biz"] (Src "/url/" "Title with "quote" inside"),Str "."]
@@ -309,7 +309,7 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
[ Para [Str "Blockquoted:",Space,Link [Str "http://example.com/"] (Src "http://example.com/" "")] ]
, Para [Str "Auto",Str "-",Str "links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code " "]
-, CodeBlock "or here: \n"
+, CodeBlock "or here: "
, HorizontalRule
, Header 1 [Str "Images"]
, Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
@@ -325,5 +325,5 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, Note "longnote"
[ Para [Str "Here's",Space,Str "the",Space,Str "other",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."]
, Para [Str "Caret",Space,Str "characters",Space,Str "are",Space,Str "used",Space,Str "to",Space,Str "indicate",Space,Str "that",Space,Str "the",Space,Str "blocks",Space,Str "all",Space,Str "belong",Space,Str "to",Space,Str "a",Space,Str "single",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "block",Space,Str "quotes)."]
- , CodeBlock " { }\n"
+ , CodeBlock " { }"
, Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "use",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "every",Space,Str "line,",Space,Str "as",Space,Str "with",Space,Str "blockquotes,",Space,Str "but",Space,Str "all",Space,Str "that",Space,Str "you",Space,Str "need",Space,Str "is",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "the",Space,Str "block",Space,Str "and",Space,Str "any",Space,Str "preceding",Space,Str "blank",Space,Str "lines."] ] ]