pandoc / lua-filters

A collection of lua filters for pandoc
MIT License
602 stars 165 forks source link

Pandoc 2.15 breaks diagram-generator filter #193

Closed twsh closed 2 years ago

twsh commented 2 years ago

When I try make test I get the following error, after upgrading to Pandoc 2.15:

PandocLuaError "Error during function call:\n\tPandocIOError \"pipe\" : createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)"
Error running filter diagram-generator.lua:
diagram-generator.lua:327: Image conversion failed. Aborting.
stack traceback:
    [C]: in function 'error'
    diagram-generator.lua:327: in function 'CodeBlock'
make: *** [Makefile:5: sample.html] Error 83
jgm commented 2 years ago

@tarleb is this related to any of the recent Lua subsystem changes?

tarleb commented 2 years ago

Looks like pandoc.utils.stringify now converts all bare strings to the empty string for some reason. Not sure yet what's causing that, but the recent changes are almost definitely the culprit.

tarleb commented 2 years ago

Found the problem. It boils down to Attr retrieval being very permissive.

The argument for stringify is retrieved via T.P.Lua.Module.Utils.peekAstElement. Previously, a bare string was read as a MetaString element, which is the last option in that list. But now that peekAttr also accepts a bare string, it succeeded. But stringifying an Attr yields the empty string, hence the bug.

I'm going to push a change to pandoc which alters the order in peekAstElement; that will resolves the issue.

tarleb commented 2 years ago

Should be fixed with the next pandoc release, but I also pushed a small workaround for the current pandoc version.