aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/XML.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-04-14 22:52:14 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-04-14 22:52:14 -0700
commitf40b2eb2e763ed08768e08394e5a131bd4373126 (patch)
treebf6064a4986b1d7daeac34f9e9d504dd7c7737c3 /src/Text/Pandoc/XML.hs
parente37c4526b2ae9d52a2f43d83c00f6f720637ce5c (diff)
downloadpandoc-f40b2eb2e763ed08768e08394e5a131bd4373126.tar.gz
Fixed bug in fromEntities.
The previous version would turn "hi & low you know;" into "hi &".
Diffstat (limited to 'src/Text/Pandoc/XML.hs')
-rw-r--r--src/Text/Pandoc/XML.hs6
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