-
Notifications
You must be signed in to change notification settings - Fork 92
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
Logic in attributes dictionary #38
Comments
I was about to post the same issue. Logic and template tags in attributes is the one thing stopping me from using this I think. Maybe it can be done using a filter? |
This hamlpy:
Gives me this output:
Is this not what you were expecting? |
I talk about more haml in work with attributes values |
How would your syntax from #50 work when mixing text and tags? Like this?
The only disadvantage of putting template tags in strings is that it prevents putting an Also, I don't think & quot; should be used at all, it could prevent inline javascript. It should be Given the above, I think the following rules should apply:
Personally I'm a fan of getting rid of the Python dictionary syntax in favour of SHPAMLs syntax:
Eliminates these problems because the tags attribute text is identical to HTML. It also eases the pain of migrating HTML to HAML |
I think this is good enaugh:
|
CC: @markusgattol @mkcode I was playing with how to parse this and would like some input. Parsing the example from @neoascetic above is fine (when it's a multiline string), but it would be nice to have an inline one too, e.g:
But a problem arises here when there are commas in the template tag:
It's hard for the parser to know if the comma is part of the attribute dictionary or part of the template tag. I'd rather not get into allowing escaped commas as that could get very ugly and confusing particularly as the comma is not necessarily always in quotes. I propose this as a solution: Allow use of the inline variable syntax (
Note that this syntax already works in attribute strings (e.g. Any input or better ideas would be appreciated. Regards, |
Hey, if anyone is interested I'm working on this at the moment on the Barry |
Are there any plans to merge the element_parser branch with recent changes in the master branch? |
Sometimes element's attributes can depends on some logic or django variables, for example:
I want to do it in haml-way, but this is impossible in the current version of
hamlpy
The text was updated successfully, but these errors were encountered: