mirror of
https://github.com/discourse/discourse.git
synced 2026-09-05 04:40:41 -05:00
FIX: Properly encode string literals in hbs compiler
This commit is contained in:
@@ -11,7 +11,12 @@ function sexp(value) {
|
|||||||
let result = [];
|
let result = [];
|
||||||
|
|
||||||
value.hash.pairs.forEach(p => {
|
value.hash.pairs.forEach(p => {
|
||||||
result.push(`"${p.key}": ${p.value.original}`);
|
let pValue = p.value.original;
|
||||||
|
if (p.value.type === "StringLiteral") {
|
||||||
|
pValue = JSON.stringify(pValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.push(`"${p.key}": ${pValue}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
return `{ ${result.join(", ")} }`;
|
return `{ ${result.join(", ")} }`;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ template = <<~HBS
|
|||||||
{{a}}
|
{{a}}
|
||||||
{{{htmlValue}}}
|
{{{htmlValue}}}
|
||||||
{{#if state.category}}
|
{{#if state.category}}
|
||||||
{{attach widget="category-display" attrs=(hash category=state.category)}}
|
{{attach widget="category-display" attrs=(hash category=state.category someNumber=123 someString="wat")}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
HBS
|
HBS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user