aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-01-24 09:35:42 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2019-01-24 09:35:42 -0800
commit5eaff399d5d6dc30b0d453eff42c4101674d75ab (patch)
treef057a54d8a37ebefe33c6ac4b0829d1c2ad489d7 /src/Text/Pandoc/Readers
parente18d9ba5427c67a4a50675311ee180d54790a60a (diff)
downloadpandoc-5eaff399d5d6dc30b0d453eff42c4101674d75ab.tar.gz
Prepend `jupyter_` to jupyter metadata keys.
This avoids conflics with things like 'toc'.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Ipynb.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Ipynb.hs b/src/Text/Pandoc/Readers/Ipynb.hs
index 2497e6a0a..0bcde1990 100644
--- a/src/Text/Pandoc/Readers/Ipynb.hs
+++ b/src/Text/Pandoc/Readers/Ipynb.hs
@@ -72,8 +72,14 @@ notebookToPandoc :: (PandocMonad m, FromJSON (Notebook a))
notebookToPandoc opts notebook = do
let cells = notebookCells notebook
let (fmt,fmtminor) = notebookFormat notebook
+ let jupyterMetaFields :: [String]
+ jupyterMetaFields = ["kernelspec", "language_info", "toc"]
let m = M.insert "nbformat" (MetaString $ show fmt) $
M.insert "nbformat_minor" (MetaString $ show fmtminor) $
+ -- mark jupyter fields specially so it doesn't trigger toc
+ M.mapKeys (\k -> if k `elem` jupyterMetaFields
+ then "jupyter_" <> k
+ else k) $
jsonMetaToMeta (notebookMetadata notebook)
let lang = case M.lookup "kernelspec" m of
Just (MetaMap ks) ->