fix(core/render-biblio): sanitize spaces in reference IDs#5177
fix(core/render-biblio): sanitize spaces in reference IDs#5177marcoscaceres merged 8 commits intomainfrom
Conversation
Reference names with spaces (e.g. 'Ruby TTS Req') produced invalid HTML IDs containing spaces. Consolidates all bib- ID generation through a bibRefId() helper that replaces whitespace with hyphens.
There was a problem hiding this comment.
Pull request overview
Fixes invalid HTML id generation for bibliography entries when reference keys contain whitespace by centralizing bib fragment/id creation in a helper that replaces whitespace with hyphens.
Changes:
- Add
bibRefId(ref)helper to generatebib-...IDs with whitespace normalized to-. - Update inline citation rendering to link to
#${bibRefId(key)}. - Update reference list rendering and alias/warn selectors to use the same normalized bib IDs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hmmm... definitely need a test for this one. The examples are wild: As I never expected ids from bib-ref to be used this way (they follow the short name rules from w3c)... but sure, why not! |
|
@copilot can you add tests. See my comment above? |
Agent-Logs-Url: https://github.com/speced/respec/sessions/34120c5e-5936-4162-b83b-9482ad705d59 Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Tests added in a077412. The new
Done in commit a077412 — added a regression test using the "Ruby TTS Req" and "Tokyo Ghoul: re" examples. |
…sanitization Agent-Logs-Url: https://github.com/speced/respec/sessions/8d7688e3-f620-40d2-87bd-e2851412f88b Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Agent-Logs-Url: https://github.com/speced/respec/sessions/2ea95651-690e-47f4-9566-f25caed403e1 Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Tests were added (a077412) and the sanitization was subsequently broadened (bc35789) to use the existing
Done in a077412 (regression tests for spaces) and updated in bc35789 (broader sanitization via |
|
@copilot wonderful! But I’m worried toId is to generic a name (and it looks like told)… maybe call it toSafeHTMLId() or something better? |
sidvishnoi
left a comment
There was a problem hiding this comment.
GitHub asking for review even when I just did, so,
again.
Reference names with spaces (e.g. 'Ruby TTS Req') produced invalid HTML IDs containing spaces. Consolidates all bib- ID generation through a bibRefId() helper that replaces whitespace with hyphens.
Closes #5102