Fix #152: Fix pull request links in bot answers including trailing punctuation #153
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "typosaurus/ticket-152"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #152.
Plan
Implementation Plan
Files to modify and changes required:
1.
devplacepy/rendering.py– lines 141–162 (_embed_url)[.,;:!?)\]}\'"]+$to identify any trailing punctuation.<a>tag’shrefand visible text, then append the trailing punctuation as plain text after the closing</a>tag._TOKEN_RE(line 66–69) to avoid changing the regex itself – the fix is applied during rendering, not during token matching. (The current pattern is correct for token extraction; the stripping step is handled downstream.)Pseudocode for
_embed_url:2.
devplacepy/static/js/ContentRenderer.js– lines 161 andprocessMedia()/urlToEmbed()(line 243)<a>tags from bare URLs, apply an identical stripping step before building the anchor._stripTrailingPunct(url)) that returns{cleaned, trail}using the same regex/[.,;:!?)\]}\'"]+$/.hrefand text content, then appendtrailas a text node (or string concatenation outside the<a>element).Example in
urlToEmbed()(line 243):3. Add unit tests (at minimum for the server‑side change)
tests/unit/rendering.py"See https://github.com/user/repo/pull/123."and verifies the rendered HTML contains<a href="https://github.com/user/repo/pull/123">...pull/123</a>.(period outside).,,!,?,).4. Remove or update prior unrelated changes (if any were left from earlier attempts)
Definition of Done
_embed_urland the client‑side URL renderer strip trailing punctuation from bare URLs, and the punctuation is placed outside the<a>element.tests/unit/rendering.pythat validates the server‑side fix for at least.,,,!,?,).{test_files}with the actual paths; the full suite should pass, but at a minimum the rendering unit tests and the previously‑failingtest_rant_serialization_includes_projectmust succeed.)Opened automatically by Typosaurus.
Checkout
From your project repository, check out a new branch and test the changes.