{ "info": { "author": "Chris Amico", "author_email": "eyeseast@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "# Metalsmyth\n\n[![Build Status](https://travis-ci.org/eyeseast/python-metalsmyth.svg)](https://travis-ci.org/eyeseast/python-metalsmyth)\n\nThis is a little library to process a directory of files with a stack of middleware. It is based on [metalsmith](http://www.metalsmith.io/), which is built in and for Node. This version uses the same three-step process:\n\n1. Read all the files in a source directory.\n2. Invoke a series of plugins that manipulate the files.\n3. Write the results to a destination directory (or do something else!)\n\nEach plugin is simply a callable that takes a dictionary of files, plus a `Stack` instance, and does something. It doesn't actually have to operate on (or return) the files. Each file is parsed for YAML Frontmatter, with file paths as keys (relative to the source directory).\n\n## How is this useful?\n\nI build news applications and interactive stories for a living, often working with other journalists who write text, gather photos and edit video. That content needs to be formatted, cleaned up, organized, combined with other data and whatnot. Then it needs to be put online. \n\nMetalsmyth is a way of organizing that processing pipeline, from raw text to HTML (or other formats). I'm building it with the intention of using it with [Tarbell](http://tarbell.io) or other static site generators. This can also work as a generator on its own.\n\nA few plugins are included by default:\n\n - drafts: filter out posts where `draft` is `true`\n - dates: convert a date field to a Python `datetime.datetime` object\n - markdown: convert post content to HTML using markdown\n - bleach: run `bleach.clean` on post content\n - linkify: run `bleach.linkify` on post content\n\n## Install\n\n $ pip install metalsmyth\n\nBy itself, Metalsmyth only needs [Python Frontmatter][fm], which itself relies on [PyYAML][]. If you want to use the bundled plugins, you'll need a few extra libraries:\n\n $ pip install markdown # for markdown plugin\n $ pip install bleach # for bleach and linkify plugins\n $ pip install jinja2 # for jinja template plugin\n $ pip install python-dateutil # for dates plugin\n\n [fm]: https://github.com/eyeseast/python-frontmatter\n [PyYAML]: http://pyyaml.org\n\n## Usage\n\n```python\nfrom metalsmyth import Stack\nfrom metalsmyth.plugins.dates import Dates\nfrom metalsmyth.plugins.markup import Bleach, Markdown\n\n# create a stack with a source directory and middleware\nstack = Stack('tests/markup', \n Dates('date'), \n Bleach(strip=True), \n Markdown(output_format='html5')\n)\n\n# get processed files\nfiles = stack.run()\n\n# or build to a destination directory\nstack.build('tests/tmp')\n```\n\n### Adding middleware\n\nIf you know all the middleware functions you'll be using when you create a new stack,\njust list them as positional arguments when you initialize.\n\n```python\nstack = Stack('src', Markdown(), Jinja())\n```\n\nIn addition, there's a `stack.use` decorator that will push new funcions onto the end of the stack.\nThis is useful for one-off plugins that don't need any configuration. For (a totally contrived) example, \na specific project might need to ensure that the `stack` instance always knows how many files it's dealing with.\n\n```python\n# define a function and push it onto the stack\n\n@stack.use\ndef count_files(files, stack):\n stack.metadata['count'] = len(files)\n\n# or use pre-defined middleware callables\nstack.use(Markdown())\nstack.use(Jinja())\nstack.use(some_other_function)\n```\n\nFinally, `Stack.middleware` is just a list, so you can edit it any way you'd edit a list. \n\n```python\nstack = Stack('src')\nstack.middleware = [\n Bleach(),\n Markdown(output_format='html5')\n]\n\nstack.middleware.append(Jinja())\n```", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/eyeseast/python-metalsmyth", "keywords": "frontmatter static-generator", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "metalsmyth", "package_url": "https://pypi.org/project/metalsmyth/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/metalsmyth/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/eyeseast/python-metalsmyth" }, "release_url": "https://pypi.org/project/metalsmyth/0.1.6/", "requires_dist": null, "requires_python": null, "summary": "Process a directory of files with frontmatter and middleware", "version": "0.1.6" }, "last_serial": 2265219, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "837246cc934e60f49e4ec7c44d8afc0c", "sha256": "600fea3b3422e5c126d5b668d43d692a39298379a91f9df1d1c6efa0197b22b1" }, "downloads": -1, "filename": "metalsmyth-0.1.0.tar.gz", "has_sig": false, "md5_digest": "837246cc934e60f49e4ec7c44d8afc0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10225, "upload_time": "2014-12-05T02:23:22", "url": "https://files.pythonhosted.org/packages/67/8e/9ca9a1be43c262e7b2fe8f1f0cccbcd7714f4e186e7baed37975e0e1e0cb/metalsmyth-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a0c2ac9a3e3bd65276cc2ff06ac4e63a", "sha256": "59dc18cf005e10894f7695a159ceea035810de0f60a39fbdc7bba8c8effb8f65" }, "downloads": -1, "filename": "metalsmyth-0.1.1.tar.gz", "has_sig": false, "md5_digest": "a0c2ac9a3e3bd65276cc2ff06ac4e63a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10644, "upload_time": "2014-12-08T13:07:40", "url": "https://files.pythonhosted.org/packages/3b/c7/36f9949d4ae64346507caa51a857d944f990373dbbff50f050c0c71ce312/metalsmyth-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "1de3a1faf840af57a8a584324955dd01", "sha256": "878483706a8b780f6a655ba984e8933b89b6261b4e2a6912357be706244ed7c9" }, "downloads": -1, "filename": "metalsmyth-0.1.2.tar.gz", "has_sig": false, "md5_digest": "1de3a1faf840af57a8a584324955dd01", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10664, "upload_time": "2014-12-08T13:45:46", "url": "https://files.pythonhosted.org/packages/ba/a8/489244bbe4a97b13d59ac67d6b56a56edd2b409b7c17236d0c77c1426758/metalsmyth-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "79454b8a8dd722a78099282ecfdfd995", "sha256": "f4141f02c31c04464dd7bc747bb45c778505cdb6c5e742957fcab20105acf798" }, "downloads": -1, "filename": "metalsmyth-0.1.3.tar.gz", "has_sig": false, "md5_digest": "79454b8a8dd722a78099282ecfdfd995", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10661, "upload_time": "2014-12-09T03:31:21", "url": "https://files.pythonhosted.org/packages/c9/2d/4d663f814154240b6a5206af2cd5266f65dca60d2b9d24f35b8fa809c5b1/metalsmyth-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "0b084268fd41a66b543a9eb0ff997bce", "sha256": "299d965b1d7e7fbcd095a35ba2d5ca64322ac337e98622d146a388b40e3ed074" }, "downloads": -1, "filename": "metalsmyth-0.1.4.tar.gz", "has_sig": false, "md5_digest": "0b084268fd41a66b543a9eb0ff997bce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10988, "upload_time": "2014-12-16T04:05:47", "url": "https://files.pythonhosted.org/packages/9c/7c/828749654ceeba6e8c6a9685e7593de8769582aafebe63d58e0dabb63fc1/metalsmyth-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "d8590e0e531a724ad9cd6f9e860a6a3d", "sha256": "62e6edb9122c30da286020fbd3b1635a5e533b93eeb498ed917294b54498cfb4" }, "downloads": -1, "filename": "metalsmyth-0.1.5.tar.gz", "has_sig": false, "md5_digest": "d8590e0e531a724ad9cd6f9e860a6a3d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12022, "upload_time": "2015-01-04T21:45:03", "url": "https://files.pythonhosted.org/packages/e5/2b/8e9b4525650e978799251bfb0564c2f5d8f57804212e839e3f186fa0b5fe/metalsmyth-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "f55ebdc28e1d0b29fa07c091ccaaa29a", "sha256": "dbce25a6e1f5936b0e71e6427dbfe3946707104138bc3598f696bc11570753ff" }, "downloads": -1, "filename": "metalsmyth-0.1.6.tar.gz", "has_sig": false, "md5_digest": "f55ebdc28e1d0b29fa07c091ccaaa29a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11940, "upload_time": "2016-08-06T02:02:50", "url": "https://files.pythonhosted.org/packages/5e/13/1f2693f990dedb50a03b8c5a4f888fa97fd88c3942d037bc443336b1df93/metalsmyth-0.1.6.tar.gz" }, { "comment_text": "", "digests": { "md5": "8e80185392fcdc7ea9ab4db6e96f0fe0", "sha256": "c8d7179d03dc5842cc72b1670806000527a4db1befaf4b8bab2b5cbfd55b28e7" }, "downloads": -1, "filename": "metalsmyth-0.1.6.zip", "has_sig": false, "md5_digest": "8e80185392fcdc7ea9ab4db6e96f0fe0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22876, "upload_time": "2016-08-06T02:02:47", "url": "https://files.pythonhosted.org/packages/bb/31/561817b77a09e99973c48a8d377246663c5b18d55bdc7ca1b48ccc281881/metalsmyth-0.1.6.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f55ebdc28e1d0b29fa07c091ccaaa29a", "sha256": "dbce25a6e1f5936b0e71e6427dbfe3946707104138bc3598f696bc11570753ff" }, "downloads": -1, "filename": "metalsmyth-0.1.6.tar.gz", "has_sig": false, "md5_digest": "f55ebdc28e1d0b29fa07c091ccaaa29a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11940, "upload_time": "2016-08-06T02:02:50", "url": "https://files.pythonhosted.org/packages/5e/13/1f2693f990dedb50a03b8c5a4f888fa97fd88c3942d037bc443336b1df93/metalsmyth-0.1.6.tar.gz" }, { "comment_text": "", "digests": { "md5": "8e80185392fcdc7ea9ab4db6e96f0fe0", "sha256": "c8d7179d03dc5842cc72b1670806000527a4db1befaf4b8bab2b5cbfd55b28e7" }, "downloads": -1, "filename": "metalsmyth-0.1.6.zip", "has_sig": false, "md5_digest": "8e80185392fcdc7ea9ab4db6e96f0fe0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22876, "upload_time": "2016-08-06T02:02:47", "url": "https://files.pythonhosted.org/packages/bb/31/561817b77a09e99973c48a8d377246663c5b18d55bdc7ca1b48ccc281881/metalsmyth-0.1.6.zip" } ] }