fix: don't link hyphen-only numeric ranges as verse references - #3293
Open
mahmoodhamdi wants to merge 1 commit into
Open
fix: don't link hyphen-only numeric ranges as verse references#3293mahmoodhamdi wants to merge 1 commit into
mahmoodhamdi wants to merge 1 commit into
Conversation
The verse-reference regex used by FootnoteText accepted either ":" or "-" as the chapter:verse separator, so an isolated range like "(7-10)" in a translation footnote was rewritten to /7-10 and routed to Surah 7 even when the surrounding text referenced a different Surah. Restrict the chapter:verse separator to ":" so only conventional references (1:1, 1:1-3, 1:1-2:3) become links. Bare hyphen-separated numbers are left as plain text. Closes quran#3267
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.
Summary
Closes: #3267
The verse-reference regex used by
formatVerseReferencesToLinks(called fromFootnoteText) accepted either:or-as the chapter:verse separator. Asa result, an isolated range like
(7-10)inside a translation footnote wasrewritten to
/7-10and routed to Surah 7 — even when the surrounding textreferenced a different Surah (the original report was Hindi Surah Al-Mulk 67:5
referencing As-Saffat 37:7-10).
Tightens the regex to require
:between chapter and verse so onlyconventional references become links:
1:1,1:1-3,1:1-2:3. Barehyphen-separated numbers are left as plain text.
Type of Change
Scope Confirmation
Test Plan
for
1-1.(
See Surah As-Saffat, verses (7-10) for context).yarn test— 935 / 935 tests pass.yarn linton the two changed files — clean.Manual reproduction (before fix):
(7-10)hyperlink — currently routes to/7-10(Surah 7).After the fix, the
(7-10)text remains plain (not linked), so the footnoteno longer misroutes.
Rollback Safety