kopia lustrzana https://gitlab.com/jaywink/federation
Adjust ActivityPub hashtag delinkifier for markdown tag links
Since we now convert HTML to Markdown.mentions
rodzic
1070831b2d
commit
d85126d605
|
@ -41,13 +41,13 @@ class ActivitypubEntityMixin(BaseEntity):
|
||||||
class CleanContentMixin(RawContentMixin):
|
class CleanContentMixin(RawContentMixin):
|
||||||
def post_receive(self) -> None:
|
def post_receive(self) -> None:
|
||||||
"""
|
"""
|
||||||
Make linkified Mastodon tags normal tags.
|
Make linkified tags normal tags.
|
||||||
"""
|
"""
|
||||||
def cleaner(match):
|
def cleaner(match):
|
||||||
return f"#{match.groups()[0]}"
|
return f"#{match.groups()[0]}"
|
||||||
|
|
||||||
self.raw_content = re.sub(
|
self.raw_content = re.sub(
|
||||||
r'<a href=\"[^\"]*\" class=\"mention hashtag\" rel=\"tag\">#<span>([a-zA-Z0-9-_]+)</span></a>',
|
r'\[#([\w\-_]+)\]\(http?s://.+\)',
|
||||||
cleaner,
|
cleaner,
|
||||||
self.raw_content,
|
self.raw_content,
|
||||||
re.MULTILINE,
|
re.MULTILINE,
|
||||||
|
|
Ładowanie…
Reference in New Issue