{ "info": { "author": "Julien LEICHER", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Affero General Public License v3", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Text Processing :: Markup" ], "description": "spenx |travis| |cover| |pypi| |license|\n===========================================\n\n.. |travis| image:: https://travis-ci.org/ducent/spenx.svg?branch=master\n :target: https://travis-ci.org/ducent/spenx\n\n.. |cover| image:: https://codecov.io/gh/ducent/spenx/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/ducent/spenx\n\n.. |pypi| image:: https://badge.fury.io/py/spenx.svg\n :target: https://badge.fury.io/py/spenx\n\n.. |license| image:: https://img.shields.io/badge/License-GPL%20v3-blue.svg\n :target: https://www.gnu.org/licenses/gpl-3.0\n\nTiny template parser which will convert a `pugjs `_ like syntax to HTML with the help of popular template engines.\n\n**spenx** is not a direct port of the javascript pugjs library but has been heavily influenced by it so don't expect full pugjs features to work. That being said, if you need to add a feature, don't hesitate to submit your pull requests or open an issue!\n\nIn spenx, statements, like conditions and loops, are not processed and outputted \"as it\" to be processed by the template engine you wish to use.\n\nAt the time being, only **Jinja2** and **Mako** has been tested but adding support for anything else should be easy.\n\nWhy another parser?\n-------------------\n\nI know there's a lot of port of jade, pugjs and so on for python. But everyone seems to be unmaintained. I really like the syntax use by pug and want something simplier and easier to maintain in the future with a strict set of features.\n\nThis is why the parser is defined using `Arpeggio `_ and the cleanpeg syntax. It's easier to read, understand and maintain.\n\nThe spenx code is really tiny, check it yourself!\n\nInstallation\n------------\n\n.. code-block:: console\n\n $ pip install spenx\n\nUsage\n-----\n\nUsing spenx is fairly easy:\n\n.. code-block:: python\n\n from spenx import Parser\n\n # Without backend\n parser = Parser()\n\n parser.parse(\"\"\"\n p Hello world\n \"\"\")\n\n # =>

Hello world

\n\n # Using jinja2\n from spenx.ext.jinja import Spenx\n from jinja import Environment\n\n env = Environment(\n # Common jinja parameters\n extensions=[Spenx], # And the spenx extension\n )\n\n # Only preprocess files with given extensions\n env.spenx_process_extensions = ['.pug', '.spenx'] # Those are the default\n\n # And use env.get_template and render as usual\n\n # Using mako\n from spenx.ext.mako import preprocessor\n from mako.template import Template\n\n tpl = Template(\"p Hello world\", preprocessor=preprocessor)\n\n # And use render as usual\n\nSyntax\n------\n\nIf you're already using pugjs, you should feel familiar with the syntax (see the `tests/` folder for more insights).\n\nValid attributes values are:\n\n- strings, enclosed in `'` or `\\`` (`type='text'`)\n- booleans (`required=True`)\n- numbers (`value=42.0`)\n\n.. code-block:: text\n\n \n html(lang='en')\n head\n meta(charset='utf-8')\n title My first spenx webpage!\n body\n h1 spenx\n p.welcome\n | Did I said you'll feel right at home if you're using pugjs? \n | Because I guess that's right!\n .container\n p Without a tag defined, div will be assumed \n strong pretty cool huh?\n\nAnd this is what's rendered by spenx:\n\n.. code-block:: text\n\n My first spenx webpage!

spenx

Did I said you'll feel right at home if you're using pugjs? Because I guess that's right!

Without a tag defined, div will be assumed pretty cool huh?

\n\nAnd after using BeautifulSoup:\n\n.. code-block:: text\n\n \n \n \n \n \n My first spenx webpage!\n \n \n \n

\n spenx\n

\n

\n Did I said you'll feel right at home if you're using pugjs? Because I guess that's right!\n

\n
\n

\n Without a tag defined, div will be assumed\n \n pretty cool huh?\n \n

\n
\n \n \n\nTesting\n-------\n\n.. code-block:: bash\n\n $ pip install -e .[test]\n $ python -m nose --with-doctest -v --with-coverage --cover-package=spenx", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ducent/spenx", "keywords": "", "license": "GPL-3.0", "maintainer": "", "maintainer_email": "", "name": "spenx", "package_url": "https://pypi.org/project/spenx/", "platform": "", "project_url": "https://pypi.org/project/spenx/", "project_urls": { "Homepage": "https://github.com/ducent/spenx" }, "release_url": "https://pypi.org/project/spenx/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "Python 3 template parser to generate HTML from a pug/jade like syntax", "version": "1.1.0" }, "last_serial": 5352059, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "7918d476c01aaa96c56083a089dc5b7a", "sha256": "b172cc8f860c8da6501274400ad5726c5e2d9c908ae1c7d79151bb0801192e2f" }, "downloads": -1, "filename": "spenx-1.0.0.tar.gz", "has_sig": false, "md5_digest": "7918d476c01aaa96c56083a089dc5b7a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6019, "upload_time": "2019-04-12T20:13:40", "url": "https://files.pythonhosted.org/packages/fe/01/322b6b787a99f1559cd6e34d5baab64d4fda255cf2037eee0442da0ea2f9/spenx-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "77a2f46ea6984164f3ac28f22340cd77", "sha256": "56d2e0ae52b0f360727714f6c90be19b9ce8b64d0f7aa4e3ad93ea37d2b47525" }, "downloads": -1, "filename": "spenx-1.0.1.tar.gz", "has_sig": false, "md5_digest": "77a2f46ea6984164f3ac28f22340cd77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6013, "upload_time": "2019-04-17T07:00:45", "url": "https://files.pythonhosted.org/packages/9e/83/37136414a69a32a58b6fbf5640dd837cecf7dba76b44384980212b88cba8/spenx-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "4289a04e47f82eb6c5fc2ee25b944106", "sha256": "652239060beed1c8ca44756b1fef76488575ff0d77b038bfff9c973181c26a77" }, "downloads": -1, "filename": "spenx-1.0.2.tar.gz", "has_sig": false, "md5_digest": "4289a04e47f82eb6c5fc2ee25b944106", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6312, "upload_time": "2019-04-19T07:33:46", "url": "https://files.pythonhosted.org/packages/80/20/2eeb0a474ebc6b4bfd8d26d8891a56df02b9e7143cd2aa127af93ee25fc4/spenx-1.0.2.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "41a78ed958f11d2c5aa7ef260d1544b0", "sha256": "d218be0e33b4638f7ab8d47fad375d464ce5bde972f68e2c61c94a2e8815be29" }, "downloads": -1, "filename": "spenx-1.1.0.tar.gz", "has_sig": false, "md5_digest": "41a78ed958f11d2c5aa7ef260d1544b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6638, "upload_time": "2019-06-03T11:44:57", "url": "https://files.pythonhosted.org/packages/db/3e/6fc13541ee67af1a251679c3775d5aff9b6cc6fe21f6985a272cb5540139/spenx-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "41a78ed958f11d2c5aa7ef260d1544b0", "sha256": "d218be0e33b4638f7ab8d47fad375d464ce5bde972f68e2c61c94a2e8815be29" }, "downloads": -1, "filename": "spenx-1.1.0.tar.gz", "has_sig": false, "md5_digest": "41a78ed958f11d2c5aa7ef260d1544b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6638, "upload_time": "2019-06-03T11:44:57", "url": "https://files.pythonhosted.org/packages/db/3e/6fc13541ee67af1a251679c3775d5aff9b6cc6fe21f6985a272cb5540139/spenx-1.1.0.tar.gz" } ] }