syrusakbary / pyjade

Jade template system for Django, Jinja2 and Mako
MIT License
699 stars 122 forks source link

pyjade.runtime.attrs(attrs=[('class', ((title=='About'?'active':undefined)))], terse=True) #246

Open glassresistor opened 8 years ago

glassresistor commented 8 years ago

This is failing is there another way to do this?

guneysus commented 8 years ago

I am also stucked.

I dont know why size failing but class is a reserved keyword for Python.

    input(name="title" type="text" size=82)
    input(name="title" type="text" class="foobar")
    input(name="title" type="text" value="foobar")

Pyjade compiles my jade files to Tornado templates to non-compatible html files.

I want simply this

<form action="{{ request.path }}" method="post" class="compose">
<input name="title" type="text" size=82 class="title" value="{{ escape(entry.title) if entry else "" }}"/>

But pyjade compiles to this

<form{% raw __pyjade_attrs(attrs=[('action',(request.path))]) %} method="POST">
  <input name="title"{% raw __pyjade_attrs(attrs=[('type',("text" size=82 class="title" value={{ escape(entry.title) }}))]) %}/>
</form>
chdsbd commented 8 years ago

I'm having a similar issue with pyjade. I cannot use the type attribute of the input element without an exception being thrown.

File "/usr/local/lib/python3.5/site-packages/pyjade/ext/html.py", line 88, in visitExtends
    raise pyjade.exceptions.CurrentlyNotSupported()
pyjade.exceptions.CurrentlyNotSupported