{ "info": { "author": "Syrus Akbary", "author_email": "me@syrusakbary.com", "bugtrack_url": null, "classifiers": [], "description": "======\nPyJade\n======\n\nPyJade is a high performance port of Jade-lang for python, that converts any .jade source to the each Template-language (Django, Jinja2, Mako or Tornado).\n\n\nUTILITIES\n=========\nTo simply output the conversion to your console::\n\n pyjade [-c django|jinja|mako|tornado] input.jade [output.html]\n\n\nINSTALLATION\n============\n\nFirst, you must do::\n\n pip install pyjade\n\nOr::\n\n python setup.py install\n\nNow simply **name your templates with a `.jade` extension** and this jade compiler\nwill do the rest. Any templates with other extensions will not be compiled\nwith the pyjade compiler.\n\n\nDjango\n------\n\nIn `settings.py`, add a `loader` to `TEMPLATES` like so:\n\n.. code:: python\n\n TEMPLATES = [\n {\n 'BACKEND': 'django.template.backends.django.DjangoTemplates',\n 'DIRS': [],\n 'OPTIONS': {\n 'context_processors': [\n 'django.template.context_processors.debug',\n 'django.template.context_processors.request',\n 'django.contrib.auth.context_processors.auth',\n 'django.contrib.messages.context_processors.messages',\n 'django.core.context_processors.request'\n ],\n 'loaders': [\n # PyJade part: ##############################\n ('pyjade.ext.django.Loader', (\n 'django.template.loaders.filesystem.Loader',\n 'django.template.loaders.app_directories.Loader',\n ))\n ],\n 'builtins': ['pyjade.ext.django.templatetags'], # Remove this line for Django 1.8\n },\n },\n ]\n\n\nJinja2\n------\n\nJust add `pyjade.ext.jinja.PyJadeExtension` as extension\n\n.. code:: python\n\n jinja_env = Environment(extensions=['pyjade.ext.jinja.PyJadeExtension'])\n\n\nMako\n----\n\nJust add `pyjade.ext.mako.preprocessor` as preprocessor\n\n.. code:: python\n\n from pyjade.ext.mako import preprocessor as mako_preprocessor\n mako.template.Template(haml_source,\n preprocessor=mako_preprocessor\n )\n\n\nFlask\n-----\n\nJust add `pyjade.ext.jinja.PyJadeExtension` as extension to the environment of the app\n\n.. code:: python\n\n app.jinja_env.add_extension('pyjade.ext.jinja.PyJadeExtension')\n\n\nPyramid\n-------\n\nAdjust your \"your_project/__init__.py\" and add the following line somewhere to in the main() function\n\n.. code:: python\n\n config.include('pyjade.ext.pyramid')\n\n\nTornado Templates\n-----------------\n\nAppend this after importing tornado.template\n\n.. code:: python\n\n from tornado import template\n from pyjade.ext.tornado import patch_tornado\n patch_tornado()\n\n (...)\n\n\nSyntax\n======\n\nExactly the same as the Jade Node.js module (except of cases, which are not implemented)\nhttps://github.com/visionmedia/jade/blob/master/README.md\n\n\nExample\n-------\n\nThis code\n\n.. code:: jade\n\n !!! 5\n html(lang=\"en\")\n head\n title= pageTitle\n script(type='text/javascript')\n if (foo) {\n bar()\n }\n body\n h1.title Jade - node template engine\n #container\n if youAreUsingJade\n p You are amazing\n else\n p Get on it!\n\n\nConverts to\n\n.. code:: html\n\n \n \n \n {{pageTitle}}\n \n \n \n

Jade - node template engine

\n
\n {%if youAreUsingJade%}\n

You are amazing

\n {%else%}\n

Get on it!

\n {%endif%}\n
\n \n \n\n\nRegister filters\n================\n\nIf you want to register a function as a filter, you only have to\ndecorate the function with ``pyjade.register_filter(\"filter_name\")``\n\n.. code:: python\n\n import pyjade\n\n @pyjade.register_filter('capitalize')\n def capitalize(text,ast):\n return text.capitalize()\n\n\nTESTING\n=======\n\nYou must have `nose` package installed.\nYou can do the tests with::\n \n ./test.sh\n\n\nTODOs and BUGS\n==============\nSee: http://github.com/syrusakbary/pyjade/issues", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/yetship/pyjade.git", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/yetship/pyjade.git", "keywords": "jade template converter", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "python-jade", "package_url": "https://pypi.org/project/python-jade/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/python-jade/", "project_urls": { "Download": "https://github.com/yetship/pyjade.git", "Homepage": "https://github.com/yetship/pyjade.git" }, "release_url": "https://pypi.org/project/python-jade/4.0.0/", "requires_dist": null, "requires_python": null, "summary": "Jade syntax template adapter for Django, Jinja2, Mako and Tornado templates", "version": "4.0.0" }, "last_serial": 2660651, "releases": { "4.0.0": [ { "comment_text": "", "digests": { "md5": "3cdd189bc94075a736ddb19c3f190a25", "sha256": "70622d9aae027cc7e408a94edccc0f7bb90e6985546f95614ffdf006a5af5c45" }, "downloads": -1, "filename": "python-jade-4.0.0.tar.gz", "has_sig": false, "md5_digest": "3cdd189bc94075a736ddb19c3f190a25", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29289, "upload_time": "2017-02-22T14:23:02", "url": "https://files.pythonhosted.org/packages/a8/38/4b719929d9d4a548d35a263f12a3178ea11ff1150017b362b8a18f633cdb/python-jade-4.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3cdd189bc94075a736ddb19c3f190a25", "sha256": "70622d9aae027cc7e408a94edccc0f7bb90e6985546f95614ffdf006a5af5c45" }, "downloads": -1, "filename": "python-jade-4.0.0.tar.gz", "has_sig": false, "md5_digest": "3cdd189bc94075a736ddb19c3f190a25", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29289, "upload_time": "2017-02-22T14:23:02", "url": "https://files.pythonhosted.org/packages/a8/38/4b719929d9d4a548d35a263f12a3178ea11ff1150017b362b8a18f633cdb/python-jade-4.0.0.tar.gz" } ] }