mirror of https://github.com/zulip/zulip.git
Revert "templates: Add {{#let}} block helper."
This reverts commit f81cc16a0f
(#17999).
The {{#tr}} helper now includes the functionality that we wanted from
this.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
d0c13736c7
commit
b0c07d433f
|
@ -28,21 +28,6 @@ run_test("or", () => {
|
|||
assert.equal(html, "\n<p>last or</p>\n<p>true or</p>\n");
|
||||
});
|
||||
|
||||
run_test("let", () => {
|
||||
const html = require("./templates/let.hbs")({
|
||||
outer_var: "hello",
|
||||
});
|
||||
assert.equal(
|
||||
html,
|
||||
`\
|
||||
outer_var = hello
|
||||
keyword_var = <b>escaped</b>
|
||||
block_var = <b>unescaped</b> with hello
|
||||
|
||||
`,
|
||||
);
|
||||
});
|
||||
|
||||
run_test("rendered_markdown", () => {
|
||||
const html = require("./templates/rendered_markdown.hbs")();
|
||||
const expected_html =
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
{{#let keyword_var="<b>escaped</b>"}}
|
||||
{{#*inline "block_var"}}
|
||||
<b>unescaped</b> with {{outer_var}}
|
||||
{{/inline}}
|
||||
outer_var = {{outer_var}}
|
||||
keyword_var = {{keyword_var}}
|
||||
block_var = {{block_var}}
|
||||
{{/let}}
|
|
@ -48,26 +48,6 @@ Handlebars.registerHelper({
|
|||
not(a) {
|
||||
return !a || Handlebars.Utils.isEmpty(a);
|
||||
},
|
||||
["let"](options) {
|
||||
// Defines locally scoped variables.
|
||||
// Example usage:
|
||||
// {{#let name1="value1"}}
|
||||
// {{#*inline "name2"}}
|
||||
// value2
|
||||
// {{/inline}}
|
||||
// Now {{name1}} and {{name2}} are in scope.
|
||||
// {{/let}}
|
||||
return options.fn({
|
||||
...this,
|
||||
...options.hash,
|
||||
...Object.fromEntries(
|
||||
Object.entries(options.fn.partials ?? {}).map(([name, value]) => [
|
||||
name,
|
||||
new Handlebars.SafeString(value(this)),
|
||||
]),
|
||||
),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
// Note that this i18n caching strategy does not allow us to support
|
||||
|
|
|
@ -148,7 +148,6 @@ export default (_env: unknown, argv: {mode?: string}): webpack.Configuration[] =
|
|||
"and",
|
||||
"or",
|
||||
"not",
|
||||
"let",
|
||||
"t",
|
||||
"tr",
|
||||
"rendered_markdown",
|
||||
|
|
Loading…
Reference in New Issue