Make @mentions following a slash link to usercards
A slash preceding an @mention was causing the markup for the usercard link to not be generated. For example, the markdown Pinging @bob/@joe Would generate a usercard for @bob, but not @joe.
This commit is contained in:
parent
5bea933370
commit
44b04e4521
|
@ -135,7 +135,7 @@ function invalidBoundary(args, prev) {
|
||||||
var last = prev[prev.length - 1];
|
var last = prev[prev.length - 1];
|
||||||
if (typeof last !== "string") { return false; }
|
if (typeof last !== "string") { return false; }
|
||||||
|
|
||||||
if (args.wordBoundary && (last.match(/(\w|\/)$/))) { return true; }
|
if (args.wordBoundary && (!last.match(/\W$/))) { return true; }
|
||||||
if (args.spaceBoundary && (!last.match(/\s$/))) { return true; }
|
if (args.spaceBoundary && (!last.match(/\s$/))) { return true; }
|
||||||
if (args.spaceOrTagBoundary && (!last.match(/(\s|\>)$/))) { return true; }
|
if (args.spaceOrTagBoundary && (!last.match(/(\s|\>)$/))) { return true; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,6 +276,10 @@ test("Mentions", function() {
|
||||||
"<ol><li><p>this is a list</p></li><li><p>this is an <span class=\"mention\">@eviltrout</span> mention</p></li></ol>",
|
"<ol><li><p>this is a list</p></li><li><p>this is an <span class=\"mention\">@eviltrout</span> mention</p></li></ol>",
|
||||||
"it mentions properly in a list.");
|
"it mentions properly in a list.");
|
||||||
|
|
||||||
|
cooked("Hello @foo/@bar",
|
||||||
|
"<p>Hello <span class=\"mention\">@foo</span>/<span class=\"mention\">@bar</span></p>",
|
||||||
|
"handles mentions separated by a slash.");
|
||||||
|
|
||||||
cookedOptions("@eviltrout", alwaysTrue,
|
cookedOptions("@eviltrout", alwaysTrue,
|
||||||
"<p><a class=\"mention\" href=\"/users/eviltrout\">@eviltrout</a></p>",
|
"<p><a class=\"mention\" href=\"/users/eviltrout\">@eviltrout</a></p>",
|
||||||
"it doesn't onebox mentions");
|
"it doesn't onebox mentions");
|
||||||
|
|
Loading…
Reference in New Issue