Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 29 lines (28 sloc) 1.065 kb
6459a9e @syrusakbary Fixed bugs
authored
1 import pyjade
2 a = pyjade.Parser('''doctype 5
3 html
4 head: title Hello from flask
5 body(attr="2" ba=2)
6 if name
7 h1(class="red") Hello
8 = name
9 span.description #{name|capitalize} is a great name!
10 else
11 h1 Hello World!''')
12 block = a.parse()
13 import pyjade.ext.jinja
14 compiler = pyjade.ext.jinja.Compiler(block)
15 print compiler.compile()
16 # OUT: <!DOCTYPE html>
17 # OUT: <html{{__pyjade_attrs(terse=True)}}>
18 # OUT: <head{{__pyjade_attrs(terse=True)}}>
19 # OUT: <title{{__pyjade_attrs(terse=True)}}>Hello from flask
20 # OUT: </title>
21 # OUT: </head>
22 # OUT: <body{{__pyjade_attrs(terse=True, attrs=[('attr',("2" ba=2))])}}>{% if name %}
23 # OUT: <h1{{__pyjade_attrs(terse=True, attrs=[('class', (("red")))])}}>Hello {{name|escape}}
24 # OUT: </h1><span{{__pyjade_attrs(terse=True, attrs=[('class', (('description')))])}}>{{name|capitalize}} is a great name!</span>{% else %}
25 # OUT: <h1{{__pyjade_attrs(terse=True)}}>Hello World!
26 # OUT: </h1>{% endif %}
27 # OUT: </body>
28 # OUT: </html>
Something went wrong with that request. Please try again.