tomduck / pandoc-fignos

A pandoc filter for numbering figures and figure references.
GNU General Public License v3.0
331 stars 25 forks source link

Cleveref problem #51

Closed dbobak closed 6 years ago

dbobak commented 6 years ago

Pandoc 2.2.2.1, Python 3.6.6 on Windows 10. I'm receiving the following error:

pandoc -f markdown-raw_tex+tex_math_single_backslash+grid_tables+pipe_tables+fancy_lists+smart+line_blocks+fenced_code_attributes -t html --mathjax --filter=pandoc-fignos --filter=pandoc-tablenos --filter=pandoc-eqnos --filter=pandoc-citeproc --bibliography=c:\users\deni\documents\archeo\library.bib --csl=c:\Users\deni\zotero\archeo\styles\journal-of-archaeological-science.csl --metadata=reference-section-title:Literatura --metadata=link-citations:true --metadata=lang:pl_PL --metadata=subparagraph:yes --metadata=fignos-caption-name:Ryc. --metadata=fignos-plus-name:ryc. --metadata=fignos-star-name:rycina --metadata=eqnos-plus-name:wz. --metadata=eqnos-star-name:wzór --metadata=xnos-cleveref:On --metadata=tablenos-caption-name:Tabela --metadata=tablenos-plus-name:tab. --metadata=tablenos-star-name:Tabela --metadata=xnos-number-sections:Off --metadata=xnos-cleveref-fake:On test.md
Traceback (most recent call last):
  File "c:\program files\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\program files\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python36\Scripts\pandoc-fignos.exe\__main__.py", line 9, in <module>
  File "c:\program files\python36\lib\site-packages\pandoc_fignos.py", line 415, in main
    process(meta)
  File "c:\program files\python36\lib\site-packages\pandoc_fignos.py", line 354, in process
    assert use_cleveref_default in [True, False]
AssertionError
Error running filter pandoc-fignos:
Filter returned error status 1
harleyday commented 6 years ago

I have the same error using both pythons on windows 10 (all commands executed in powershell).

Python 2.7

pandoc README.md -s --toc --mathjax --css css/pandoc.css --highlight-style pygments -V geometry:margin=1in --pdf-engine=xelatex --bibliography ref/references.bib --filter pandoc-fignos --filter pandoc-tablenos --filter pandoc-citeproc -
-table-of-contents --csl ref/ieee.csl -o README.html

This bash script was working with no errors a few months ago. I have since updated pandoc. It now returns:

Traceback (most recent call last):
  File "C:\Program Files\Pandoc\pandoc-fignos-script.py", line 11, in <module>
    load_entry_point('pandoc-fignos==1.2.0', 'console_scripts', 'pandoc-fignos')()
  File "c:\python27\lib\site-packages\pandoc_fignos.py", line 415, in main
    process(meta)
  File "c:\python27\lib\site-packages\pandoc_fignos.py", line 354, in process
    assert use_cleveref_default in [True, False]
AssertionError
Error running filter pandoc-fignos:
Filter returned error status 1

I tried deleting the fignos.py script in my C:\Program Files\Pandoc folder, and reinstalling pandoc-fignos, but this didn't change anything.


Version info:

pandoc -v

pandoc.exe 2.2.3
Compiled with pandoc-types 1.17.5.1, texmath 0.11.0.1, skylighting 0.7.2
Default user data directory: C:\Users\hd1213\AppData\Roaming\pandoc
Copyright (C) 2006-2018 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
python

Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)] on win32
pip show pandoc-fignos

Name: pandoc-fignos
Version: 1.2.0
Summary: Figure number filter for pandoc
Home-page: https://github.com/tomduck/pandoc-fignos
Author: Thomas J. Duck
Author-email: tomduck@tomduck.ca
License: GPL
Location: c:\python27\lib\site-packages
Requires: pandoc-xnos
Required-by:

Python 3.7

I thought it might be a python version issue, so I tried installing python3 on the same machine, but get the same error:

