Is there already a library or something that does this in an abstract manner?
I have a Markdown parsed into Pandoc AST. I want to "map" this AST into some custom structured data type. I want a "language" that can define this "map", to convert pandoc's AST to whatever custom type.
Imagine we have the Pandoc AST for the above Markdown (the translation table of each feature is represented in the AST as definition lists), and I'd like to write a "map" for converting it to the values of the following data type Features:
typeFeatures=NonEmptyFeaturedataFeature=Feature{unFeature::TranslatedText}dataTranslateda=MapLanga-- TODO: use non-empty map with default keydataLang=EN|FR
How would you approach this problem more generally, so as to make it possible to support other output data types with minimal code (for mapping)?
The map should be strict, so as to fail on unexpected markdown uses (eg: don't want third level heading or blockquotes in the example above).
Is there already a library or something that does this in an abstract manner?
I have a Markdown parsed into Pandoc AST. I want to "map" this AST into some custom structured data type. I want a "language" that can define this "map", to convert pandoc's AST to whatever custom type.
Here's an example,
Imagine we have the Pandoc AST for the above Markdown (the translation table of each feature is represented in the AST as definition lists), and I'd like to write a "map" for converting it to the values of the following data type
Features
:How would you approach this problem more generally, so as to make it possible to support other output data types with minimal code (for mapping)?
The map should be strict, so as to fail on unexpected markdown uses (eg: don't want third level heading or blockquotes in the example above).