{ "info": { "author": "John MacFarlane", "author_email": "fiddlosopher@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Text Processing :: Filters" ], "description": "pandocfilters\n=============\n\nA python module for writing `pandoc `_ filters\n\nWhat are pandoc filters?\n--------------------------\nPandoc filters\nare pipes that read a JSON serialization of the Pandoc AST\nfrom stdin, transform it in some way, and write it to stdout.\nThey can be used with pandoc (>= 1.12) either using pipes ::\n\n pandoc -t json -s | ./caps.py | pandoc -f json\n\nor using the ``--filter`` (or ``-F``) command-line option. ::\n\n pandoc --filter ./caps.py -s\n\nFor more on pandoc filters, see the pandoc documentation under ``--filter``\nand `the tutorial on writing filters`__.\n\n__ http://johnmacfarlane.net/pandoc/scripting.html\n\nCompatibility\n----------------\nPandoc 1.16 introduced link and image `attributes` to the existing\n`caption` and `target` arguments, requiring a change in pandocfilters\nthat breaks backwards compatibility. Consequently, you should use:\n\n- pandocfilters version <= 1.2.4 for pandoc versions 1.12--1.15, and\n- pandocfilters version >= 1.3.0 for pandoc versions >= 1.16.\n\nPandoc 1.17.3 (pandoc-types 1.17.*) introduced a new JSON format.\npandocfilters 1.4.0 should work with both the old and the new\nformat.\n\nInstalling\n--------------\nRun this inside the present directory::\n\n python setup.py install\n\nOr install from PyPI::\n\n pip install pandocfilters\n\nAvailable functions\n----------------------\nThe main functions ``pandocfilters`` exports are\n\n- ``walk(x, action, format, meta)``\n\n Walk a tree, applying an action to every object. Returns a modified\n tree. An action is a function of the form\n ``action(key, value, format, meta)``, where:\n\n - ``key`` is the type of the pandoc object (e.g. 'Str', 'Para')\n - ``value`` is the contents of the object (e.g. a string for 'Str', a list of\n inline elements for 'Para')\n - ``format`` is the target output format (as supplied by the\n ``format`` argument of ``walk``)\n - ``meta`` is the document's metadata\n\n The return of an action is either:\n\n - ``None``: this means that the object should remain unchanged\n - a pandoc object: this will replace the original object\n - a list of pandoc objects: these will replace the original object;\n the list is merged with the neighbors of the orignal objects\n (spliced into the list the original object belongs to); returning\n an empty list deletes the object\n\n- ``toJSONFilter(action)``\n\n Like ``toJSONFilters``, but takes a single action as argument.\n\n- ``toJSONFilters(actions)``\n\n Generate a JSON-to-JSON filter from stdin to stdout\n\n The filter:\n\n - reads a JSON-formatted pandoc document from stdin\n - transforms it by walking the tree and performing the actions\n - returns a new JSON-formatted pandoc document to stdout\n\n The argument ``actions`` is a list of functions of the form\n ``action(key, value, format, meta)``, as described in more detail\n under ``walk``.\n\n This function calls ``applyJSONFilters``, with the ``format``\n argument provided by the first command-line argument, if present.\n (Pandoc sets this by default when calling filters.)\n\n- ``applyJSONFilters(actions, source, format=\"\")``\n\n Walk through JSON structure and apply filters\n\n This:\n\n - reads a JSON-formatted pandoc document from a source string\n - transforms it by walking the tree and performing the actions\n - returns a new JSON-formatted pandoc document as a string\n\n The ``actions`` argument is a list of functions (see ``walk`` for a\n full description).\n\n The argument ``source`` is a string encoded JSON object.\n\n The argument ``format`` is a string describing the output format.\n\n Returns a the new JSON-formatted pandoc document.\n\n- ``stringify(x)``\n\n Walks the tree x and returns concatenated string content, leaving out\n all formatting.\n\n- ``attributes(attrs)``\n\n Returns an attribute list, constructed from the dictionary attrs.\n\nHow to use\n----------\nMost users will only need ``toJSONFilter``. Here is a simple example\nof its use::\n\n #!/usr/bin/env python\n\n \"\"\"\n Pandoc filter to convert all regular text to uppercase.\n Code, link URLs, etc. are not affected.\n \"\"\"\n\n from pandocfilters import toJSONFilter, Str\n\n def caps(key, value, format, meta):\n if key == 'Str':\n return Str(value.upper())\n\n if __name__ == \"__main__\":\n toJSONFilter(caps)\n\nExamples\n--------\n\nThe examples subdirectory in the source repository contains the\nfollowing filters. These filters should provide a useful starting point\nfor developing your own pandocfilters.\n\n``abc.py``\n Pandoc filter to process code blocks with class ``abc`` containing ABC\n notation into images. Assumes that abcm2ps and ImageMagick's convert\n are in the path. Images are put in the abc-images directory.\n\n``caps.py``\n Pandoc filter to convert all regular text to uppercase. Code, link\n URLs, etc. are not affected.\n\n``comments.py``\n Pandoc filter that causes everything between\n ```` and ```` to be ignored.\n The comment lines must appear on lines by themselves, with blank\n lines surrounding\n\n``deemph.py``\n Pandoc filter that causes emphasized text to be displayed in ALL\n CAPS.\n\n``deflists.py``\n Pandoc filter to convert definition lists to bullet lists with the\n defined terms in strong emphasis (for compatibility with standard\n markdown).\n\n``gabc.py``\n Pandoc filter to convert code blocks with class \"gabc\" to LaTeX\n \\\\gabcsnippet commands in LaTeX output, and to images in HTML output.\n\n``graphviz.py``\n Pandoc filter to process code blocks with class ``graphviz`` into\n graphviz-generated images.\n\n``lilypond.py``\n Pandoc filter to process code blocks with class \"ly\" containing\n Lilypond notation.\n\n``metavars.py``\n Pandoc filter to allow interpolation of metadata fields into a\n document. ``%{fields}`` will be replaced by the field's value, assuming\n it is of the type ``MetaInlines`` or ``MetaString``.\n\n``myemph.py``\n Pandoc filter that causes emphasis to be rendered using the custom\n macro ``\\myemph{...}`` rather than ``\\emph{...}`` in latex. Other output\n formats are unaffected.\n\n``plantuml.py``\n Pandoc filter to process code blocks with class ``plantuml`` to images.\n Needs `plantuml.jar` from http://plantuml.com/.\n\n``theorem.py``\n Pandoc filter to convert divs with ``class=\"theorem\"`` to LaTeX theorem\n environments in LaTeX output, and to numbered theorems in HTML\n output.\n\n``tikz.py``\n Pandoc filter to process raw latex tikz environments into images.\n Assumes that pdflatex is in the path, and that the standalone\n package is available. Also assumes that ImageMagick's convert is in\n the path. Images are put in the ``tikz-images`` directory.\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/jgm/pandocfilters", "keywords": "pandoc", "license": "", "maintainer": "", "maintainer_email": "", "name": "pandocfilters", "package_url": "https://pypi.org/project/pandocfilters/", "platform": "", "project_url": "https://pypi.org/project/pandocfilters/", "project_urls": { "Homepage": "http://github.com/jgm/pandocfilters" }, "release_url": "https://pypi.org/project/pandocfilters/1.4.2/", "requires_dist": null, "requires_python": "", "summary": "Utilities for writing pandoc filters in python", "version": "1.4.2" }, "last_serial": 3080113, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "c71564850af10d7219b016935e0764f1", "sha256": "e851a93ecf5d2dce469ef73f8aa3ab4d75d7f0a4316f634153caca9b74299ba0" }, "downloads": -1, "filename": "pandocfilters-1.0.tar.gz", "has_sig": false, "md5_digest": "c71564850af10d7219b016935e0764f1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6190, "upload_time": "2013-09-12T05:14:10", "url": "https://files.pythonhosted.org/packages/41/9a/29e62f2eaa9e129f598b18d972dd3ee54badf8b6f30221a6167522861c9e/pandocfilters-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "689cbce2566e465dd6c4aa4fdb8c4212", "sha256": "ba643408b86f6ed71b24370e1e9702544d26b945e568af5cccc23095ce66fe6a" }, "downloads": -1, "filename": "pandocfilters-1.0.1.tar.gz", "has_sig": false, "md5_digest": "689cbce2566e465dd6c4aa4fdb8c4212", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6195, "upload_time": "2013-09-30T18:49:25", "url": "https://files.pythonhosted.org/packages/50/6f/2f7e369c74beb66964600b210045b7d82cae42f28bc427a95f27315c452b/pandocfilters-1.0.1.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "c1095be10bcbdfe4d12e65e0b78827d3", "sha256": "13af030bac826fc52d440191b6b9cdd00c42d0378ffe2adb7026f8b794d3b5e7" }, "downloads": -1, "filename": "pandocfilters-1.1.tar.gz", "has_sig": false, "md5_digest": "c1095be10bcbdfe4d12e65e0b78827d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6718, "upload_time": "2013-10-02T16:24:11", "url": "https://files.pythonhosted.org/packages/59/4c/f0b703eda696967b21d67e937dbc6e0c380e7bfa2ea31b814fa9898a906f/pandocfilters-1.1.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "978218b9d4268ce0d156d0c0db94a85e", "sha256": "6cd44c2a8229db6d1bc13159b87fe3c1d6e5e5dfc457f734521bd213ebac7f3c" }, "downloads": -1, "filename": "pandocfilters-1.1.1.tar.gz", "has_sig": false, "md5_digest": "978218b9d4268ce0d156d0c0db94a85e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6713, "upload_time": "2013-10-02T16:25:36", "url": "https://files.pythonhosted.org/packages/2e/86/e7d8b49c0b530fd3a406c17d0054e3416b4eaa02c2f5bf630efb99b27091/pandocfilters-1.1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "6d8a3142dfa9abeaa7708be85db974dd", "sha256": "5a043fe26593006536ef89fd54d756bd1b67dfd59719003430202a72157759af" }, "downloads": -1, "filename": "pandocfilters-1.2.tar.gz", "has_sig": true, "md5_digest": "6d8a3142dfa9abeaa7708be85db974dd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6709, "upload_time": "2013-10-20T22:33:13", "url": "https://files.pythonhosted.org/packages/18/ce/4c38a7e4f0eec5c071ff94d322f37f75af1f20b4c443d023c423219a2add/pandocfilters-1.2.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "a83eeccd0df79c0f3cf91e0af949a367", "sha256": "83dc6e837f0101477b1f8f3e184bf764686b3175e515e3c4ea8525b4ae485f74" }, "downloads": -1, "filename": "pandocfilters-1.2.1.tar.gz", "has_sig": true, "md5_digest": "a83eeccd0df79c0f3cf91e0af949a367", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7310, "upload_time": "2014-06-17T21:28:25", "url": "https://files.pythonhosted.org/packages/ed/8a/01ddbfa28da66065ba98b2dd6616fd7805fa617c3de2c88be90791207d99/pandocfilters-1.2.1.tar.gz" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "9904ae455680159bb71920b2a97b79d1", "sha256": "70151677de9002cf015c576ffc421ff7fd1959daa624e1a60a2642c9e3fda4cb" }, "downloads": -1, "filename": "pandocfilters-1.2.2.tar.gz", "has_sig": true, "md5_digest": "9904ae455680159bb71920b2a97b79d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7316, "upload_time": "2014-09-03T00:11:09", "url": "https://files.pythonhosted.org/packages/34/50/664e40171c36837694015e444e2d602f78a47c244912edbf35023c98682c/pandocfilters-1.2.2.tar.gz" } ], "1.2.3": [ { "comment_text": "", "digests": { "md5": "85ad8f9432071312b214d8a75f20c450", "sha256": "a803ec17780a2c323cf89df696e0c76bef78c02eafaa1e78b033c48fb0fed516" }, "downloads": -1, "filename": "pandocfilters-1.2.3.tar.gz", "has_sig": false, "md5_digest": "85ad8f9432071312b214d8a75f20c450", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7284, "upload_time": "2014-11-17T16:35:00", "url": "https://files.pythonhosted.org/packages/6b/81/a5c125239e19ca1a184d13ce876ce890812e64d254c5191e1aef78bc3bea/pandocfilters-1.2.3.tar.gz" } ], "1.2.4": [ { "comment_text": "", "digests": { "md5": "2ed8c06cda706a12b0dd48b7593bebc4", "sha256": "e2c8e9820e89e52a882b26d3242dccb5931d3a1174d5f6bc31f8ee9e8b37b3cc" }, "downloads": -1, "filename": "pandocfilters-1.2.4.tar.gz", "has_sig": false, "md5_digest": "2ed8c06cda706a12b0dd48b7593bebc4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7296, "upload_time": "2015-04-03T17:46:06", "url": "https://files.pythonhosted.org/packages/b5/ff/a9d6612ee49bec97ea261d216efc1d52263d00c2972ee8a1c586b468ecc4/pandocfilters-1.2.4.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "3b39f22a53cd14fd49a8963dc5cc524e", "sha256": "557d979cef8d282f5e9cda237f773b642ff2925824288e91c3339457165dda3f" }, "downloads": -1, "filename": "pandocfilters-1.3.0.tar.gz", "has_sig": false, "md5_digest": "3b39f22a53cd14fd49a8963dc5cc524e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10081, "upload_time": "2016-01-11T06:25:27", "url": "https://files.pythonhosted.org/packages/88/ee/ad5ac7a557fd4888865d71e46958902e50f9916e28e6278f35237b7550f2/pandocfilters-1.3.0.tar.gz" } ], "1.4.0": [ { "comment_text": "", "digests": { "md5": "5a631d3e5673860e434ac73fc737a969", "sha256": "2e4092fc37534560702e13c4b437cf02590ee27da53c922bda8eb2c43d38a71e" }, "downloads": -1, "filename": "pandocfilters-1.4.0.tar.gz", "has_sig": true, "md5_digest": "5a631d3e5673860e434ac73fc737a969", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13749, "upload_time": "2016-10-24T21:33:30", "url": "https://files.pythonhosted.org/packages/ac/f4/21a127930b1228aaec367e70ba7270185c0b8cd8a32abf56ed698b5d43cf/pandocfilters-1.4.0.tar.gz" } ], "1.4.1": [ { "comment_text": "", "digests": { "md5": "7680d9f9ec07397dd17f380ee3818b9d", "sha256": "ec8bcd100d081db092c57f93462b1861bcfa1286ef126f34da5cb1d969538acd" }, "downloads": -1, "filename": "pandocfilters-1.4.1.tar.gz", "has_sig": false, "md5_digest": "7680d9f9ec07397dd17f380ee3818b9d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14265, "upload_time": "2016-11-09T19:37:28", "url": "https://files.pythonhosted.org/packages/e3/1f/21d1b7e8ca571e80b796c758d361fdf5554335ff138158654684bc5401d8/pandocfilters-1.4.1.tar.gz" } ], "1.4.2": [ { "comment_text": "", "digests": { "md5": "dc391791ef54c7de1572d7b46b63361f", "sha256": "b3dd70e169bb5449e6bc6ff96aea89c5eea8c5f6ab5e207fc2f521a2cf4a0da9" }, "downloads": -1, "filename": "pandocfilters-1.4.2.tar.gz", "has_sig": false, "md5_digest": "dc391791ef54c7de1572d7b46b63361f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14229, "upload_time": "2017-08-08T03:47:37", "url": "https://files.pythonhosted.org/packages/4c/ea/236e2584af67bb6df960832731a6e5325fd4441de001767da328c33368ce/pandocfilters-1.4.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dc391791ef54c7de1572d7b46b63361f", "sha256": "b3dd70e169bb5449e6bc6ff96aea89c5eea8c5f6ab5e207fc2f521a2cf4a0da9" }, "downloads": -1, "filename": "pandocfilters-1.4.2.tar.gz", "has_sig": false, "md5_digest": "dc391791ef54c7de1572d7b46b63361f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14229, "upload_time": "2017-08-08T03:47:37", "url": "https://files.pythonhosted.org/packages/4c/ea/236e2584af67bb6df960832731a6e5325fd4441de001767da328c33368ce/pandocfilters-1.4.2.tar.gz" } ] }