git.iko.soy/typeable/pandoc
on master help sign in
Merge branch 'master' into docbookreader
commita0424d2f8292f5530fe6f2c80b83ba300489615b authorJohn MacFarlane <fiddlosopher@gmail.com> dateSat 14 Apr 2012, 22:53 (15 years ago) parente2c3a7bf40b2eb
1 file changed+3−3
src/Text/Pandoc/XML.hs+3−3
src/Text/Pandoc/XML.hs+3−3
@@ -38,7 +38,7 @@ module Text.Pandoc.XML ( stripTags,
3838 fromEntities ) where
3939
4040import Text.Pandoc.Pretty
41−import Data.Char (ord, isAscii)
41+import Data.Char (ord, isAscii, isSpace)
4242import Text.HTML.TagSoup.Entity (lookupEntity)
4343
4444-- | Remove everything between <...>
@@ -106,8 +106,8 @@ fromEntities :: String -> String
106106fromEntities ('&':xs) =
107107 case lookupEntity ent of
108108 Just c -> c : fromEntities rest
109− Nothing -> '&' : fromEntities rest
110− where (ent, rest) = case break (==';') xs of
109+ Nothing -> '&' : fromEntities xs
110+ where (ent, rest) = case break (\c -> isSpace c || c == ';') xs of
111111 (zs,';':ys) -> (zs,ys)
112112 _ -> ("",xs)
113113fromEntities (x:xs) = x : fromEntities xs