Repository navigation
Leave sentence punctuation out of bracketed citation links - #104
Open
MaxWang007 wants to merge 1 commit into
Open
MaxWang007 wants to merge 1 commit into
MaxWang007 wants to merge 1 commit into
Conversation
PageText trimmed trailing punctuation once, then removed an unmatched closing bracket. When a source URL sat at the end of a bracketed phrase, the period or comma left behind stayed in the href. (See https://example.com/pricing.) linked to https://example.com/pricing. and [See https://example.org/plans,] linked to https://example.org/plans,. Trim again after peeling unmatched closers, and repeat until the suffix stops changing. Balanced parentheses in a URL, such as Project_(software), and a period that already sits outside the brackets stay as they were.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #102
What was wrong
On a saved research page, a source URL at the end of a bracketed phrase kept the sentence punctuation in its link destination. The paragraph text was already right.
(See https://example.com/pricing.)https://example.com/pricinghttps://example.com/pricing.[See https://example.org/plans,]https://example.org/planshttps://example.org/plans,PageTexttrimmed trailing punctuation once, then removed an unmatched closing bracket. The period or comma sat just inside that bracket, so once the bracket was peeled off it ended up back on the URL.The fix
Trim again after unmatched closers are peeled, and repeat until the suffix stops changing. Balanced parentheses inside a URL stay, including Wikipedia-style
Project_(software), and the existing control(https://example.org/plans).still links tohttps://example.org/plans.PageTextrenders page text, headings and slide text, so all three pick this up.Testing
bun test app/tests/pages.test.tsxhttps://example.com/pricing.andhttps://example.org/plans,.bunx biome checkon the changed files andbun run typecheckinopenbot/appboth pass.