pandoc / lua-filters

A collection of lua filters for pandoc
MIT License
611 stars 166 forks source link

Seems like 44bfd2dcc956c8758704ac5f4492660d9816f596 broke the diagram-generator #164

Closed jerri closed 3 years ago

jerri commented 3 years ago

After updating to the newest master-version of this lua-filters, the diagram-generator doesn't create images when converting to html anymore. When switching back to the sha before 44bfd2dcc956c8758704ac5f4492660d9816f596 the filter works as before. Doing an strace at least I could see that the image code seems to be created. But for some reason it is not rendered when creating the html. My version of pandoc is 2.10.

Test-File

# Test file

```graphviz
graph people {
overlap=false;
WR [shape="box",style=filled,color=purple,fontcolor=white];
Test_Person [shape="plain"];
Test_Person -- Test;
}
```

using the following command

$ pandoc --verbose --lua-filter path/to/lua-filters/diagram-generator/diagram-generator.lua --self-contained -f markdown+emoji -o test.html test.md

With the current master version of the diagram-generator (1090d1e6ed9051317fa191635e9b2906fbb2cfc9) I get an html file that doesn't contain any mention of an image. The complete block is missing. With the version right before the change (963a1974b5db44e32c32533d7a70153d500c5d7e) the html-file contains the image data as expected. I tried to analyse the code change. It looks ok. Not sure what is happening and what is preventing pandoc from converting the image.

jerri commented 3 years ago

The problems seems to be caused because of img_attr parameter in pandoc.Image call. When I remove the img_attr parameter from the call, the image gets output again in the html file?!

jerri commented 3 years ago

Going further down the rabbit hole, the problem seems to stem from the creation of img_attr. When I remove the pandoc.Attr constructor from the generation of img_attr, then again the images is being shown. Could it be that pandoc.Image doesn't expect a pandoc.Attr element in the fourth parameter? Maybe it just expects a dictionary? Just wildly guessing here.

tarleb commented 3 years ago

Thanks for the report! You were right, the issue was with img_attr. Should be fixed now.