Repository navigation
Conversation
STiFLeR7
left a comment
There was a problem hiding this comment.
I ran the same citation cases against this PR and #104 on Windows with Bun 1.4.3. Both passed all six focused tests. The shared comparison failed on main (b32ec10) with five wrong destinations. Both patches preserve the visible paragraph text, and their runtime code is identical.
I recommend merging this PR for #102 because its regression test combines a balanced parenthesis inside the URL with sentence punctuation inside the outer parentheses: (See https://example.com/wiki/Project_(software).). It checks that the same link keeps (software) while dropping the sentence period and unmatched closer. #104 also fixes the reported bug and has a useful control for a period outside the parentheses. One of the two PRs is enough.
|
Thanks for verifying this on Windows with Bun 1.4.3 — really helpful to have the cross-platform check, and the comparison against #104 makes the case for this one clearly. The balanced-parens-inside-URL case was the one I most wanted covered, so glad it holds up there too. |
Fixes #102.
PageText trimmed trailing sentence punctuation once, before removing unmatched closing brackets. When a source URL sat at the end of a parenthetical sentence, the bracket removal exposed punctuation that then became part of the link destination: "(See https://example.com/pricing.)" linked to "https://example.com/pricing." instead of "https://example.com/pricing".
The trim/strip now repeats until the suffix is stable, so punctuation hidden behind an unmatched closer is dropped on the next pass. Balanced parentheses inside a URL (e.g. wiki links) are still preserved, and the visible paragraph text is unchanged — only the href changes.
Test: added "source links drop punctuation left behind by an unmatched closing bracket" to openbot/app/tests/pages.test.tsx, covering the two reported cases plus a balanced-parens URL with a trailing period. Verified the new test fails on pristine code (hrefs came back with the trailing "." and ",") and passes with the fix. Full pages.test.tsx: 47/47 pass. App typecheck and biome format/lint clean.