git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: Really ignore DOCTYPE and xml declarations.

This actually does what d71b013841f3c9c8c595591e312a31df16a728cb said it did. Revised epub tests to remove the repeated DOCTYPE and xml tags.

commit94466c006005892dc177a8a0518ccf3c55b4e51b authorJohn MacFarlane <jgm@berkeley.edu> dateThu 7 Aug 2014, 22:12 (12 years ago) parent3c4079e
3 files changed+2−27
src/Text/Pandoc/Readers/HTML.hs+2−2 tests/features.native−18 tests/formatting.native−7
src/Text/Pandoc/Readers/HTML.hs+2−2
@@ -289,7 +289,7 @@ fixPlains inList bs = if any isParaish bs'
289289pRawTag :: TagParser String
290290pRawTag = do
291291 tag <- pAnyTag
292− let ignorable x = x `elem` ["html","head","body","DOCTYPE","?xml"]
292+ let ignorable x = x `elem` ["html","head","body","!DOCTYPE","?xml"]
293293 if tagOpen ignorable (const True) tag || tagClose ignorable tag
294294 then return []
295295 else return $ renderTags' [tag]
@@ -728,7 +728,7 @@ inlineHtmlTags = ["a", "abbr", "acronym", "b", "basefont", "bdo", "big",
728728-}
729729
730730blockHtmlTags :: [String]
731−blockHtmlTags = ["address", "article", "aside",
731+blockHtmlTags = ["?xml", "!DOCTYPE", "address", "article", "aside",
732732 "blockquote", "body", "button", "canvas",
733733 "caption", "center", "col", "colgroup", "dd", "dir", "div",
734734 "dl", "dt", "embed", "fieldset", "figcaption", "figure",
tests/features.native−18
@@ -1,5 +1,4 @@
11[Para [Span ("front.xhtml",[],[]) []]
2−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"utf-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
32,RawBlock (Format "html") "<section>"
43,Header 1 ("",[],[]) [Str "Reflowable",Space,Str "EPUB",Space,Str "3",Space,Str "Conformance",Space,Str "Test",Space,Str "Document:",Space,Str "0100"]
54,RawBlock (Format "html") "<section>"
@@ -29,11 +28,9 @@
2928,RawBlock (Format "html") "</section>"
3029,RawBlock (Format "html") "</section>"
3130,Para [Span ("content-xhtml-001.xhtml",[],[]) []]
32−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"utf-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
3331,Header 1 ("",[],[]) [Str "Content",Space,Str "Documents:",Space,Str "XHTML"]
3432,Para [Str "This",Space,Str "section",Space,Str "contains",Space,Str "tests",Space,Str "for",Space,Str "static",Space,Str "XHTML",Space,Str "content."]
3533,Para [Span ("content-xhtml-002.xhtml",[],[]) []]
36−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
3734,RawBlock (Format "html") "<section id=\"iframe-010\" class=\"ctest\">"
3835,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "iframe-010"],Space,Str "Inline",Space,Str "Frames"]
3936,Para [Str "Tests",Space,Str "whether",Space,Str "embedding",Space,Str "content",Space,Str "via",Space,Str "an",Space,Code ("",[],[]) "iframe",Space,Str "is",Space,Str "supported."]
@@ -41,7 +38,6 @@
4138,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "reads",Space,Str "\"PASS\",",Space,Str "the",Space,Str "test",Space,Str "passes."]
4239,RawBlock (Format "html") "</section>"
4340,Para [Span ("content-images-001.xhtml",[],[]) []]
44−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
4541,RawBlock (Format "html") "<section>"
4642,Header 2 ("content-images-001.xhtml#multimedia",[],[]) [Str "Multimedia"]
4743,RawBlock (Format "html") "<section>"
@@ -67,7 +63,6 @@
6763,RawBlock (Format "html") "</section>"
6864,RawBlock (Format "html") "</section>"
6965,Para [Span ("content-multimedia-001.xhtml",[],[]) []]
70−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
7166,RawBlock (Format "html") "<section>"
7267,RawBlock (Format "html") "<section>"
7368,Header 3 ("content-multimedia-001.xhtml#audio",[],[]) [Str "Audio"]
@@ -92,7 +87,6 @@
9287,RawBlock (Format "html") "</section>"
9388,RawBlock (Format "html") "</section>"
9489,Para [Span ("content-multimedia-002.xhtml",[],[]) []]
95−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
9690,RawBlock (Format "html") "<section>"
9791,Header 3 ("content-multimedia-002.xhtml#video",[],[]) [Str "Video"]
9892,RawBlock (Format "html") "<section id=\"video-010\" class=\"otest\">"
@@ -146,7 +140,6 @@
146140,RawBlock (Format "html") "</section>"
147141,RawBlock (Format "html") "</section>"
148142,Para [Span ("content-multimedia-003.xhtml",[],[]) []]
149−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
150143,RawBlock (Format "html") "<section>"
151144,Header 3 ("content-multimedia-003.xhtml#trigger",[],[]) [Code ("",[],[]) "epub:trigger"]
152145,RawBlock (Format "html") "<section id=\"trigger-010\" class=\"ctest\">"
@@ -179,7 +172,6 @@
179172,RawBlock (Format "html") "</section>"
180173,RawBlock (Format "html") "</section>"
181174,Para [Span ("content-ns-001.xhtml",[],[]) []]
182−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
183175,RawBlock (Format "html") "<section>"
184176,Header 2 ("content-ns-001.xhtml#ns",[],[]) [Str "Namespace",Space,Str "Support"]
185177,RawBlock (Format "html") "<section id=\"namespace-010\" class=\"ctest\">"
@@ -191,7 +183,6 @@
191183,RawBlock (Format "html") "</section>"
192184,RawBlock (Format "html") "</section>"
193185,Para [Span ("content-mathml-001.xhtml",[],[]) []]
194−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"utf-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
195186,RawBlock (Format "html") "<section>"
196187,Header 2 ("content-mathml-001.xhtml#mathml",[],[]) [Str "MathML"]
197188,RawBlock (Format "html") "<section id=\"mathml-010\" class=\"ctest\">"
@@ -259,7 +250,6 @@
259250,RawBlock (Format "html") "</section>"
260251,RawBlock (Format "html") "</section>"
261252,Para [Span ("content-svg-001.xhtml",[],[]) []]
262−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
263253,RawBlock (Format "html") "<section id=\"svg\">"
264254,Header 2 ("",[],[]) [Str "SVG"]
265255,RawBlock (Format "html") "<section id=\"svg-shapes\">"
@@ -279,7 +269,6 @@
279269,RawBlock (Format "html") "</section>"
280270,RawBlock (Format "html") "</section>"
281271,Para [Span ("content-svg-002.xhtml",[],[]) []]
282−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
283272,RawBlock (Format "html") "<section id=\"svg-text\">"
284273,Header 3 ("",[],[]) [Str "Text",Space,Str "content"]
285274,RawBlock (Format "html") "<section id=\"svg-text-styling\">"
@@ -365,7 +354,6 @@
365354,RawBlock (Format "html") "</section>"
366355,RawBlock (Format "html") "</section>"
367356,Para [Span ("content-svg-003.xhtml",[],[]) []]
368−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
369357,RawBlock (Format "html") "<section id=\"svg-xhtml-support\">"
370358,Header 3 ("",[],[]) [Str "XHTML",Space,Str "Support"]
371359,RawBlock (Format "html") "<section id=\"svg-410\" class=\"ctest\">"
@@ -389,7 +377,6 @@
389377,RawBlock (Format "html") "</section>"
390378,RawBlock (Format "html") "</section>"
391379,Para [Span ("content-svg-004.xhtml",[],[]) []]
392−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
393380,RawBlock (Format "html") "<section id=\"svg-image-embed\">"
394381,Header 3 ("",[],[]) [Str "Image",Space,Str "Embedding"]
395382,RawBlock (Format "html") "<section id=\"svg-510\" class=\"ctest\">"
@@ -400,11 +387,9 @@
400387,RawBlock (Format "html") "</section>"
401388,RawBlock (Format "html") "</section>"
402389,Para [Span ("content-fallbacks.xhtml",[],[]) []]
403−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"utf-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
404390,Header 1 ("",[],[]) [Str "Fallbacks"]
405391,Para [Str "This",Space,Str "section",Space,Str "contains",Space,Str "tests",Space,Str "for",Space,Str "Fallbacks."]
406392,Para [Span ("content-bindings-001.xhtml",[],[]) []]
407−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"utf-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
408393,RawBlock (Format "html") "<section id=\"bindings\">"
409394,Header 3 ("",[],[]) [Str "Bindings"]
410395,RawBlock (Format "html") "<section id=\"bindings-010\" class=\"otest\">"
@@ -419,7 +404,6 @@
419404,RawBlock (Format "html") "</section>"
420405,RawBlock (Format "html") "</section>"
421406,Para [Span ("content-fallbacks-001.xhtml",[],[]) []]
422−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
423407,RawBlock (Format "html") "<section id=\"fallbacks\">"
424408,Header 2 ("",[],[]) [Str "Fallbacks"]
425409,RawBlock (Format "html") "<section id=\"fallbacks-manifest\">"
@@ -457,7 +441,6 @@
457441,RawBlock (Format "html") "</section>"
458442,RawBlock (Format "html") "</section>"
459443,Para [Span ("content-switch-001.xhtml",[],[]) []]
460−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
461444,RawBlock (Format "html") "<section id=\"epub-switch\">"
462445,Header 3 ("",[],[]) [Code ("",[],[]) "epub:switch"]
463446,RawBlock (Format "html") "<section id=\"switch-010\" class=\"ctest\">"
@@ -475,7 +458,6 @@
475458,RawBlock (Format "html") "</section>"
476459,RawBlock (Format "html") "</section>"
477460,Para [Span ("svg-doc-001.xhtml",[],[]) []]
478−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"utf-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
479461,Header 1 ("",[],[]) [Str "Content",Space,Str "Documents:",Space,Str "SVG"]
480462,Para [Str "This",Space,Str "section",Space,Str "contains",Space,Str "tests",Space,Str "for",Space,Str "static",Space,Str "SVG",Space,Str "content."]
481463,Para [Str "Note",Space,Str "that",Space,Str "if",Space,Str "no",Space,Str "SVG",Space,Str "tests",Space,Str "appear",Space,Str "after",Space,Str "this",Space,Str "document,",Space,Str "SVG",Space,Str "is",Space,Str "not",Space,Str "supported",Space,Str "in",Space,Str "the",Space,Str "spine",Space,Str "and",Space,Str "all",Space,Str "tests",Space,Str "in",Space,Str "this",Space,Str "section",Space,Str "should",Space,Str "be",Space,Str "marked",Space,Code ("",[],[]) "Not Supported",Str "."]
tests/formatting.native−7
@@ -1,5 +1,4 @@
11[Para [Span ("front.xhtml",[],[]) []]
2−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"utf-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
32,RawBlock (Format "html") "<section>"
43,Header 1 ("",[],[]) [Str "EPUB",Space,Str "3",Space,Str "Styling",Space,Str "Test",Space,Str "Document:",Space,Str "0101"]
54,RawBlock (Format "html") "<section>"
@@ -29,13 +28,11 @@
2928,RawBlock (Format "html") "</section>"
3029,RawBlock (Format "html") "</section>"
3130,Para [Span ("styling-xhtml-001.xhtml",[],[]) []]
32−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"utf-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
3331,RawBlock (Format "html") "<section id=\"epub-css\">"
3432,Header 1 ("",[],[]) [Str "EPUB",Space,Str "Style",Space,Str "Sheets"]
3533,Para [Str "This",Space,Str "section",Space,Str "contains",Space,Str "tests",Space,Str "for",Space,Str "styling",Space,Str "and",Space,Str "layout."]
3634,RawBlock (Format "html") "</section>"
3735,Para [Span ("styling-xhtml-003.xhtml",[],[]) []]
38−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
3936,RawBlock (Format "html") "<section id=\"style-110\" class=\"ctest\">"
4037,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-110"],Space,Str "Multi-Column",Space,Str "Layouts"]
4138,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "CSS Multi-Column Layout",Space,Str "properties",Space,Str "are",Space,Str "supported."]
@@ -43,7 +40,6 @@
4340,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "text",Space,Str "is",Space,Str "rendered",Space,Str "in",Space,Str "three",Space,Str "columns,",Space,Str "the",Space,Str "test",Space,Str "passes."]
4441,RawBlock (Format "html") "</section>"
4542,Para [Span ("styling-xhtml-002.xhtml",[],[]) []]
46−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
4743,RawBlock (Format "html") "<section id=\"style-lists\">"
4844,Header 2 ("",[],[]) [Str "Lists"]
4945,RawBlock (Format "html") "<section id=\"style-list-style-type\">"
@@ -342,7 +338,6 @@
342338,RawBlock (Format "html") "</section>"
343339,RawBlock (Format "html") "</section>"
344340,Para [Span ("styling-xhtml-004.xhtml",[],[]) []]
345−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
346341,RawBlock (Format "html") "<section id=\"style-media-rules\">"
347342,Header 2 ("",[],[]) [Code ("",[],[]) "@media",Space,Str "Rules"]
348343,RawBlock (Format "html") "<section id=\"style-210\" class=\"ctest\">"
@@ -407,7 +402,6 @@
407402,RawBlock (Format "html") "</section>"
408403,RawBlock (Format "html") "</section>"
409404,Para [Span ("styling-xhtml-005.xhtml",[],[]) []]
410−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
411405,RawBlock (Format "html") "<section id=\"style-text-xform\">"
412406,Header 2 ("",[],[]) [Str "The",Space,Code ("",[],[]) "text-transform",Space,Str "property"]
413407,RawBlock (Format "html") "<section id=\"style-310\" class=\"ctest\">"
@@ -430,7 +424,6 @@
430424,RawBlock (Format "html") "</section>"
431425,RawBlock (Format "html") "</section>"
432426,Para [Span ("styling-xhtml-006.xhtml",[],[]) []]
433−,Para [RawInline (Format "html") "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",Space,RawInline (Format "html") "<!DOCTYPE html>"]
434427,RawBlock (Format "html") "<section id=\"style-ruby\">"
435428,Header 2 ("",[],[]) [Str "The",Space,Code ("",[],[]) "epub-ruby-position",Space,Str "property"]
436429,RawBlock (Format "html") "<section id=\"style-410\" class=\"ctest\">"