Package: pypugjs
PyPugJSPyPugJS is a fork ofPyJadewith the name Jade changed toPugJS.Additional disclaimer:Since the original pypugjs died i took the liberty to keep it alive, because
since starting to work with the jade compiler for node I hate writing HTML and want to continue using it in my Django projects.
I will keep the existing non Django stuff inside the project, but I cannot support anything other since I’m not actively using
it not will be in the foreseable future. Tornado, Mako etc. support will be welcome tho!PyPugJS is a high performance port of PugJS for python, that converts any .pug source into different
Template-languages (Django, Jinja2, Mako or Tornado).UTILITIESTo simply output the conversion to your console:pypugjs [-c django|jinja|mako|tornado] input.pug [output.html]INSTALLATIONTo install pypugjs:pip install pypugjsNow simplyname your templates with a `.pug` extensionand this PugJS compiler
will do the rest.  Any templates with other extensions will not be compiled
with the pypugjs compiler.Framework specific installation instructionsSyntaxGenerally the same as the PugJS Node module (except of cases and several other features, which are not implemented)https://github.com/pugjs/pug/blob/master/README.mdExampleThis code!!! 5html(lang="en")headtitle=pageTitlescript(type='text/javascript').if(foo) {bar()}bodyh1.titlePugJS - node template engine#containerifyouAreUsingPugJSpYou are amazingelsepGet on it!Converts to<!DOCTYPE html><htmllang="en"><head><title>{{pageTitle}}</title><scripttype='text/javascript'>if(foo){bar()}</script></head><body><h1class="title">PugJS - node template engine</h1><divid="container">{%if youAreUsingPugJS%}<p>You are amazing</p>{%else%}<p>Get on it!</p>{%endif%}</div></body></html>Convert existing templates online with theHTML2Jade converter.Register filtersIf you want to register a function as a filter, you only have to
decorate the function withpypugjs.register_filter("filter_name")importpypugjs@pypugjs.register_filter('capitalize')defcapitalize(text,ast):returntext.capitalize()Notable FeaturesAdding conditional classes:a(class={'active-class':True,'another':False})Define mixins like thismixins/foo.pug:mixinfoo(data).foo{{ data }}And use them in your templates like this:includemixins/foo.pugdiv+foo(data)TESTINGTo start the testsuite, start the following commands:make init
make testTODOs and BUGSSee:https://github.com/kakulukia/pypugjs/issuesChangeLogHistory*django docs: mention not to wrap with django’s caching template loaderupdated history5.8.1mentioning the flask example in the installation section of the docsprevent endless recursion in Django template overriding5.8.0more details/docs for using pypugjs with jinja2fixed issue with Jinja Choiceloaders5.7.2Fix specifying attributes without commas.5.7.1code has been blacked5.7.0included encoding detection for template files5.6.1fixed documentation for the new translation callfixed typos in codeadded min Django version to the docsnew release script5.6.0added enable_pug_translations call5.5.1fixed wrong exception handling for visitExtends5.5.0better caching for django template loaderloader has been made compatible with django 1.115.4.0added mixing to flask hello worldClean pipe inserts whitespace This allows for use of a single pipe character on a line to insert a whitespace before or after a tag.5.3.0fixed build script adding back all internal packages5.2.0fixed recursive import problem5.1.5addeded flake8 testingsorting out old Django version 1.11 and 2.0 are left for travis testing5.1.4better release script5.1.3cleanup / documentationextended makefile5.1.2added Makefile for testing, installing, releasing, linting …added coverage reportspackage is mainly base on the cookiecutter packageadditional release helperspackages passes flake8 test5.1.1conditional classes feature (thx to paradoxxxzero)mixin support for jinja (matin)mixin support for djangorefactored the django tests to actually use the file loadersome pep8 fixesAuthorsPyPugs was originally created as PyJade by Syrus Akbary in November 2011.It was then renamed maintained by Matan Noam ShavitSince I need it for my projects and hate coding plain HTML, I continued maintaining this package.