mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: BBCode was trimming leading space in [code]
blocks
This commit is contained in:
parent
5504622c1b
commit
27e68518df
@ -188,7 +188,7 @@ Discourse.Dialect.replaceBlock({
|
||||
rawContents: true,
|
||||
|
||||
emitter: function(blockContents) {
|
||||
var inner = blockContents.join("\n").replace(/^\s+/,'');
|
||||
var inner = blockContents.join("\n");
|
||||
return ['p', ['pre', ['code', {'class': Discourse.SiteSettings.default_code_lang}, inner]]];
|
||||
}
|
||||
});
|
||||
|
@ -41,6 +41,9 @@ test('code', function() {
|
||||
format("[code]\nx++\n[/code]", "<pre><code class=\"lang-auto\">x++</code></pre>", "makes code into pre");
|
||||
format("[code]\nx++\ny++\nz++\n[/code]", "<pre><code class=\"lang-auto\">x++\ny++\nz++</code></pre>", "makes code into pre");
|
||||
format("[code]abc\n#def\n[/code]", '<pre><code class=\"lang-auto\">abc\n#def</code></pre>', 'it handles headings in a [code] block');
|
||||
format("[code]\n s[/code]",
|
||||
"<pre><code class=\"lang-auto\"> s</code></pre>",
|
||||
"it doesn't trim leading whitespace");
|
||||
});
|
||||
|
||||
test('spoiler', function() {
|
||||
|
Loading…
Reference in New Issue
Block a user