Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allows for use of inline conditionals in attributes #184

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

zeraien
Copy link

@zeraien zeraien commented Mar 30, 2015

This allows for a ternary ? conditional statement to be used in pyjade attributes.

li(bar=1?'1':'0')
a(foo='foo', bar=1+1==2?'15':'0')
a(bar=1+1==1?'1':'1+1 is not 1')
a(bar=(1+1)==2&&1?'(1+1)==2 and 1':'0')

Or a Django example:

li(role="presentation", class=range['current'] ? "disabled":"")

@auvipy
Copy link

auvipy commented Nov 11, 2015

state of the pr?

@frgtn
Copy link
Contributor

frgtn commented Nov 11, 2015

You can already use inline python conditionals like so:

a(bar=("foo" if condition else "baz"))

@kakulukia
Copy link

Since there are no updates to pyjade and its successor recently was deleted from pypi, I took the liberty to revive it: https://github.com/kakulukia/pypugjs

Version 5.0.1 has fixed the incompatibility with recent Django versions.

Like stated above there already is a way of doing what you want and for assigning classes there is another PR open that solves the same problem in a more elegant way. Hope it get resubmitted or else i will probably include it myself to pypugjs since i like it. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants