gjtorikian / html-pipeline

HTML processing filters and utilities
MIT License
2.27k stars 383 forks source link

Possible bug when using both MentionFilter and TeamMentionFilter #412

Closed jeremysmithco closed 3 months ago

jeremysmithco commented 3 months ago

I've been having trouble getting MentionFilter and TeamMentionFilter to both work together. (If only one is used, then it's correct, but when used in combination, it appears that only the second filter will be applied.)

Sorry for just sharing a failing test, but I wanted to demonstrate what I think the issue is. I've spent a few hours today trying to figure it out and I haven't found the root problem yet.

gjtorikian commented 3 months ago

I've spent a few hours today trying to figure it out and I haven't found the root problem yet.

I...haven't found it either. 😆 Granted I chewed on this for about ten minutes. But it seems like the text in the TeamMentionFilter is the original text — as if the second filter is not getting the MentionFiltered text at all.

jeremysmithco commented 3 months ago

But it seems like the text in the TeamMentionFilter is the original text — as if the second filter is not getting the MentionFiltered text at all.

Yeah! That's what I was concluding... I thought it might be IGNORE_PARENTS, but that didn't seem to be it. Then I thought maybe some state was leaking somehow, but I couldn't see what. Then I thought the problem might lie in the call to Selma::Rewriter...but I didn't get down to that level to test.

gjtorikian commented 3 months ago

Yes, it's almost certainly Selma related. I'm looking into it!

gjtorikian commented 3 months ago

This is 100% in Selma. I'd like to keep this PR open as a useful test case for when Selma is updated, but the real work is going on over there.

jeremysmithco commented 3 months ago

Thanks Garen, much appreciated! 🙏 Will watch the progress over there. 😊

gjtorikian commented 3 months ago

selma 0.4.7 has fixed this!

jeremysmithco commented 3 months ago

Awesome, thanks a ton @gjtorikian!