@@ -19,7 +19,6 @@ module Text.Pandoc.Readers.HTML ( readHtml
19 , htmlInBalanced
19 , htmlInBalanced
20 , isInlineTag
20 , isInlineTag
21 , isBlockTag
21 , isBlockTag
23 , isTextTag
22 , isTextTag
24 , isCommentTag
23 , isCommentTag
@@ -579,9 +578,9 @@ tagToText (TagOpen "br" _) = "\n"
579tagToText _ = ""
578tagToText _ = ""
581inline :: PandocMonad m => TagParser m Inlines
580inline :: PandocMonad m => TagParser m Inlines
582−inline = do
581+inline = pTagText <|> do
582+ tag <- lookAhead (pSatisfy isInlineTag)
583 exts <- getOption readerExtensions
583 exts <- getOption readerExtensions
584− tag <- lookAhead pAny
585 case tag of
584 case tag of
586 TagOpen name attr ->
585 TagOpen name attr ->
587 case name of
586 case name of
@@ -935,27 +934,21 @@ pSpace = many1 (satisfy isSpace) >>= \xs ->
935 then return B.softbreak
934 then return B.softbreak
936 else return B.space
935 else return B.space
938−class NamedTag a where
939− getTagName :: a -> Maybe Text
937+getTagName :: Tag Text -> Maybe Text
941−instance NamedTag (Tag Text) where
942− getTagName (TagOpen t _) = Just t
938+getTagName (TagOpen t _) = Just t
943− getTagName (TagClose t) = Just t
939+getTagName (TagClose t) = Just t
944− getTagName _ = Nothing
940+getTagName _ = Nothing
946−instance NamedTag (Tag String) where
947− getTagName (TagOpen t _) = Just (T.pack t)
948− getTagName (TagClose t) = Just (T.pack t)
949− getTagName _ = Nothing
951−isInlineTag :: NamedTag (Tag a) => Tag a -> Bool
942+isInlineTag :: Tag Text -> Bool
952isInlineTag t =
943isInlineTag t =
953− isCommentTag t || case getTagName t of
945+ case getTagName t of
954− Nothing -> False
946+ Nothing -> False
947+ Just "script" -> "math/tex" `T.isPrefixOf` fromAttrib "type" t
955− Just x -> x `Set.notMember` blockTags ||
948+ Just x -> x `Set.notMember` blockTags ||
956− T.take 1 x == "?" -- processing instr.
949+ T.take 1 x == "?" -- processing instr.
958−isBlockTag :: NamedTag (Tag a) => Tag a -> Bool
951+isBlockTag :: Tag Text -> Bool
959isBlockTag t = isBlockTagName || isTagComment t
952isBlockTag t = isBlockTagName || isTagComment t
960 where isBlockTagName =
953 where isBlockTagName =
961 case getTagName t of
954 case getTagName t of
@@ -966,10 +959,10 @@ isBlockTag t = isBlockTagName || isTagComment t
966 || x `Set.member` eitherBlockOrInline
959 || x `Set.member` eitherBlockOrInline
967 Nothing -> False
960 Nothing -> False
969−isTextTag :: Tag a -> Bool
962+isTextTag :: Tag Text -> Bool
970isTextTag = tagText (const True)
963isTextTag = tagText (const True)
972−isCommentTag :: Tag a -> Bool
965+isCommentTag :: Tag Text -> Bool
973isCommentTag = tagComment (const True)
966isCommentTag = tagComment (const True)
975--- parsers for use in markdown, textile readers
968--- parsers for use in markdown, textile readers
@@ -1018,7 +1011,7 @@ htmlInBalanced' tagname ts = fromMaybe [] $ go 0 ts
1018 go n (t:ts') = (t :) <$> go n ts'
1011 go n (t:ts') = (t :) <$> go n ts'
1019 go _ [] = mzero
1012 go _ [] = mzero
1021−hasTagWarning :: [Tag a] -> Bool
1014+hasTagWarning :: [Tag Text] -> Bool
1022hasTagWarning (TagWarning _:_) = True
1015hasTagWarning (TagWarning _:_) = True
1023hasTagWarning _ = False
1016hasTagWarning _ = False