Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added setup files

  • Loading branch information...
commit 1615714413ead7b2268d1ae0a9095c5b2e90508a 1 parent ea185a9
Syrus Akbary authored
7 .gitignore
View
@@ -0,0 +1,7 @@
+*.pyc
+basic.py
+*.egg-info
+dist/*
+build/*
+*.DS_Store
+*.sublime-*
2  AUTHORS
View
@@ -0,0 +1,2 @@
+PyJade was original created by Syrus Akbary <me@syrusakbary.com> in
+November 2011.
6 INSTALL.txt
View
@@ -0,0 +1,6 @@
+Thanks for downloading PyJade.
+
+To install it, make sure you have Python 2.5 or greater installed. Then run
+this command from the command prompt:
+
+ python setup.py install
25 LICENSE
View
@@ -0,0 +1,25 @@
+(The MIT License)
+
+Copyright (c) 2011 Syrus Akbary
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the
+Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions of
+the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3  MANIFEST.in
View
@@ -0,0 +1,3 @@
+include AUTHORS
+include LICENSE
+include README.rst
148 README.md
View
@@ -0,0 +1,148 @@
+PyJade
+======
+
+PyJade is a high performance template preprocessor, that converts any .jade source to the each Template-language (Django, Jinja2 or Mako).
+
+********************************************************************
+
+INSTALLATION
+============
+
+First, you must do:
+
+ pip install pyjade
+
+Or:
+
+ python setup.py install
+
+Now simply **name your templates with a `.jade` extension** and this jade compiler
+will do the rest. Any templates with other extensions will not be compiled
+with the pyjade compiler.
+
+
+Django
+------
+
+In `settings.py`, modify `TEMPLATE_LOADERS` like:
+
+```python
+TEMPLATE_LOADERS = (
+ 'pyjade.ext.django.loaders.FSLoader',
+ 'pyjade.ext.django.loaders.AppLoader',
+)
+```
+
+These replace your usual Django loaders:
+
+```python
+django.template.loaders.filesystem.Loader
+django.template.loaders.app_directories.Loader
+```
+
+Jinja2
+------
+
+Just add `pyjade.ext.jinja.PyJadeExtension` as extension:
+
+```python
+jinja_env = Environment(extensions=['pyjade.ext.jinja.PyJadeExtension'])
+```
+
+Mako
+----
+
+Just add `pyjade.ext.mako.preprocessor` as preprocessor:
+
+```python
+from pyjade.ext.mako import preprocessor as mako_preprocessor
+mako.template.Template(jade_source,
+ preprocessor=mako_preprocessor
+)
+```
+
+**Actually the mako preprocessor is in development mode**
+
+Flask
+-----
+
+Just add `pyjade.ext.jinja.PyJadeExtension` as extension to the environment of the app::
+
+```python
+app.jinja_env.add_extension('pyjade.ext.jinja.PyJadeExtension')
+```
+
+Pyramid
+-------
+
+Adjust your "your_project/__init__.py" and add the following line somewhere to in the main() function:
+
+```python
+config.include('pyjade.ext.pyramid')
+```
+
+Syntax
+======
+
+The same as the Jade Node.js module (except of no commas on attributes):
+https://github.com/visionmedia/jade/blob/master/Readme.md
+
+Main differences
+----------------
+
+Interpolation is not supported, so you must use the interpolation of the template engine.
+Instead of do `{#somevar}` just do `{{somevar}}` in Jinja2 or Django
+
+Example
+-------
+
+This code:
+
+```jade
+!!! 5
+html(lang="en")
+ head
+ title= pageTitle
+ script(type='text/javascript')
+ if (foo) {
+ bar()
+ }
+ body
+ h1.title Jade - node template engine
+ #container
+ if youAreUsingJade
+ p You are amazing
+ else
+ p Get on it!
+```
+
+
+Converts to:
+
+```html
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <title>{{pageTitle}}</title>
+ <script type='text/javascript'>
+ if (foo) {
+ bar()
+ }
+ </script>
+ </head>
+ <body>
+ <h1 class="title">Jade - node template engine</h1>
+ <div id="container">
+ {%if youAreUsingJade%}
+ <p>You are amazing</p>
+ {%else%}
+ <p>Get on it!</p>
+ {%endif%}
+ </div>
+ </body>
+</html>
+```
+
+TODOs and BUGS
+==============
+See: http://github.com/syrusakbary/pyjade/issues
BIN  pyjade/.DS_Store
View
Binary file not shown
BIN  pyjade/ext/.DS_Store
View
Binary file not shown
14 setup.py
View
@@ -0,0 +1,14 @@
+from setuptools import setup,find_packages
+
+setup(name='pyjade',
+ version = '1.0.0',
+ download_url = 'git@github.com:syrusakbary/pyjade.git',
+ packages = find_packages(),
+ author = 'Syrus Akbary',
+ author_email = 'me@syrusakbary.com',
+ description = 'Jade syntax adapter for Django, Jinja2 and Mako templates',
+ long_description=open('README.rst').read(),
+ keywords = 'jade template converter',
+ url = 'http://github.com/syrusakbary/pyjade',
+ license = 'MIT',
+ )
Please sign in to comment.
Something went wrong with that request. Please try again.