HamlPy icon indicating copy to clipboard operation
HamlPy copied to clipboard

Quoting issues when using inline variable with filter

Open Kangaroux opened this issue 8 years ago • 0 comments

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.

Kangaroux avatar Nov 10 '16 07:11 Kangaroux