diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-04-14 22:52:14 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-04-14 22:52:14 -0700 |
commit | f40b2eb2e763ed08768e08394e5a131bd4373126 (patch) | |
tree | bf6064a4986b1d7daeac34f9e9d504dd7c7737c3 /src/Text/Pandoc | |
parent | e37c4526b2ae9d52a2f43d83c00f6f720637ce5c (diff) | |
download | pandoc-f40b2eb2e763ed08768e08394e5a131bd4373126.tar.gz |
Fixed bug in fromEntities.
The previous version would turn "hi & low you know;" into "hi &".
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/XML.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Text/Pandoc/XML.hs b/src/Text/Pandoc/XML.hs index 7a1c8bdd8..31279c3bb 100644 --- a/src/Text/Pandoc/XML.hs +++ b/src/Text/Pandoc/XML.hs @@ -38,7 +38,7 @@ module Text.Pandoc.XML ( stripTags, fromEntities ) where import Text.Pandoc.Pretty -import Data.Char (ord, isAscii) +import Data.Char (ord, isAscii, isSpace) import Text.HTML.TagSoup.Entity (lookupEntity) -- | Remove everything between <...> @@ -106,8 +106,8 @@ fromEntities :: String -> String fromEntities ('&':xs) = case lookupEntity ent of Just c -> c : fromEntities rest - Nothing -> '&' : fromEntities rest - where (ent, rest) = case break (==';') xs of + Nothing -> '&' : fromEntities xs + where (ent, rest) = case break (\c -> isSpace c || c == ';') xs of (zs,';':ys) -> (zs,ys) _ -> ("",xs) fromEntities (x:xs) = x : fromEntities xs |