mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
FIX: @mentions within simple quotes
This commit is contained in:
parent
1004edad1a
commit
30cfa33629
2 changed files with 10 additions and 1 deletions
|
@ -28,6 +28,7 @@ Discourse.Dialect.on("register", function(event) {
|
||||||
mentionLookup = dialect.options.mentionLookup || Discourse.Mention.lookupCache;
|
mentionLookup = dialect.options.mentionLookup || Discourse.Mention.lookupCache;
|
||||||
|
|
||||||
if (block.match(/^ {3}/)) { return; }
|
if (block.match(/^ {3}/)) { return; }
|
||||||
|
if (block.match(/^\>/)) { return; }
|
||||||
|
|
||||||
var pushIt = function(p) { result.push(p) };
|
var pushIt = function(p) { result.push(p) };
|
||||||
|
|
||||||
|
@ -53,6 +54,7 @@ Discourse.Dialect.on("register", function(event) {
|
||||||
|
|
||||||
if (remaining && remaining.match(/\n/)) {
|
if (remaining && remaining.match(/\n/)) {
|
||||||
next.unshift(MD.mk_block(remaining));
|
next.unshift(MD.mk_block(remaining));
|
||||||
|
return [result];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +62,6 @@ Discourse.Dialect.on("register", function(event) {
|
||||||
if (remaining.length) {
|
if (remaining.length) {
|
||||||
this.processInline(remaining).forEach(pushIt);
|
this.processInline(remaining).forEach(pushIt);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [result];
|
return [result];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -112,6 +112,14 @@ test("Mentions", function() {
|
||||||
"deals correctly with multiple <code> blocks");
|
"deals correctly with multiple <code> blocks");
|
||||||
cooked("```\na @test\n```", "<p><pre><code class=\"lang-auto\">a @test</code></pre></p>", "should not do mentions within a code block.");
|
cooked("```\na @test\n```", "<p><pre><code class=\"lang-auto\">a @test</code></pre></p>", "should not do mentions within a code block.");
|
||||||
|
|
||||||
|
cooked("> foo bar baz @eviltrout",
|
||||||
|
"<blockquote><p>foo bar baz <span class=\"mention\">@eviltrout</span></p></blockquote>",
|
||||||
|
"handles mentions in simple quotes");
|
||||||
|
|
||||||
|
cooked("> foo bar baz @eviltrout ohmagerd\nlook at this",
|
||||||
|
"<blockquote><p>foo bar baz <span class=\"mention\">@eviltrout</span></p><p> ohmagerd\nlook at this</p></blockquote>",
|
||||||
|
"does mentions properly with trailing text within a simple quote");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Oneboxing", function() {
|
test("Oneboxing", function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue