chdemko / pandoc-latex-environment

Pandoc filter for adding LaTeX environement on specific div
https://pandoc-latex-environment.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
33 stars 9 forks source link

temp fix for stringify not converting MetaString, allowing metadata in defaults file #13

Closed gabindu closed 1 year ago

gabindu commented 3 years ago

When metadata is stored in the metadata section of a defaults file, some of the strings are stored as MetaString objects, instead of MetaInline (which is the case when metadata comes from the document header).

Unfortunately, pandoc's stringify currently does not work on MetaString objects, so this provides a temporary workaround. (This issue has been reported upstream at https://github.com/jgm/pandoc/issues/7149.)

With this fix, metadata can now be stored in a defaults yaml file, for example:

metadata:
  pandoc-latex-environment:
    noteblock: [note]
    tipblock: [tip]
    warningblock: [warning]
    cautionblock: [caution]
    importantblock: [important]
gabindu commented 3 years ago

I accidentally included another commit where I had added some debugging code, sorry about that. The first commit contains everything needed.

gabindu commented 3 years ago

nevermind, I managed to remove the unwanted commit. phew

gabindu commented 3 years ago

After more investigation upstream, it turns out that the issue is not actually MetaString or stringify, but rather the different overall structure of the metadata returned by pandoc in the two different situations (a list of MetaInlines with a list of one Str object each, versus a list of MetaString objects with just a string as content each). As such, I'm not sure if this will change upstream in the near future (or at all), so this "temporary" workaround might very well be necessary longterm...

chdemko commented 1 year ago

Fix in current release