pandoc README.md -s --toc --mathjax --css css/pandoc.css --highlight-style pygments -V geometry:margin=1in --pdf-engine=xelatex --bibliography ref/references.bib --filter pandoc-fignos --filter pandoc-tablenos --filter pandoc-citeproc -
-table-of-contents --csl ref/ieee.csl -o README.html

Traceback (most recent call last):
  File "C:\Program Files\Pandoc\pandoc-fignos-script.py", line 11, in <module>
    load_entry_point('pandoc-fignos==1.2.0', 'console_scripts', 'pandoc-fignos')()
  File "c:\users\hd1213\appdata\local\programs\python\python37\lib\site-packages\pandoc_fignos.py", line 415, in main
    process(meta)
  File "c:\users\hd1213\appdata\local\programs\python\python37\lib\site-packages\pandoc_fignos.py", line 354, in process
    assert use_cleveref_default in [True, False]
AssertionError
Error running filter pandoc-fignos:
Filter returned error status 1
harleyday commented 6 years ago

Ubuntu pandoc version checking.

I have just tried to replicate this error on Ubuntu 18.04LTS linux and found that pandoc-fignos works fine with pandoc version 1.19.2.4, but this error appears when I upgrade to pandoc version 2.2.3, I hope this helps.

Additionally, pip seems to be complaining about not being able to find a version of pandoc-citeproc which satisfies requirements. Maybe this is the root cause?

Python 2

pip install pandoc-fignos pandoc-citeproc pandoc-eqnos pandoc-tablenos

Requirement already satisfied: pandoc-fignos in /usr/local/lib/python2.7/dist-packages (1.2.0)
Collecting pandoc-citeproc
  Could not find a version that satisfies the requirement pandoc-citeproc (from versions: )
No matching distribution found for pandoc-citeproc

Python 3

pip3 install pandoc-fignos pandoc-citeproc pandoc-eqnos pandoc-tablenos

Requirement already satisfied: pandoc-fignos in /usr/local/lib/python3.6/dist-packages (1.2.0)
Collecting pandoc-citeproc
  Could not find a version that satisfies the requirement pandoc-citeproc (from versions: )
No matching distribution found for pandoc-citeproc

The pandoc error is idential to that given by windows (see comments above).

I hope this helps.

tomduck commented 6 years ago

Yes, it would appear that pandoc has made a change to how it is handling boolean metadata. I think that I have likely fixed it in the pandoc-xnos nextrelease repo. All of my regression tests (which include cleveref handling) are passing. Stay tuned.

tomduck commented 6 years ago

@jgm just released Pandoc 2.2.3.2 which fixes an Issue with YAML metadata processing of Boolean values. This may well fix this Issue. I will still push out a release that handles the old buggy behaviour.

harleyday commented 6 years ago

I just tried again with the pandoc update (version 2.2.3.2 as you suggest), and I'm afraid it makes no difference. This bug is still present withpandoc version 2.2.3.2.

I have found that downgrading to pandoc 1.19.2.4 kills this bug. I hope this helps. Thanks @tomduck.

dbobak commented 6 years ago

Confirmed. The issue is still with pandoc 2.2.3.2.

tomduck commented 6 years ago

There is a behaviour change in pandoc's treatment of boolean metadata values: true, True and TRUE are all accepted, but On is not any more. See the release notes for pandoc 2.2.2.

Please let me know if changing your metadata solves the problem you are experiencing.

I will look at introducing a more helpful error message, and will update the documentation.

dbobak commented 6 years ago

Yes, that was the problem. Changing On to true and Off to false did the trick. It's working perfectly now. Thank you!

harleyday commented 6 years ago

Yes, I can confirm that this fixed the problem on Windows and Linux. Thank you both. This issue can now be closed I think. Perhaps state the now required syntax in the README? I have created a suitable pull request #53 @tomduck . Hope this helps.

tomduck commented 6 years ago

OK, great. I had already made the requisite updates to the README.md in the nextrelease branch. Still, thank you for the pull request. Contributions to the code and documentation are very much appreciated.

I will close this now in anticipation of putting out a new release today.

Cheers, Tom