Support hashtags (with a.href) on pages.meet post
This commit is contained in:
parent
5c5c5091b4
commit
5bd19dcc18
|
@ -120,6 +120,8 @@ app.post = {
|
|||
value = html2text(value).replaceAll(/\s+/g, ' ')+' ';
|
||||
var replaceAfter = [];
|
||||
for (var i = 0; i < tags.length; i++) {
|
||||
if (tags[i].type === undefined)
|
||||
continue;
|
||||
if (tags[i].type.toLowerCase().trim() === 'mention') {
|
||||
var acct = tags[i].name;
|
||||
var href = tags[i].href;
|
||||
|
@ -134,6 +136,16 @@ app.post = {
|
|||
htmlescape(acct) + '</a>';
|
||||
replaceAfter.push(['@'+ps[0], link]);
|
||||
replaceAfter.push(['@'+acct, link]);
|
||||
} else if (tags[i].type.toLowerCase().includes('hashtag')) {
|
||||
var hash = tags[i].name;
|
||||
var href = tags[i].href;
|
||||
if (hash === undefined || href === undefined)
|
||||
continue;
|
||||
if (!hash.match(/^#[a-zA-Z0-9\_]+$/))
|
||||
continue;
|
||||
const link = '<a class="hashtag" href="'+htmlescape(href)+'">'+
|
||||
htmlescape(hash) + '</a>';
|
||||
replaceAfter.push([hash, link]);
|
||||
}
|
||||
}
|
||||
value = html2text(value);
|
||||
|
|
Loading…
Reference in New Issue