{ "info": { "author": "Alexandre Fonseca", "author_email": "alexandrejorgefonseca@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "#######################\npelican-metadataparsing\n#######################\n\nA plugin for `Pelican\n`_ that\nallows the easy definition of custom metadata parsers.\n\n\nInstall\n=======\n\nTo install the library, you can use\n`pip\n`_\n\n.. code-block:: bash\n\n $ pip install pelican-metadataparsing\n\n\nUsage\n=====\n\n1. Update ``pelicanconf.py``:\n\n 1. Add ``metadataparsing`` to ``PLUGINS``.\n \n You should add it before any metadata-affecting plugins.\n\n .. code-block:: python\n \n PLUGINS = [..., 'metadataparsing', ...]\n\n 2. Define your custom metadata parsers through the ``METADATA_PARSERS``\n setting:\n\n .. code-block:: python\n\n METADATA_PARSERS = {\n \"\": ,\n \"\": \n }\n\n2. Corresponding fields of the ``page``, ``article`` or ``entity``\n object will have the value returned from the respective parser\n function.\n\n\nExample\n=======\n\nGallery Metadata\n----------------\n\n``pelicanconf.py``:\n\n.. code-block:: python\n\n import collections\n import six\n\n GalleryItem = collections.namedtuple(\"GalleryItem\", [\"url\", \"description\"])\n def parse_gallery(string):\n if string is None or not isinstance(string, collections.Iterable):\n return None\n\n if not isinstance(string, six.string_types):\n string = '\\n'.join(string)\n\n items = []\n\n for line in string.split('\\n'):\n if not line:\n continue\n\n parts = line.split(\"||\")\n\n url = parts[0].strip()\n\n if len(parts) == 1:\n description = None\n else:\n description = parts[1].strip()\n\n items.append(GalleryItem(url, description))\n\n return items\n\n METADATA_PARSERS = {\n \"Gallery\": parse_gallery\n }\n\nTheme:\n\n.. code-block:: html\n\n {% if article.gallery %}\n
\n

Gallery:

\n
    \n {% for image in article.gallery %}\n
  • {{ colorbox(image.url, image.description) }}
  • \n {% endfor %}\n
\n
\n {% endif %}\n\n\nMulti-line metadata to simple string\n------------------------------------\n.. code-block:: python\n\n import collections\n import six\n\n def parse_description(string):\n if string is None or isinstance(string, six.string_types):\n return string\n\n if isinstance(string, collections.Iterable):\n string = \" \".join(string)\n\n return string\n\n\n METADATA_PARSERS = {\n \"Description\": parse_description\n }\n\n\n\nFor a working example check `my site\n`_ and `my site's source code\n`_.", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/AlexJF/pelican-metadataparsing/archive/v0.1.0.zip", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/AlexJF/pelican-metadataparsing", "keywords": "pelican blog static metadata parser", "license": "Apache", "maintainer": null, "maintainer_email": null, "name": "pelican-metadataparsing", "package_url": "https://pypi.org/project/pelican-metadataparsing/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pelican-metadataparsing/", "project_urls": { "Download": "https://github.com/AlexJF/pelican-metadataparsing/archive/v0.1.0.zip", "Homepage": "https://github.com/AlexJF/pelican-metadataparsing" }, "release_url": "https://pypi.org/project/pelican-metadataparsing/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Allow definition of custom metadata parsers for Pelican content", "version": "0.1.0" }, "last_serial": 1203453, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "6c685ff3ae7205c54ac5beaa1f63518e", "sha256": "0a36518c612570882f376ca184c3436ef024b35ea93d56556efbab1277df72ef" }, "downloads": -1, "filename": "pelican-metadataparsing-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6c685ff3ae7205c54ac5beaa1f63518e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6953, "upload_time": "2014-08-26T23:34:27", "url": "https://files.pythonhosted.org/packages/4b/db/4abf2b78842861d3035b4de94919cd6ac39f7e84a8b5084af251c7934e6a/pelican-metadataparsing-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6c685ff3ae7205c54ac5beaa1f63518e", "sha256": "0a36518c612570882f376ca184c3436ef024b35ea93d56556efbab1277df72ef" }, "downloads": -1, "filename": "pelican-metadataparsing-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6c685ff3ae7205c54ac5beaa1f63518e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6953, "upload_time": "2014-08-26T23:34:27", "url": "https://files.pythonhosted.org/packages/4b/db/4abf2b78842861d3035b4de94919cd6ac39f7e84a8b5084af251c7934e6a/pelican-metadataparsing-0.1.0.tar.gz" } ] }