aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-10-06 22:28:22 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-10-06 22:29:25 -0700
commitfd3809c33f663627f43168d347c7f2690a74b56f (patch)
treea4428a26bd5799b628685172939160fb24117677 /src/Text/Pandoc/Writers
parenteda5540719e9771b48f15aa7f431033163e1f161 (diff)
downloadpandoc-fd3809c33f663627f43168d347c7f2690a74b56f.tar.gz
Unescape entities in writing CSL JSON.
The renderCslJson function escapes `<`, `>`, and `&` as entities. This is appropriate when generating HTML, but in CSL JSON these are supposed to appear unescaped. Closes jgm/citeproc#17.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/CslJson.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/CslJson.hs b/src/Text/Pandoc/Writers/CslJson.hs
index 3a8f6f5b1..95ffb34a7 100644
--- a/src/Text/Pandoc/Writers/CslJson.hs
+++ b/src/Text/Pandoc/Writers/CslJson.hs
@@ -23,6 +23,7 @@ import qualified Data.Text as T
import qualified Text.Pandoc.UTF8 as UTF8
import Text.Pandoc.Error
import Text.Pandoc.Class
+import Text.Pandoc.XML (fromEntities)
import Control.Monad.Except (throwError)
import Data.ByteString.Lazy (toStrict)
import Data.ByteString (ByteString)
@@ -84,5 +85,7 @@ toCslJson locale = toStrict .
encodePretty' defConfig{ confIndent = Spaces 2
, confCompare = compare
, confNumFormat = Generic }
- . map (runIdentity . traverse (return . renderCslJson locale . foldMap fromInline))
-
+ . map (runIdentity . traverse (return .
+ fromEntities .
+ renderCslJson locale .
+ foldMap fromInline))