pandoc-fignos
pandoc-fignos copied to clipboard
No caption numbers in docx output
Hi
I,m triying to generate a very simple docx with an image an it's corresponding caption. However, my output doesn't looks like the ones in the examples.
This is the source file (markdown)
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
{#fig:map_id}
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
and this is the command used:
pandoc -f markdown -t docx test.md --filter pandoc-fignos -o test.docx
This is the output I get in MS Word (no number, not even "Figure" caption)

My enviroment:
- OS: Windows 10
- pandoc version : 3.1
- padoc-fignos version 2.4.0
- python version 3.10.1
Probably it's something really simple, but I can't find it.
Regards, Carlos
I have the same problem. I noticed it when trying to work out why I was getting "Bad reference" errors. Finally noticed that none of the figures were numbered, which is why the reference was bad. This wasn't happening a couple of weeks ago. We're preparing a report and have been running the same command many times over the last few weeks. In case it's relevant, around the same time I got this error when running the command:
<userpath>.pyenv/versions/3.9.7/envs/pandoc/lib/python3.9/site-packages/pandocxnos/core.py", line 179, in _get_pandoc_version
raise RuntimeError(msg)
RuntimeError: Cannot understand pandocversion=3.1
Error running filter pandoc-fignos:
This can be fixed by manually changing core.py as @nandokawka writes here. It seems more than a coincidence that the figures stop appearing around the same time as this error.
I have changed core.py, but the error still exist.
Same issue with
pandoc 3.1.1
Features: +server +lua
Scripting engine: Lua 5.4
If you refer to the figure you get pandoc-fignos: Bad reference:
Maybe this could help in finding a bugfix. I'm running into similar issues when trying to generate LaTeX or HTML output. From some very rough debugging attempts I'm getting the feeling, that these "free standing" images are not properly processed by the fignos filter.
When you add a non-breaking space at the end of such an image (notice the \ at the end of the line):
{#fig:map_id}\
you can get rid of the Bad reference: error. The same happens when you add some text in front.
After having a quick look at https://github.com/tomduck/pandoc-fignos/blob/6ab8ac6e2d5ab89805e96a36fd01ba19e8f697a6/pandoc_fignos.py#L294 and following lines, I believe that there is a problem in how the filter searches for images. It only checks for 'Para' and 'Div' but should also somehow handle 'Image '. Maybe this has to do with a change to Pandoc 3.x?