s6mike / argmap

Tools for visualising argument maps represented in YAML - combining 2 forked repos with additional bugfixes and customisation.
https://argview.org/
Other
4 stars 1 forks source link

pandoc-argmap.lua: 2 md to pdf examples from README file crash #19

Closed s6mike closed 2 years ago

s6mike commented 2 years ago

Description

Example 1:

pandoc examples/example.md -o Output/example.pdf --lua-filter pandoc-argmap.lua --pdf-engine lualatex --template examples/example-template.latex --data-dir=/opt/miniconda3/envs/$CONDA_ENV_ARGMAPS/share/pandoc`

lua: src/argmap2tikz.lua:274: attempt to index a nil value (local 'f')
stack traceback:
        src/argmap2tikz.lua:274: in function 'main'
        src/argmap2tikz.lua:288: in main chunk
        [C]: in ?
Error running filter /home/s6mike/.pandoc/filters/pandoc-argmap.lua:
Error running src/argmap2tikz.lua (error code 1): <no output>
stack traceback:
        [C]: in function 'pandoc.pipe'
        [string "/home/s6mike/.pandoc/filters/[pandoc-argmap.lu](http://pandoc-argmap.lu/)..."]:47: in upvalue 'argmap2image'
        [string "/home/s6mike/.pandoc/filters/[pandoc-argmap.lu](http://pandoc-argmap.lu/)..."]:147: in function 'CodeBlock'

Example 2:

pandoc examples/example.md -o Output/example.pdf --lua-filter pandoc-argmap.lua --pdf-engine lualatex --include-in-header Output/header.tex --data-dir=/opt/miniconda3/envs/$CONDA_ENV_ARGMAPS/share/pandoc

Example 2 has identical error.

Occurs on 2- pandoc-fix 3.2.1 c3da4a06ca0a63925238920b2a207c29fc606093.

s6mike commented 2 years ago

Cause is this line in pandoc-argmap.lua: local tex = pandoc.pipe("src/argmap2tikz.lua", { opts }, src) -- convert map to standalone tex.

opts is "" in both these cases, and this value {""} causes the crash. Think it's being used as src rather than opts.

Changing the code to be {} when no opts fixes the issue.

Fixed in 2-pandoc-fix: 3.2.2 52890dfdfa0f21dfdb388e3198a7b5bdc3fa7482 and in argmap2mup-fixes: 1.1.6 bc276cabe6c4e446530c7a5dae7e8de4ffba9392