Skip to content

Support 'and' as a Bible verse list delimiter#72

Open
cguldner wants to merge 1 commit intomasterfrom
codex/add-support-for-and-in-verse-delimiter
Open

Support 'and' as a Bible verse list delimiter#72
cguldner wants to merge 1 commit intomasterfrom
codex/add-support-for-and-in-verse-delimiter

Conversation

@cguldner
Copy link
Owner

@cguldner cguldner commented Mar 4, 2026

Motivation

  • Users often write verse lists using the word and (case-insensitive) as the final delimiter, so the parser should recognize it and preserve the original text when converting references to links.
  • The change aims to be clean and modular by centralizing the delimiter logic and reusing it for both parsing and link rendering.

Description

  • Introduced a centralized delimiter regex and parser in js/verseParser.mjs by adding VERSE_LIST_DELIMITER_REG and updating splitVerseListString to recognize and and preserve delimiters.
  • Refactored regex construction in js/biblePreviewer.js into a buildBibleRegex() helper and extended list continuation matching to include and, and updated the reference rendering to use splitVerseListString so original delimiters (commas, semicolons, and and) are preserved.
  • Added unit tests in js/verseParser.test.mjs for and and mixed delimiter cases to validate parsing behavior.
  • Added Cypress fixture and E2E assertions (cypress/test.html and cypress/e2e/link_creation.cy.js) to cover and-separated same-book lists, chapter-context carryover, and delimiter-preservation.

Testing

  • Ran unit tests with npm test, and all tests passed successfully.
  • Ran linter with npm run lint, which completed without errors.
  • Attempted npm run cypress:run, but Cypress failed in this environment due to a missing system dependency (Xvfb), so E2E tests could not be executed here; the new Cypress tests are included and will run in a CI or developer environment with required GUI dependencies installed.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant