FIX: Support inline code blocks with @mentions in them.
This commit is contained in:
parent
10bc24b514
commit
0f27232711
|
@ -39,6 +39,10 @@ Discourse.Dialect.on("register", function(event) {
|
|||
usernameIndex = remaining.indexOf(username),
|
||||
before = remaining.slice(0, usernameIndex);
|
||||
|
||||
// Break out if there is an uneven amount of backticks before
|
||||
var backtickCount = before.split('`').length - 1;
|
||||
if ((backtickCount % 2) === 1) { return; }
|
||||
|
||||
pattern.lastIndex = 0;
|
||||
remaining = remaining.slice(usernameIndex + username.length);
|
||||
|
||||
|
|
|
@ -132,6 +132,18 @@ test("Mentions", function() {
|
|||
"<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");
|
||||
|
||||
cooked("`code` is okay before @mention",
|
||||
"<p><code>code</code> is okay before <span class=\"mention\">@mention</span></p>",
|
||||
"Does not mention in an inline code block");
|
||||
|
||||
cooked("@mention is okay before `code`",
|
||||
"<p><span class=\"mention\">@mention</span> is okay before <code>code</code></p>",
|
||||
"Does not mention in an inline code block");
|
||||
|
||||
cooked("don't `@mention`",
|
||||
"<p>don't <code>@mention</code></p>",
|
||||
"Does not mention in an inline code block");
|
||||
|
||||
});
|
||||
|
||||
test("Oneboxing", function() {
|
||||
|
|
Loading…
Reference in New Issue