{ "info": { "author": "Tim T.Y. Lin", "author_email": "timtylin@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": "scholdocfilters\n===============\n\nA Python module for writing Scholdoc filters, forking off the\noriginal pandoc filters. Scholdoc filters are pipes that read a JSON\nserialization of the Scholdoc AST from stdin, transform it in some\nway, and write it to stdout. They can be used with Scholdoc (>= 0.1.3)\neither using pipes:::\n\n scholdoc -t json | ./caps.py | scholdoc -f json\n\nor using the ``--filter`` (or ``-F``) command-line option:::\n\n scholdoc --filter ./caps.py\n\nScholdocfilters is just jgm's pandocfilters with element types\nadapted to the slightly richer Scholdoc AST. For more usage\ninformation, see John MacFarlane's original pandoc documentation\nunder ``--filter`` and `the tutorial on writing filters`__.\n\n__ http://johnmacfarlane.net/pandoc/scripting.html\n\nTo install::\n\n python setup.py install\n\nThe ``scholdocfilters`` module exports the following functions:\n\n``walk(x, action, format, meta)``\n Walk a tree, applying an action to every object.\n Returns a modified tree.\n\n``toJSONFilter(action)``\n Converts an action into a filter that reads a JSON-formatted\n Scholdoc document from stdin, transforms it by walking the tree\n with the action, and returns a new JSON-formatted Scholdoc document\n to stdout. The argument is a function action(key, value, format,\n meta), where key is the type of the Scholdoc object (e.g. 'Str',\n 'Para'), value is the contents of the object (e.g. a string for\n 'Str', a list of inline elements for 'Para'), format is the target\n output format (which will be taken for the first command line\n argument if present), and meta is the document's metadata. If the\n function returns None, the object to which it applies will remain\n unchanged. If it returns an object, the object will be replaced. If\n it returns a list, the list will be spliced in to the list to which\n the target object belongs. (So, returning an empty list deletes the\n object.)\n\n``stringify(x)``\n Walks the tree ``x`` and returns concatenated string content,\n leaving out all formatting.\n\n``attributes(attrs)``\n Returns an attribute list, constructed from the\n dictionary ``attrs``.\n\nMost users will only need ``toJSONFilter``. Here is a simple example\nof its use:::\n\n #!/usr/bin/env python\n\n \"\"\"\n Scholdoc filter to convert all regular text to uppercase.\n Code, link URLs, etc. are not affected.\n \"\"\"\n\n from scholdocfilters 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\nNOTE: These example are written for ``pandocfilters``. As such, some examples\nare not working due to an incompatible AST between Scholdoc and Pandoc. This\nwill be remedied ASAP.\n\nThe examples subdirectory in the source repository contains the\nfollowing filters. These filters should provide a useful starting\npoint for developing your own scholdocfilters.\n\n- ``abc.py``\n\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\n Pandoc filter to convert all regular text to uppercase. Code, link\n URLs, etc. are not affected.\n\n- ``comments.py``\n\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\n Pandoc filter that causes emphasized text to be displayed in ALL\n CAPS.\n\n- ``deflists.py``\n\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- ``graphviz.py``\n\n Pandoc filter to process code blocks with class ``graphviz`` into\n graphviz-generated images.\n\n- ``metavars.py``\n\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\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- ``theorem.py``\n\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\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.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/timtylin/scholdoc-filters", "keywords": "scholdoc,pandoc", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "scholdocfilters", "package_url": "https://pypi.org/project/scholdocfilters/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/scholdocfilters/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/timtylin/scholdoc-filters" }, "release_url": "https://pypi.org/project/scholdocfilters/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "Utilities for writing Scholdoc filters in Python", "version": "0.1.1" }, "last_serial": 1635658, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "87e88c834dda533d4b640f444af0883e", "sha256": "65c6565eb0a90f5fc0fe0fb9deb495a08ac73905d29b39d9c6b00c0b46d380e2" }, "downloads": -1, "filename": "scholdocfilters-0.1.1.tar.gz", "has_sig": false, "md5_digest": "87e88c834dda533d4b640f444af0883e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5406, "upload_time": "2015-07-16T08:50:44", "url": "https://files.pythonhosted.org/packages/3e/81/b8775f8b59c8e8182559a01566b671d7d513b038f3fc0cf567af64609137/scholdocfilters-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "87e88c834dda533d4b640f444af0883e", "sha256": "65c6565eb0a90f5fc0fe0fb9deb495a08ac73905d29b39d9c6b00c0b46d380e2" }, "downloads": -1, "filename": "scholdocfilters-0.1.1.tar.gz", "has_sig": false, "md5_digest": "87e88c834dda533d4b640f444af0883e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5406, "upload_time": "2015-07-16T08:50:44", "url": "https://files.pythonhosted.org/packages/3e/81/b8775f8b59c8e8182559a01566b671d7d513b038f3fc0cf567af64609137/scholdocfilters-0.1.1.tar.gz" } ] }