fix Zap mention parsing
This commit is contained in:
parent
534a4b11e3
commit
505f0b025a
|
@ -163,6 +163,13 @@ describe('DatabindedTextComponent', () => {
|
|||
expect(component.processedText).toContain('<a href class="account--test-mastodon-technology" title="@test@mastodon.technology">@test</a>');
|
||||
});
|
||||
|
||||
it('should parse mention - Zap in Mastodon', () => {
|
||||
const sample = `test @<span class="h-card"><a class="u-url mention" href="https://mastodon.social/@test" rel="nofollow noopener noreferrer" target="_blank">test</a></span> bla"`;
|
||||
|
||||
component.text = sample;
|
||||
expect(component.processedText).toContain('test <span class="h-card"><a href class="account--test-mastodon-social" title="@test@mastodon.social">@test</a></span>');
|
||||
});
|
||||
|
||||
it('should parse hastag - Pleroma', () => {
|
||||
const sample = `<p>Bla <a href="https://ubuntu.social/tags/kubecon" rel="tag">#<span>KubeCon</span></a> Bla</p>`;
|
||||
|
||||
|
|
|
@ -44,6 +44,10 @@ export class DatabindedTextComponent implements OnInit {
|
|||
value = value.replace('class="mention" rel="nofollow noopener" target="_blank">@', 'class="mention" rel="nofollow noopener" target="_blank">'); //Misskey sanitarization
|
||||
} while (value.includes('class="mention" rel="nofollow noopener" target="_blank">@'));
|
||||
|
||||
do {
|
||||
value = value.replace('@<span class="h-card">', '<span class="h-card">'); //Zap sanitarization
|
||||
} while (value.includes('@<span class="h-card">'));
|
||||
|
||||
let linksSections = value.split('<a ');
|
||||
|
||||
for (let section of linksSections) {
|
||||
|
|
Loading…
Reference in New Issue