@@ -46,6 +46,7 @@ import Text.Pandoc.Definition
4646import Text.Pandoc.Shared
4747import Text.Pandoc.Entities ( decodeEntities, entityToChar )
4848import Maybe ( fromMaybe )
49+import Data.List ( intersect, takeWhile, dropWhile )
4950import Data.Char ( toUpper, toLower, isAlphaNum )
5051
5152-- | Convert HTML-formatted string to 'Pandoc' document.
@@ -84,7 +85,9 @@ inlinesTilEnd tag = try (do
8485
8586-- | Extract type from a tag: e.g. 'br' from '<br>'
8687extractTagType :: String -> String
87−extractTagType ('<':rest) = map toLower $ takeWhile isAlphaNum rest
88+extractTagType ('<':rest) =
89+ let isSpaceOrSlash c = c `elem` "/ \n\t" in
90+ map toLower $ takeWhile isAlphaNum $ dropWhile isSpaceOrSlash rest
8891extractTagType _ = ""
8992
9093-- | Parse any HTML tag (closing or opening) and return text of tag