@@ -51,7 +51,7 @@ import Text.Pandoc.Options (ReaderOptions(readerParseRaw, readerTrace)
51import Text.Pandoc.Parsing hiding ((<|>))
51import Text.Pandoc.Parsing hiding ((<|>))
52import Text.Pandoc.Walk
52import Text.Pandoc.Walk
53import Data.Maybe ( fromMaybe, isJust)
53import Data.Maybe ( fromMaybe, isJust)
54−import Data.List ( intercalate, isInfixOf )
54+import Data.List ( intercalate, isInfixOf, isPrefixOf )
55import Data.Char ( isDigit )
55import Data.Char ( isDigit )
56import Control.Monad ( liftM, guard, when, mzero, void, unless )
56import Control.Monad ( liftM, guard, when, mzero, void, unless )
57import Control.Arrow ((***))
57import Control.Arrow ((***))
@@ -887,16 +887,18 @@ htmlTag :: Monad m
887 => (Tag String -> Bool)
887 => (Tag String -> Bool)
888 -> ParserT [Char] st m (Tag String, String)
888 -> ParserT [Char] st m (Tag String, String)
889htmlTag f = try $ do
889htmlTag f = try $ do
890− lookAhead $ char '<' >> ((oneOf "/!?" >> nonspaceChar) <|> letter)
890+ lookAhead (char '<')
891− (next : _) <- getInput >>= return . canonicalizeTags . parseTags
892+ let (next : _) = canonicalizeTags $ parseTags inp
892 guard $ f next
893 guard $ f next
893− -- advance the parser
894 case next of
894 case next of
895− TagComment s -> do
895+ TagComment s
896+ | "<!--" `isPrefixOf` inp -> do
896 count (length s + 4) anyChar
897 count (length s + 4) anyChar
897 skipMany (satisfy (/='>'))
898 skipMany (satisfy (/='>'))
899 return (next, "<!--" ++ s ++ "-->")
900 return (next, "<!--" ++ s ++ "-->")
901+ | otherwise -> fail "bogus comment mode, HTML5 parse error"
901 rendered <- manyTill anyChar (char '>')
903 rendered <- manyTill anyChar (char '>')
902 return (next, rendered ++ ">")
904 return (next, rendered ++ ">")