aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-10-29 11:45:20 -0700
committerJohn MacFarlane <[email protected]>2022-10-29 11:46:08 -0700
commit86a8a8e107e14ad4d04bf858ee835fbbc491881b (patch)
tree71b9b04e08af5c9c52d28d059573b640e80f4489
parent512cf5a908872c9b3332718aa3272ad09914da16 (diff)
T.P.XML: use lookupEntity from commonmark-hs.
-rw-r--r--src/Text/Pandoc/XML.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/XML.hs b/src/Text/Pandoc/XML.hs
index b811336d5..8f899e4c5 100644
--- a/src/Text/Pandoc/XML.hs
+++ b/src/Text/Pandoc/XML.hs
@@ -28,7 +28,8 @@ module Text.Pandoc.XML ( escapeCharForXML,
import Data.Char (isAscii, isSpace, ord, isLetter, isDigit)
import Data.Text (Text)
import qualified Data.Text as T
-import Text.HTML.TagSoup.Entity (lookupEntity, htmlEntities)
+import Commonmark.Entity (lookupEntity)
+import Text.HTML.TagSoup.Entity (htmlEntities)
import Text.DocLayout
( ($$), char, hcat, nest, text, Doc, HasChars )
import Text.Printf (printf)
@@ -118,8 +119,8 @@ html5EntityMap = foldr go mempty htmlEntities
(\new old -> if T.length new > T.length old
then old
else new) c ent' entmap
- where ent' = T.takeWhile (/=';') (T.pack ent)
- _ -> entmap
+ where ent' = T.takeWhile (/=';') (T.pack ent)
+ _ -> entmap
-- | Converts a string into an NCName, i.e., an XML name without colons.
-- Disallowed characters are escaped using @ux%x@, where @%x@ is the
@@ -159,7 +160,7 @@ fromEntities t
Just (';',ys) -> ys
_ -> rest
ent' = T.drop 1 ent <> ";"
- in case T.pack <$> lookupEntity (T.unpack ent') of
+ in case lookupEntity ent' of
Just c -> c <> fromEntities rest'
Nothing -> ent <> fromEntities rest