mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-27 08:23:02 +00:00
Fix #1574
This commit is contained in:
parent
59c39fab13
commit
058602352c
1 changed files with 6 additions and 12 deletions
|
@ -43,27 +43,21 @@ function parse(html: string): string {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
const cls = node.attrs
|
const txt = getText(node);
|
||||||
? (node.attrs.find(x => x.name == 'class') || { value: '' }).value.split(' ')
|
|
||||||
: [];
|
|
||||||
|
|
||||||
// for Mastodon
|
// メンション
|
||||||
if (cls.includes('mention')) {
|
if (txt.startsWith('@')) {
|
||||||
const mention = getText(node);
|
const part = txt.split('@');
|
||||||
|
|
||||||
const part = mention.split('@');
|
|
||||||
|
|
||||||
if (part.length == 2) {
|
if (part.length == 2) {
|
||||||
//#region ホスト名部分が省略されているので復元する
|
//#region ホスト名部分が省略されているので復元する
|
||||||
|
|
||||||
const href = new URL(node.attrs.find(x => x.name == 'href').value);
|
const href = new URL(node.attrs.find(x => x.name == 'href').value);
|
||||||
const acct = mention + '@' + href.hostname;
|
const acct = txt + '@' + href.hostname;
|
||||||
text += acct;
|
text += acct;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
} else if (part.length == 3) {
|
} else if (part.length == 3) {
|
||||||
text += mention;
|
text += txt;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue