pandoc-latex-environment icon indicating copy to clipboard operation
pandoc-latex-environment copied to clipboard

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

Open gabindu opened this issue 3 years ago • 3 comments

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 avatar Mar 15 '21 00:03 gabindu

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

gabindu avatar Mar 15 '21 00:03 gabindu

nevermind, I managed to remove the unwanted commit. phew

gabindu avatar Mar 15 '21 00:03 gabindu

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...

gabindu avatar Mar 16 '21 14:03 gabindu

Fix in current release

chdemko avatar Jun 18 '23 15:06 chdemko