diff options
| author | John MacFarlane <[email protected]> | 2024-04-01 12:54:12 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2024-04-01 12:54:12 -0700 |
| commit | c29c18a0038b62718cf3133247177e3cb8ebf871 (patch) | |
| tree | a17c36b217a8d4cb2671c76e62bfe9a155ae216d | |
| parent | 6ee03849aa475c2b74d18d0dc518368afaa18370 (diff) | |
Put `$` or `$$` around math in `csljson` output.
Closes #9616.
| -rw-r--r-- | src/Text/Pandoc/Writers/CslJson.hs | 3 | ||||
| -rw-r--r-- | test/command/9616.md | 16 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/CslJson.hs b/src/Text/Pandoc/Writers/CslJson.hs index 3e0455105..81e57055e 100644 --- a/src/Text/Pandoc/Writers/CslJson.hs +++ b/src/Text/Pandoc/Writers/CslJson.hs @@ -71,7 +71,8 @@ fromInline (Code _ t) = CslText t fromInline Space = CslText " " fromInline SoftBreak = CslText " " fromInline LineBreak = CslText "\n" -fromInline (Math _ t) = CslText t +fromInline (Math InlineMath t) = CslText $ "$" <> t <> "$" +fromInline (Math DisplayMath t) = CslText $ "$$" <> t <> "$$" fromInline (RawInline _ _) = CslEmpty fromInline (Link _ ils _) = fromInlines ils fromInline (Image _ ils _) = fromInlines ils diff --git a/test/command/9616.md b/test/command/9616.md new file mode 100644 index 000000000..5b7fb760c --- /dev/null +++ b/test/command/9616.md @@ -0,0 +1,16 @@ +``` +% pandoc -f bibtex -t csljson -s +@MISC {3252037, + TITLE = {Isomorphism between projective varieties $\mathbf{P}^{1}$ and a conic in $\mathbf{P}^{2}$}, + URL = {https://math.stackexchange.com/q/3252037} +} +^D +[ + { + "URL": "https://math.stackexchange.com/q/3252037", + "id": "3252037", + "title": "Isomorphism between projective varieties $\\mathbf{P}^{1}$ and a conic in $\\mathbf{P}^{2}$", + "type": "" + } +] +``` |
