templates: Suppress Handlebars automatic partial indentation.

Fixes #12795.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2019-07-16 14:20:23 -07:00
committed by Tim Abbott
parent 07f93d58a3
commit b1aa304c4a
3 changed files with 7 additions and 3 deletions

View File

@@ -870,7 +870,7 @@ run_test('message_group', () => {
{
msg: {
content: 'This is message two.',
match_content: 'This is message <span class="highlight">two</span>.',
match_content: 'This is message <span class="highlight">two</span>.\n<pre>code\nblock</pre>',
is_stream: true,
unread: true,
id: 2,
@@ -897,7 +897,7 @@ run_test('message_group', () => {
assert.equal(first_message_text, "This is message one.");
var last_message_html = $(html).next('.recipient_row').find('div.messagebox').last().find('.message_content').html().trim();
assert.equal(last_message_html, 'This is message <span class="highlight">two</span>.');
assert.equal(last_message_html, 'This is message <span class="highlight">two</span>.\n<pre>code\nblock</pre>');
var highlighted_topic_word = $(html).find('a.narrows_by_topic .highlight').text();
assert.equal(highlighted_topic_word, 'two');

View File

@@ -14,7 +14,10 @@ module.exports.make_handlebars = () => {
const name = "$" + path.relative(templates_path, filename);
if (!compiled.has(name)) {
compiled.add(name);
hb.registerPartial(name, hb.compile(fs.readFileSync(filename, "utf-8"), { zjsFilename: filename }));
hb.registerPartial(
name,
hb.compile(fs.readFileSync(filename, "utf-8"), { preventIndent: true, zjsFilename: filename })
);
}
return name;
};