git.iko.soy/typeable/pandoc
on master help sign in
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

commitc94dacec353069939d14f022197e36f030c68bd9 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateWed 24 Jan 2007, 20:26 (20 years ago) parent890fbe9
1 file changed+4−1
src/Text/Pandoc/Readers/HTML.hs+4−1
src/Text/Pandoc/Readers/HTML.hs+4−1
@@ -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