tomduck / pandoc-xnos

Library code for pandoc-fignos/eqnos/tablenos/secnos.
GNU General Public License v3.0
106 stars 27 forks source link

Does not work with pandoc 3.0 released recently #28

Open hborchew opened 1 year ago

hborchew commented 1 year ago

Hello,

xnos stopped working with the new release of pandoc 3.0.

Is there an easy fix for this?

Thanks, Howard

Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\hborchew\AppData\Roaming\Python\Python311\Scripts\pandoc-xnos.exe__main__.py", line 7, in File "C:\Users\hborchew\AppData\Roaming\Python\Python311\site-packages\pandocxnos\main.py", line 38, in main m.main(stdin, stdout) File "C:\Users\hborchew\AppData\Roaming\Python\Python311\site-packages\pandoc_fignos.py", line 608, in main PANDOCVERSION = pandocxnos.init(args.pandocversion, doc) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hborchew\AppData\Roaming\Python\Python311\site-packages\pandocxnos\core.py", line 224, in init _PANDOCVERSION = _get_pandoc_version(pandocversion, doc) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hborchew\AppData\Roaming\Python\Python311\site-packages\pandocxnos\core.py", line 179, in _get_pandoc_version raise RuntimeError(msg) RuntimeError: Cannot understand pandocversion=3.0 Error running filter pandoc-xnos.exe: Filter returned error status 1

benmaier commented 1 year ago

Did anyone just try changing the regex here: https://github.com/tomduck/pandoc-xnos/blob/master/pandocxnos/core.py#L174 yet? Curious if the rest of the code would just transfer to 3.0 easily

benmaier commented 1 year ago

replacing the aforementioned line with

    pattern = re.compile(r'^[1-3]\.[0-9]+(?:\.[0-9]+)?(?:\.[0-9]+)?$')

works at least as much as that the CLI runs without raising errors. As my specific use case doesn't seem to work with pandoc-xnos anyway, I'll just leave this here and drop out of the discussion. Others might try this.

ShevekUK commented 1 year ago

Thanks for the regex thing, @benmaier. I was having an issue with pandox-secnos and this fixed it for me, for now.

daviewales commented 1 year ago

Related PR: #29

TimothyElder commented 1 year ago

I just upgraded to pandoc 3.1.1 and was having the same error. Changing the regular expression where @benmaier suggested immediately fixed it.

allefeld commented 1 year ago

I have version pandoc-eqnos 2.5.0 installed from PyPI via pipx, and the bug still occurs.

I checked line 174 of pandocxnos/core.py, and the regular expression is like @benmaier proposed.

Pandoc version is 3.1.1.

ttxtea commented 1 year ago

For me the issue also persists despite the "correct" regex

pandoc 3.1.1
Features: +server +lua
Scripting engine: Lua 5.4

pandoc-xnos 2.4.0

If you refer to the figure you get pandoc-fignos: Bad reference:

TimothyElder commented 1 year ago

@ttxtea if you are getting the error pandoc-fignos: Bad reference: then pandoc-fignos is installed and working but there is likely something wrong with the syntax of your figure label. As far as I understand the issue in this thread, the error in the regex in pandoc-xnos and its associated libraries keeps you from even getting the library to work when compiling documents so your issue is separate from the regex.

The standard syntax for labeling a figure is ![Caption.](image.png){#fig:id} and then it is referenced by @fig:id, or in curly brackets.

I have noticed that the Bad reference error occurs even when the label resolves successfully sometimes.

moigagoo commented 8 months ago

Hi! What's blocking the fix? How can I help?

This issue is quite an inconvenience for my flow.

Impramine commented 8 months ago

Hi! This fix will help many people work in scientific publications/ Do you need any help?

Gahia123 commented 2 months ago

This libraries are useful for me too, but I don't know the code so deep to change it.