jgm/pandocfilters

Error in Pandoc scripting

simonlau opened this issue · 4 comments

from pandocfilters import toJSONFilter

def caps(key, value, format, meta):
  if key == 'Str':
    return {'Str': value.upper()}

if __name__ == "__main__":
  toJSONFilter(caps)

In the above sample,

key == 'Str' is never true as

key are values like:

  • unMeta
  • tag
  • contents
jgm commented

Yes, the json output produced for generics changed between aeson
0.6.1 and 0.6.2, breaking this module.

The problem is fixed if you install pandoc with the latest pandoc-types.

cabal update && cabal install --reinstall pandoc pandoc-types pandoc-citeproc

Or, if you're on Windows, grab the latest package installer.

+++ Simon Lau [Sep 30 13 02:09 ]:

In the below sample,

key == 'Str' is never true as

key are values like:
* unMeta
* tag
* contents

from pandocfilters import toJSONFilter

def caps(key, value, format, meta):
if key == 'Str':
return {'Str': value.upper()}

if name == "main":
toJSONFilter(caps)


Reply to this email directly or [1]view it on GitHub.
[xJAuenYDiIoVt3LF3y684xqQlLUiClfr2ujsuvd4bQQuL5rthviBCrFbltl3Bq-b.gif]

References

  1. #1

Thanks for the quick response. I'm actually on a Mac using pandoc 1.12.0.1 which I install as a binary. Is this fixed in 1.12.0.2?

jgm commented

Oh, bother. You're right - the osx package is also affected.
I'll try to upload a new one today or tomorrow.

+++ Simon Lau [Sep 30 13 08:59 ]:

Thanks for the quick response. I'm actually on a Mac using pandoc
1.12.0.1 which I install as a binary. Is this fixed in 1.12.0.2?


Reply to this email directly or [1]view it on GitHub.
[xJAuenYDiIoVt3LF3y684xqQlLUiClfr2ujsuvd4bQQuL5rthviBCrFbltl3Bq-b.gif]

References

  1. #1 (comment)
jgm commented

A new OSX package has been uploaded (1.12.0.2). Let me know if that fixes things.