diff options
| -rw-r--r-- | src/Text/Pandoc/XML.hs | 9 |
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 |
