Support lowercase hashtags when there is Uppercase in post
This commit is contained in:
parent
a59debaa2d
commit
d4cf1d92e7
|
@ -144,10 +144,22 @@ app.post = {
|
||||||
continue;
|
continue;
|
||||||
if (!hash.match(/^#[a-zA-Z0-9\_]+$/))
|
if (!hash.match(/^#[a-zA-Z0-9\_]+$/))
|
||||||
continue;
|
continue;
|
||||||
const link = '<a class="hashtag" href="'+htmlescape(href)+'">'+
|
hash = hash.trim();
|
||||||
htmlescape(hash) + '</a>';
|
href = href.trim();
|
||||||
|
const link = '<a class="hashtag" href="'+htmlescape(href)+'">{{hash}}</a>';
|
||||||
value = value.replaceAll(hash, '\\'+hash);
|
value = value.replaceAll(hash, '\\'+hash);
|
||||||
replaceAfter.push(['\\'+hash, link]);
|
replaceAfter.push(['\\'+hash, link.replace('{{hash}}', hash)]);
|
||||||
|
const allhashes = value.match(/#[a-zA-Z0-9\_]+/g);
|
||||||
|
if (allhashes === undefined || allhashes === null)
|
||||||
|
continue;
|
||||||
|
for (var j = 0; j < allhashes.length; j++) {
|
||||||
|
allhashes[j] = allhashes[j].trim();
|
||||||
|
if (allhashes[j].toLowerCase() === hash.toLowerCase() &&
|
||||||
|
allhashes[j] != hash) {
|
||||||
|
value = value.replaceAll(allhashes[j], '\\'+allhashes[j]);
|
||||||
|
replaceAfter.push(['\\'+allhashes[j], link.replace('{{hash}}', allhashes[j])]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
value = html2text(value);
|
value = html2text(value);
|
||||||
|
|
Loading…
Reference in New Issue