diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-01-24 20:26:06 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-01-24 20:26:06 +0000 |
commit | c94dacec353069939d14f022197e36f030c68bd9 (patch) | |
tree | d675a1ee921cdd35793ac51937304ce97884d40b | |
parent | 890fbe97ecd9546ec1872a8ebf37551fe8771a0f (diff) | |
download | pandoc-c94dacec353069939d14f022197e36f030c68bd9.tar.gz |
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
-rw-r--r-- | src/Text/Pandoc/Readers/HTML.hs | 5 |
1 files changed, 4 insertions, 1 deletions
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 '<br>' 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 |