Skip to content

PageText: drop sentence punctuation left behind by an unmatched closing bracket (#102) - #108

Open
dhruv1220 wants to merge 1 commit into
CopilotKit:mainfrom
dhruv1220:fix/page-text-punctuation-behind-bracket-102
Open

dhruv1220 wants to merge 1 commit into
CopilotKit:mainfrom
dhruv1220:fix/page-text-punctuation-behind-bracket-102

Conversation

@dhruv1220

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Saved research citations include punctuation inside closing brackets

1 participant