templates: Add {{#let}} block helper.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-04-05 13:05:31 -07:00
committed by Tim Abbott
parent e83538167f
commit f81cc16a0f
5 changed files with 46 additions and 0 deletions

View File

@@ -28,6 +28,21 @@ 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 = &lt;b&gt;escaped&lt;/b&gt;
block_var = <b>unescaped</b> with hello
`,
);
});
run_test("rendered_markdown", () => {
const html = require("./templates/rendered_markdown.hbs")();
const expected_html =