Fix #1574
This commit is contained in:
parent
59c39fab13
commit
058602352c
|
@ -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 New Issue