owickstrom / pandoc-include-code

A Pandoc filter for including code from source files
Mozilla Public License 2.0
141 stars 17 forks source link

Latest version of Pandoc does not work with pandoc-include-code #25

Closed aubertc closed 4 years ago

aubertc commented 4 years ago

I've updated pandoc to the recent 2.8.0.1 version, and, unfortunately, this version does not work with pandoc-include-code anymore:

pandoc --filter pandoc-include-code min.md 
pandoc-include-code: Error in $: Incompatible API versions: encoded with [1,20] but attempted to decode with [1,17,5,4].
CallStack (from HasCallStack):
  error, called at ./Text/Pandoc/JSON.hs:111:48 in pandoc-types-1.17.5.4-22S5sdSWY1o40P5WSw9yTF:Text.Pandoc.JSON
Error running filter pandoc-include-code:
Filter returned error status 1

(even if min.md does not contains any include command).

Is there any easy and hot fix that could be deployed?

aubertc commented 4 years ago

According to pandoc's developper, using a version of the filter "compiled against pandoc-types 1.20 (like pandoc 2.8)" should work.

However, I had no success:

$ su -
# git clone git@github.com:owickstrom/pandoc-include-code.git
# cd pandoc-include-code
# cabal configure
Resolving dependencies...
Configuring pandoc-include-code-1.4.0.0...
# cabal install
Resolving dependencies...
In order, the following will be installed:
pandoc-include-code-1.4.0.0 (reinstall)
Warning: Note that reinstalls are always dangerous. Continuing anyway...
Configuring pandoc-include-code-1.4.0.0...
Building pandoc-include-code-1.4.0.0...
Installed pandoc-include-code-1.4.0.0
# exit
logout
$ pandoc --filter pandoc-include-code min.md 
pandoc-include-code: Error in $: Incompatible API versions: encoded with [1,20] but attempted to decode with [1,17,5,4].
CallStack (from HasCallStack):
  error, called at ./Text/Pandoc/JSON.hs:111:48 in pandoc-types-1.17.5.4-22S5sdSWY1o40P5WSw9yTF:Text.Pandoc.JSON
Error running filter pandoc-include-code:
Filter returned error status 1
aubertc commented 4 years ago

I'm still facing the same issue…

With the latest version of pandoc:

$ pandoc -v
pandoc 2.9.1.1
Compiled with pandoc-types 1.20, texmath 0.12, skylighting 0.8.3
Default user data directory: /root/.local/share/pandoc or /root/.pandoc
Copyright (C) 2006-2019 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.

I download the current source code at https://github.com/owickstrom/pandoc-include-code/archive/master.zip, extract it, then the configuration seems to be normal:

# cabal configure
Resolving dependencies...
Configuring pandoc-include-code-1.5.0.0...

installing goes just fine:

#cabal install
Resolving dependencies...
Configuring pandoc-include-code-1.5.0.0...
Building pandoc-include-code-1.5.0.0...
Installed pandoc-include-code-1.5.0.0

I have the right version of pandoc-types installed:

# cabal info pandoc-types | grep 'Versions installed'
    Versions installed: 1.20

and yet with a similar minimal file, I get:

$ pandoc -F pandoc-include-code test_pandoc-include-code.md 
pandoc-include-code: Error in $: Incompatible API versions: encoded with [1,20] but attempted to decode with [1,17,5,4].
CallStack (from HasCallStack):
  error, called at ./Text/Pandoc/JSON.hs:111:48 in pandoc-types-1.17.5.4-22S5sdSWY1o40P5WSw9yTF:Text.Pandoc.JSON
Error running filter pandoc-include-code:
Filter returned error status 1

I saw that there was a recent commit by @srid to "Bump pandoc to 2.8", but it does not seem to be working on my installation. Am I missing something?

aubertc commented 4 years ago

I was being careless: the version of pandoc-include-code called was actually the one located in ~/.local/bin/pandoc-include-code (and which dated back to 1.3.0.0) and not the one in ~/.cabal/bin/

The commands whereis pandoc-include-code and pandoc-include-code -V made me realize my mistake.

Now that I've updated the paths, the version 1.5.0.0 works flawlessly!