Skip to content

Commit

Permalink
Fix an issue that prevented parsing JST references correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelbradshaw committed Nov 18, 2024
1 parent 5336135 commit 4091210
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/scripturelookup/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def parse_references_string(input_string, lang = 'en', sort_by = None):

# Normalize whitespace-separated references. Example: "Genesis 1:2 1 Nephi 3:7" –> "; Genesis 1:2 ; 1 Nephi 3:7"
scripture_book_names_pattern = '|'.join([re.escape(sbn) for sbn in scripture_book_names_without_commas])
input_string = re.sub(rf'\b({scripture_book_names_pattern})', r'; \1', input_string, flags=re.IGNORECASE)
input_string = re.sub(rf'(?:^|[^\-])\b({scripture_book_names_pattern})', r'; \1', input_string, flags=re.IGNORECASE)

# Normalize lists and ranges. Example: "Genesis 12:1, 2, and 3; verses 1 and 4; John 2 through 7" –> "Genesis 12:1, 2,,3; verses 1,4; John 2–7"
input_string = re.sub(r'\s+(?:and|y|e|et|&)\s+(\d+)', r',\1', input_string)
Expand Down

0 comments on commit 4091210

Please sign in to comment.