HamlPy
HamlPy copied to clipboard
Quoting issues when using inline variable with filter
Example: %input{type: "text", value: "={f.value|default:""}"}
The double quotes for default are removed, which renders to value='{{ f.value|default: }}' and raises an exception because it's missing a parameter.
Using single quotes causes them to be escaped, so you get: value='{{ f.value|default:\'\'}}', also raising an exception.
For this to work you need to wrap the attribute in single quotes and use double quotes inside, like: %input{type: "text", value: '={f.value|default:""}'}
If single and double quotes are both supported for attributes then the same should apply for inside the attribute.