DCsunset / pandoc-include

A pandoc filter to allow file and header inclusion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using pandoc-include results in NotImplementedError

axelkennedal opened this issue · comments

I installed pandoc-include through pip and added the executable to the path. Upon trying to use the filter I get this error:

Traceback (most recent call last):
  File "/Users/axelkennedal/.local/bin/pandoc-include", line 8, in <module>
    sys.exit(main())
  File "/Users/axelkennedal/.local/lib/python3.7/site-packages/pandoc_include.py", line 166, in main
    return pf.run_filter(action, doc=doc)
  File "/Users/axelkennedal/.local/lib/python3.7/site-packages/panflute/io.py", line 224, in run_filter
    return run_filters([action], *args, **kwargs)
  File "/Users/axelkennedal/.local/lib/python3.7/site-packages/panflute/io.py", line 197, in run_filters
    doc = load(input_stream=input_stream)
  File "/Users/axelkennedal/.local/lib/python3.7/site-packages/panflute/io.py", line 58, in load
    doc = json.load(input_stream, object_hook=from_json)
  File "/Users/axelkennedal/miniconda3/lib/python3.7/json/__init__.py", line 296, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/Users/axelkennedal/miniconda3/lib/python3.7/json/__init__.py", line 361, in loads
    return cls(**kw).decode(s)
  File "/Users/axelkennedal/miniconda3/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Users/axelkennedal/miniconda3/lib/python3.7/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
  File "/Users/axelkennedal/.local/lib/python3.7/site-packages/panflute/elements.py", line 1375, in from_json
    raise NotImplementedError(f'Unknown tag: {tag}')
NotImplementedError: Unknown tag: Caption
Error running filter pandoc-include:
Filter returned error status 1

Is this a bug or an issue with my local installation? I use the filter like this in a bash script: pandoc ${DOCPATH} -o ${OUTPUTFILE} --filter pandoc-include. Compilation with pandoc works perfectly fine if I remove the pandoc-include filter.

I'm on macOS 10.15.6 with Python 3.7.6.

I think this error is caused by the panflute library issue.

You could try to upgrade panflute by pip3 install -U panflute, and then try to run the filter again.

I have also published a new version of pandoc-include to fix this issue.
Alternatively, you could try running pip3 install -U pandoc-include to fix it.

Okay, thank you for your help. I have however opted to use the pandoc-lua-filters instead.