mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
FIX: Obscure emoji fail with a colon surrounded by spaces
This commit is contained in:
parent
9d96fc6370
commit
a63ac64931
@ -64,11 +64,9 @@
|
|||||||
return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')
|
return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')
|
||||||
}
|
}
|
||||||
|
|
||||||
var translationColonRegexp = new RegExp("^" +
|
var translationColonRegexp = new RegExp(Object.keys(translationsWithColon).map(function (t) {
|
||||||
Object.keys(translationsWithColon).map(function (t) {
|
|
||||||
return "(" + escapeRegExp(t) + ")";
|
return "(" + escapeRegExp(t) + ")";
|
||||||
}).join("|")
|
}).join("|"));
|
||||||
);
|
|
||||||
|
|
||||||
Discourse.Dialect.registerInline(':', function(text, match, prev) {
|
Discourse.Dialect.registerInline(':', function(text, match, prev) {
|
||||||
var endPos = text.indexOf(':', 1),
|
var endPos = text.indexOf(':', 1),
|
||||||
@ -80,11 +78,11 @@
|
|||||||
// If there is no trailing colon, check our translations that begin with colons
|
// If there is no trailing colon, check our translations that begin with colons
|
||||||
if (endPos === -1 || (firstSpace !== -1 && endPos > firstSpace)) {
|
if (endPos === -1 || (firstSpace !== -1 && endPos > firstSpace)) {
|
||||||
translationColonRegexp.lastIndex = 0;
|
translationColonRegexp.lastIndex = 0;
|
||||||
var match = translationColonRegexp.exec(text);
|
var m = translationColonRegexp.exec(text);
|
||||||
if (match && match[0]) {
|
if (m && m[0] && text.indexOf(m[0]) === 0) {
|
||||||
contents = imageFor(translationsWithColon[match[0]]);
|
contents = imageFor(translationsWithColon[m[0]]);
|
||||||
if (contents) {
|
if (contents) {
|
||||||
return [match[0].length, contents];
|
return [m[0].length, contents];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -131,9 +131,3 @@ test("dynamically toggles logo size when 'minimized' property changes", function
|
|||||||
setMinimized(false);
|
setMinimized(false);
|
||||||
ok(exists(fixture(bigLogoSelector)), "when 'minimized' version is turned off, small logo is replaced with the big one");
|
ok(exists(fixture(bigLogoSelector)), "when 'minimized' version is turned off, small logo is replaced with the big one");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("links logo to the site root", function() {
|
|
||||||
appendView();
|
|
||||||
|
|
||||||
equal(fixture(".title > a").attr("href"), "/");
|
|
||||||
});
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user