~ihabunek/toot-discuss

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[PATCH] Include server part of username mentions

Details
Message ID
<20240406181040.4187793-1-sandra.snan@idiomdrottning.org>
DKIM signature
pass
Download raw message
Patch: +1 -1
This regex might be a li'l Pleroma specific.
---
I guess that's why I didn't send it before. I like the feature
but I don't think this is the most robust implementation.

 toot/utils/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/toot/utils/__init__.py b/toot/utils/__init__.py
index f21d425..d28ceee 100644
--- a/toot/utils/__init__.py
+++ b/toot/utils/__init__.py
@@ -32,7 +32,7 @@ def parse_html(html: str) -> BeautifulSoup:

def get_text(html: str) -> str:
    """Converts html to text, strips all tags."""
    text = parse_html(html).get_text()
    text = parse_html(re.sub('<span class="h-card".*?mention".*?href="[a-z]+://([^/]+).*?@<span>([^<]+)</span></a></span>', r'@\2@\1', html)).get_text()
    return unicodedata.normalize("NFKC", text)


-- 
2.39.2
Details
Message ID
<7da5a1f2-4f95-4d25-ab89-4c95888299a6@app.fastmail.com>
In-Reply-To
<20240406181040.4187793-1-sandra.snan@idiomdrottning.org> (view parent)
DKIM signature
pass
Download raw message
I should test this one a bit against pleroma/akkoma/etc before applying.

-- Ivan
Details
Message ID
<87bk6kpcy8.fsf@ellen.idiomdrottning.org>
In-Reply-To
<7da5a1f2-4f95-4d25-ab89-4c95888299a6@app.fastmail.com> (view parent)
DKIM signature
pass
Download raw message
My only instance is an Akkoma instance and I've been dogfooding it 
on there since mid February. Works fine there.

"Ivan Habunek" <ivan@habunek.com> writes:

> I should test this one a bit against pleroma/akkoma/etc before applying.
>
> -- Ivan
Details
Message ID
<87jzi4gn2a.fsf@ellen.idiomdrottning.org>
In-Reply-To
<87bk6kpcy8.fsf@ellen.idiomdrottning.org> (view parent)
DKIM signature
pass
Download raw message
I ran into a problem with it today with a post that had this 
Content:

<p><span class=\"h-card\"><a 
href=\"https://idiomdrottning.org/users/Sandra\" class=\"u-url 
mention\">@<span>Sandra</span></a></span> And do you like it? I 
know snac2 had it but I hated it (or the particular 
implementation). <span class=\"h-card\"><a 
href=\"https://mathstodon.xyz/@bremner\" class=\"u-url 
mention\">@<span>bremner</span></a></span></p>

https://social.alexschroeder.ch/@alex/statuses/01J1SB3J7QEFSGVZBK8126YKF0

It just showed:

@bremner@mathstodon.xyz

I'm probably gonna unapply this patch now that I'm using

    toot status --json $1 | jq -r '..|select(.acct?).acct' | mawk 
'!s[$0]++' | grep -v '^Sandra$' | sed 's;^;@;'

to get usernames in my reply script anyway, not having to paste 
them in from the post.
Reply to thread Export thread (mbox)