Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regexes in util_page.js fail to recognize non-standard locators (e.g. *7, 2.1, 4(b), 3:8), so range is treated as single locator #204

Open
dchawisher opened this issue May 26, 2022 · 0 comments

Comments

@dchawisher
Copy link

It is sometimes necessary to cite pages, sections, paragraphs, etc. using a locator like 2.1, 4(b), 3:8 (common shorthand for 'page 3, line 8' when citing transcripts), or '3¶8' (used when citing numbered paragraphs if not all of the document is numbered). When citing ranges of those locators, util_page.js fails to appreciate that they are ranges because they do not match its regexes. Compounding the problem, util_page.js also replaces en dashes with hyphens, so a manual workaround is impossible.

The regex in question is here (similar regexes are used at 35 and 36):

rangerex = /([0-9]*[a-zA-Z]+0*)?([0-9]+[a-z]*)\s*(?:\u2013|-)\s*([0-9]*[a-zA-Z]+0*)?([0-9]+[a-z]*)/;

The following regex should (adapted as appropriate for lines 35 and 36) work without causing problems:

([0-9]*[a-zA-Z]+0*)?([0-9\:\.\§\¶\*]+\(*[a-z]*\)*)\s*(?:\u2013|-)\s*([0-9]*[a-zA-Z]+0*)?([0-9\:\.\§\¶\*]+\(*[a-z]*\)*)

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

No branches or pull requests

1 participant