Open castedo opened 1 year ago
This actually comes from something in pandoc: the use of the flush
combinator for pre tags in T.P.Writers.Blaze (l. 38). flush
tells doclayout to ignore the indentation.
This is intentional, because in most cases, indenting a pre tag will cause unwanted spaces in the output.
This YAML context is an exception, but I don't think it would be good to modify the code, because generally we do want pre elements to be flush....
I'm not blocked by this. I have an alternative approach for my usage scenario. So feel free to close.
My usage scenario is having pandoc output HTML but in a format that stores metadata, title HTML, abstract HTML and body HTML as separate structured data variables. I then have separate code (in Python) doing further processing and eventually injecting these and derived variables into jinja2 templates that are part of building a larger static website.
The way I am currently handling this is having pandoc output "HTML" but into a template that is actually the following XML:
<obj>
$if(abstract)$
<str key="abstract"><![CDATA[$abstract$]]></str>
$endif$
<str key="body"><![CDATA[$body$]]></str>
<str key="title"><![CDATA[$title$]]></str>
</obj>
which is in "JSOML" format: https://gitlab.com/castedo/jsoml
With JSOML I can process the ouput file with the same semantics as JSON and YAML, but the format is diff-friendly like YAML and easier than JSON when looking at strings of large HTML text.
I found this bug using pandoc but I'm guessing it's a bug in this Haskell module. I learned about this nesting template feature from the README.md of this repo.
STEPS: With input.md.txt and yaml.template.txt do:
RESULT:
EXPECTED: All five lines of body text to be indented.
VERSION:
This approach could be used to output a valid YAML file with the output content of pandoc variables, some HTML, in a structured and diff-friendly format.