From c94dacec353069939d14f022197e36f030c68bd9 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Wed, 24 Jan 2007 20:26:06 +0000 Subject: Fixed bug in 'extractTagType' in HTML reader: previous version was not skipping / in close tags. git-svn-id: https://pandoc.googlecode.com/svn/trunk@512 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Readers/HTML.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 975e79388..135a90ea8 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -46,6 +46,7 @@ import Text.Pandoc.Definition import Text.Pandoc.Shared import Text.Pandoc.Entities ( decodeEntities, entityToChar ) import Maybe ( fromMaybe ) +import Data.List ( intersect, takeWhile, dropWhile ) import Data.Char ( toUpper, toLower, isAlphaNum ) -- | Convert HTML-formatted string to 'Pandoc' document. @@ -84,7 +85,9 @@ inlinesTilEnd tag = try (do -- | Extract type from a tag: e.g. 'br' from '
' extractTagType :: String -> String -extractTagType ('<':rest) = map toLower $ takeWhile isAlphaNum rest +extractTagType ('<':rest) = + let isSpaceOrSlash c = c `elem` "/ \n\t" in + map toLower $ takeWhile isAlphaNum $ dropWhile isSpaceOrSlash rest extractTagType _ = "" -- | Parse any HTML tag (closing or opening) and return text of tag -- cgit v1.2.3