Typesetting Pandoc JSON files directly with ConTeXt; an XML equivalent of JSON and native #10556
massifrg
started this conversation in
Show and tell
Replies: 1 comment 5 replies
-
Well, it's much more readable than pandoc's JSON serialization, and unlike the native serialization, it's readable by standard tools. So I like the idea, personally. Drawback: adds complexity, possibly more things to change when the AST changes. We would need both a reader and a writer. If they could be implemented in a way that just piggybacked off the FromJSON / ToJSON instances for the types, then that would be ideal, because changing these instances would automatically affect both the JSON and XML serializations, and presumably the code could be quite short. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I wrote a module for ConTeXt that lets you typeset Pandoc JSON files directly with ConTeXt.
The goal is to have all the information of a JSON file available in ConTeXt.
In particular, the module converts Pandoc JSON into an equivalent XML, something like this:
The conversion happens in memory, and it is pretty straightforward, because the tags have the same names of Pandoc items (see the project README).
The project has also a script to convert JSON files to XML files.
ConTeXt has great tools to typeset XML, that's why I chose it, instead of directly parsing JSON or markdown with Lua+LPEGs.
I also started writing a Haskell Writer for Pandoc for that XML format, but I'm a newbie in Haskell, so don't expect anything soon.
Also, before delving into that, I'd like to see if there's any interest in such a format, that would be a third form of Pandoc AST, beside native and JSON.
Beta Was this translation helpful? Give feedback.
All reactions