mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	templates: Suppress Handlebars automatic partial indentation.
Fixes #12795. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							07f93d58a3
						
					
				
				
					commit
					b1aa304c4a
				
			@@ -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');
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
    };
 | 
			
		||||
 
 | 
			
		||||
@@ -87,6 +87,7 @@ export default (env?: string): webpack.Configuration[] => {
 | 
			
		||||
                            // The ones below are defined in static/js/templates.js
 | 
			
		||||
                            'partial', 'plural', 'eq', 'and', 'or', 'not',
 | 
			
		||||
                            't', 'tr'],
 | 
			
		||||
                        preventIndent: true,
 | 
			
		||||
                    },
 | 
			
		||||
                },
 | 
			
		||||
                // load fonts and files
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user