Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No caption numbers in docx output #106

Open
cgonzalezgar opened this issue Feb 20, 2023 · 4 comments
Open

No caption numbers in docx output #106

cgonzalezgar opened this issue Feb 20, 2023 · 4 comments

Comments

@cgonzalezgar
Copy link

cgonzalezgar commented Feb 20, 2023

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. 

![map](C:\Pandoc\map.png){#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)
image

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

@brenwickham
Copy link

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.

@Miaoyifei-mz
Copy link

I have changed core.py, but the error still exist.

@ttxtea
Copy link

ttxtea commented Aug 28, 2023

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:

@Jokymon
Copy link

Jokymon commented Sep 6, 2023

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):

![map](C:\Pandoc\map.png){#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

def process_figures(key, value, fmt, meta): # pylint: disable=unused-argument
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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants