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

Error when filtering with 'python -m pandoc_fignos json' #92

Open
siprbaum opened this issue Jul 7, 2021 · 0 comments
Open

Error when filtering with 'python -m pandoc_fignos json' #92

siprbaum opened this issue Jul 7, 2021 · 0 comments

Comments

@siprbaum
Copy link

siprbaum commented Jul 7, 2021

EDITED: to fix copy&paste error for the table.md content

I have a quite strange behaviour that when using the pandoc-fignos filter via python, e.g. using
cat document.json| python -m pandoc_fignos json # this one fails
instead of
cat document.json| pandoc -F pandoc-fignos json # this one succeeds

So the filtering with the direct call to python was done to have a tight control on the python installation, e.g.
we use a pre-packaged self contained python version including pandoc-fignos.
This used to work with a very old pandoc version 2.2.1, but I noticed when trying to upgrade to the latest and greatest
pandoc version 2.14.0.3 the direct filtering with python -m pandoc fails.

Reproducer:

table.md content:

Version | Status | Date of Issue
-|:-:|:-:
01| draft | 2021-06-03

Reproducer script

echo "#### PANDOC VERSION ####"
pandoc --version
echo ""

echo "#### pandoc-fignos VERSION ####"
pandoc-fignos --version

echo "#### running reproducer ####"
pandoc --from markdown+pipe_tables --to json table.md | pandoc --from json --to json --output table.json

# This works
echo "#### Filtering with 'pandoc -F pandoc-fignos' ####"
cat table.json | pandoc -F pandoc-fignos --from json --to gfm

echo ""

# This doesn't work
echo "#### Filtering with 'python -m pandoc_fignos json' ####"
cat table.json | python -m pandoc_fignos json | pandoc --from json --to gfm

Output:

#### PANDOC VERSION ####                                                                                                                 
pandoc.exe 2.14.0.3                                                                                                                      
Compiled with pandoc-types 1.22, texmath 0.12.3, skylighting 0.10.5.2,                                                                   
citeproc 0.4.0.1, ipynb 0.1.0.1                                                                                                          
User data directory: C:\Users\z002bd7y\AppData\Roaming\pandoc                                                                            
Copyright (C) 2006-2021 John MacFarlane. Web:  https://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.                                                              
                                                                                                                                         
#### pandoc-fignos VERSION ####                                                                                                          
pandoc-fignos 2.4.0                                                                                                                      
#### running reproducer ####                                                                                                             
#### Filtering with 'pandoc -F pandoc-fignos' ####                                                                                       
| Version | Status | Date of Issue |
|---------|:------:|:-------------:|
| 01      | draft  |  2021-06-03   |
                                                                                                                                         
#### Filtering with 'python -m pandoc_fignos json' ####                                                                                  
Traceback (most recent call last):                                                                                                       
  File "C:\src\gitlab\document\docgen\python\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\src\gitlab\document\docgen\python\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\src\gitlab\document\docgen\python\lib\site-packages\pandoc_fignos.py", line 669, in <module>
    main()
  File "C:\src\gitlab\document\docgen\python\lib\site-packages\pandoc_fignos.py", line 651, in main                                      
    altered)
  File "C:\src\gitlab\document\docgen\python\lib\site-packages\pandoc_fignos.py", line 648, in <lambda>
    altered = functools.reduce(lambda x, action: walk(x, action, fmt, meta),
  File "C:\src\gitlab\document\docgen\python\lib\site-packages\pandocfilters.py", line 111, in walk
    item['c'] if 'c' in item else None, format, meta)
  File "C:\src\gitlab\document\docgen\python\lib\site-packages\pandocxnos\core.py", line 871, in process_refs
    _process_refs(value[-5], pattern, labels)
  File "C:\src\gitlab\document\docgen\python\lib\site-packages\pandocxnos\core.py", line 95, in wrapper
    ret = func(*args, **kwargs)
  File "C:\src\gitlab\document\docgen\python\lib\site-packages\pandocxnos\core.py", line 770, in _process_refs
    if v['t'] == 'Cite' and len(v['c']) == 2:
TypeError: 'NoneType' object is not subscriptable                                                                                        
JSON parse error: Error in $: not enough input
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

1 participant