@@ -1069,11 +1069,11 @@ instance NamedTag (Tag String) where
1069 getTagName _ = Nothing
1069 getTagName _ = Nothing
1071isInlineTag :: NamedTag (Tag a) => Tag a -> Bool
1071isInlineTag :: NamedTag (Tag a) => Tag a -> Bool
1072−isInlineTag t = isInlineTagName || isCommentTag t
1072+isInlineTag t =
1073− where isInlineTagName = case getTagName t of
1073+ isCommentTag t || case getTagName t of
1074− Just x -> x
1074+ Nothing -> False
1075− `Set.notMember` blockTags
1075+ Just x -> x `Set.notMember` blockTags ||
1076− Nothing -> False
1076+ T.take 1 x == "?" -- processing instr.
1078isBlockTag :: NamedTag (Tag a) => Tag a -> Bool
1078isBlockTag :: NamedTag (Tag a) => Tag a -> Bool
1079isBlockTag t = isBlockTagName || isTagComment t
1079isBlockTag t = isBlockTagName || isTagComment t
@@ -1208,8 +1208,10 @@ htmlTag f = try $ do
1208 let isNameChar c = isAlphaNum c || c == ':' || c == '-' || c == '_'
1208 let isNameChar c = isAlphaNum c || c == ':' || c == '-' || c == '_'
1209 let isName s = case s of
1209 let isName s = case s of
1210 [] -> False
1210 [] -> False
1211− ('?':_) -> True -- processing instruction
1212 (c:cs) -> isLetter c && all isNameChar cs
1211 (c:cs) -> isLetter c && all isNameChar cs
1212+ let isPI s = case s of
1213+ ('?':_) -> True -- processing instruction
1214 let endpos = if ln == 1
1216 let endpos = if ln == 1
1215 then setSourceColumn startpos
1217 then setSourceColumn startpos
@@ -1225,7 +1227,7 @@ htmlTag f = try $ do
1225 let handleTag tagname = do
1227 let handleTag tagname = do
1226 -- basic sanity check, since the parser is very forgiving
1228 -- basic sanity check, since the parser is very forgiving
1227 -- and finds tags in stuff like x<y)
1229 -- and finds tags in stuff like x<y)
1228− guard $ isName tagname
1230+ guard $ isName tagname || isPI tagname
1229 guard $ not $ null tagname
1231 guard $ not $ null tagname
1230 -- <https://example.org> should NOT be a tag either.
1232 -- <https://example.org> should NOT be a tag either.
1231 -- tagsoup will parse it as TagOpen "https:" [("example.org","")]
1233 -- tagsoup will parse it as TagOpen "https:" [("example.org","")]
@@ -1245,7 +1247,7 @@ htmlTag f = try $ do
1245 else return (next, "<!--" <> s <> "-->")
1247 else return (next, "<!--" <> s <> "-->")
1246 | otherwise -> fail "bogus comment mode, HTML5 parse error"
1248 | otherwise -> fail "bogus comment mode, HTML5 parse error"
1247 TagOpen tagname attr -> do
1249 TagOpen tagname attr -> do
1248− guard $ all (isName . fst) attr
1250+ guard $ isPI tagname || all (isName . fst) attr
1249 handleTag tagname
1251 handleTag tagname
1250 TagClose tagname ->
1252 TagClose tagname ->
1251 handleTag tagname
1253 handleTag tagname