Commit graph

15 commits

Author SHA1 Message Date
Andrew Godwin
a6922cb9d6 Move to a new HTML parser/stripper
This removes the use of the EOL'd Bleach, and also integrates hashtag,
mention and emoji searching into one single place.
2023-01-29 17:47:06 -07:00
Michael Manfre
cc75863b8f
Fixes #431 - Preserve href when stripping <a> tags (#436) 2023-01-17 23:41:33 -07:00
Michael Manfre
9b6ceee490
Apply Mastodon style link text shortening (#426) 2023-01-16 11:59:46 -07:00
Corry Haines
cfe18932b8
Match sanitizing for posts to Mastodon (#422)
Creates filter for REWRITTEN_TAGS that converts them to `p` rather than ripping them out entirely, and formats `ul` as break-separated list

Both changes align sanitization to Mastodon's "strict" sanitizer at https://github.com/mastodon/mastodon/blob/main/lib/sanitize_ext/sanitize_config.rb#L73

I don't love the complexity of the Filter, but Bleach doesn't give us great options to work with. The code operates within an iterator without the useful "sibling" methods that Ruby's equivalent has. Also, Bleach runs filters _after_ sanitizing (unlike Ruby's which runs before) so we have to pass all the elements through the sanitizer, then rewrite them after the fact.
2023-01-15 22:32:04 -07:00
Michael Manfre
50c07f491e
Guard Post mentions processing from unfetched Identities (#272) 2022-12-25 14:37:31 -07:00
Michael Manfre
ab398758a9
Fixed mention linking with mixed case usernames (#265) 2022-12-24 21:04:25 -07:00
Andrew Godwin
025fd5cf07 Emoji refactor
Emojis are now prefetched from the post, and if not, looked up
individually by shortcode, to prevent loading hundreds.
2022-12-22 16:55:31 +00:00
Andrew Godwin
51d34eda9c Significantly better hashtag link parsing
Fixes #203
2022-12-20 13:55:14 +00:00
Andrew Godwin
78d2283458 Move linkifying to all http-prefixed links 2022-12-20 13:21:50 +00:00
Andrew Godwin
4ad4f468a4 Refactor HTML rendering into one place
Also suppress using external <a> tags for now, until we can separate
them from hashtags properly.
2022-12-20 11:39:45 +00:00
Andrew Godwin
770aa1531a Do actual ISO date parsing
Fixes #187
2022-12-18 10:45:32 -07:00
Andrew Godwin
8835fdee6b Explicitly ignore add and remove messages for now 2022-12-04 07:36:38 -07:00
Andrew Godwin
fb342cfb54 Fix hashtagging of HTML entities 2022-11-28 22:34:14 -07:00
Andrew Godwin
8e9e3ecf69 Some cleanup around editing 2022-11-27 12:09:08 -07:00
Andrew Godwin
0d1e09fbcd Refactor almost all tests into /tests/ 2022-11-21 20:10:01 -07:00