Files
kjvstudy.org/kjvstudy_org/static/og-cache/99aab73b8cccb81bf5aa3b6f73cb7b96.png
kennethreitzandClaude Opus 4.8 d7047b54fa DRY: consolidate backend helpers (Commit A of DRY cleanup)
Remove duplicated logic across the backend, keeping all imports at module top:

- get_books(): 5 identical route-local copies -> one helper in utils/helpers.py
- create_slug(): data/__init__._create_slug was byte-identical to
  helpers.create_slug; route data + api.py now share the one helper
- normalize_strongs(): 4 copies of Strong's leading-zero normalization unified
  into strongs.py; fixes a latent bug where /search?q=H0001 (web) emitted an
  un-normalized /strongs/H0001 redirect instead of /strongs/H1
- highlight_terms(): the two search highlighters (search.py, search_index.py)
  now share one implementation; fixes lowercase <mark> output on the FTS path
- parse_reference_parts(): one canonical "Book Chapter:Verse[-end]" parser in
  kjv.py (next to VerseReference), replacing ad-hoc parsing in cross_references
  and topics; cross_references.parse_reference is now a thin wrapper
- get_adjacent_stories(): prev/next story nav extracted from two route handlers
- build_interlinear_rows(): interlinear row builder extracted in bible.py

Adds TestNormalizeStrongs unit tests. 941 passed, 3 skipped; data validation clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 01:24:20 -04:00

25 KiB
1200x630px