Merge pull request #3859 from jamesgecko/mentions-preceeded-by-slashes-generate-usercard-links

Make @mentions following a slash link to usercards
This commit is contained in:
Régis Hanol 2015-10-18 10:56:26 +02:00
commit b117c2541d
2 changed files with 5 additions and 1 deletions

View File

@ -135,7 +135,7 @@ function invalidBoundary(args, prev) {
var last = prev[prev.length - 1];
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.spaceOrTagBoundary && (!last.match(/(\s|\>)$/))) { return true; }
}

View File

@ -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>",
"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,
"<p><a class=\"mention\" href=\"/users/eviltrout\">@eviltrout</a></p>",
"it doesn't onebox mentions");