Add comprehensive book abbreviation support

Add extensive abbreviation mappings to normalize_book_name function
to handle common Bible book abbreviations. URLs like /book/Gen/...
will now automatically redirect to /book/Genesis/...

Supports all standard abbreviations including:
- Gen, Ge for Genesis
- Ex, Exo for Exodus
- Mt, Mat for Matthew
- And many more...

This improves URL flexibility and user experience when typing
abbreviated book names directly in the address bar.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-24 12:23:09 -05:00
parent 947e275a91
commit 0dc7c94cdc
+149
View File
@@ -87,6 +87,155 @@ def normalize_book_name(book: str) -> Optional[str]:
# Alternative names
"Song of Songs": "Song of Solomon",
"Canticles": "Song of Solomon",
# Common abbreviations
"Gen": "Genesis",
"Ge": "Genesis",
"Exo": "Exodus",
"Ex": "Exodus",
"Lev": "Leviticus",
"Le": "Leviticus",
"Num": "Numbers",
"Nu": "Numbers",
"Deut": "Deuteronomy",
"Dt": "Deuteronomy",
"Josh": "Joshua",
"Jos": "Joshua",
"Judg": "Judges",
"Jdg": "Judges",
"Ru": "Ruth",
"1Sam": "1 Samuel",
"1 Sam": "1 Samuel",
"1S": "1 Samuel",
"2Sam": "2 Samuel",
"2 Sam": "2 Samuel",
"2S": "2 Samuel",
"1Ki": "1 Kings",
"1 Ki": "1 Kings",
"1K": "1 Kings",
"2Ki": "2 Kings",
"2 Ki": "2 Kings",
"2K": "2 Kings",
"1Chr": "1 Chronicles",
"1 Chr": "1 Chronicles",
"1Ch": "1 Chronicles",
"2Chr": "2 Chronicles",
"2 Chr": "2 Chronicles",
"2Ch": "2 Chronicles",
"Ezr": "Ezra",
"Neh": "Nehemiah",
"Ne": "Nehemiah",
"Est": "Esther",
"Ps": "Psalms",
"Psa": "Psalms",
"Prov": "Proverbs",
"Pr": "Proverbs",
"Eccl": "Ecclesiastes",
"Ec": "Ecclesiastes",
"Song": "Song of Solomon",
"Sos": "Song of Solomon",
"SS": "Song of Solomon",
"Isa": "Isaiah",
"Is": "Isaiah",
"Jer": "Jeremiah",
"Je": "Jeremiah",
"Lam": "Lamentations",
"La": "Lamentations",
"Ezek": "Ezekiel",
"Eze": "Ezekiel",
"Ezk": "Ezekiel",
"Dan": "Daniel",
"Da": "Daniel",
"Hos": "Hosea",
"Ho": "Hosea",
"Joe": "Joel",
"Jl": "Joel",
"Am": "Amos",
"Ob": "Obadiah",
"Jon": "Jonah",
"Mic": "Micah",
"Mi": "Micah",
"Nah": "Nahum",
"Na": "Nahum",
"Hab": "Habakkuk",
"Hb": "Habakkuk",
"Zep": "Zephaniah",
"Zph": "Zephaniah",
"Hag": "Haggai",
"Hg": "Haggai",
"Zech": "Zechariah",
"Zec": "Zechariah",
"Zch": "Zechariah",
"Mal": "Malachi",
"Mat": "Matthew",
"Mt": "Matthew",
"Mar": "Mark",
"Mk": "Mark",
"Mrk": "Mark",
"Luk": "Luke",
"Lk": "Luke",
"Joh": "John",
"Jn": "John",
"Act": "Acts",
"Ac": "Acts",
"Rom": "Romans",
"Ro": "Romans",
"1Cor": "1 Corinthians",
"1 Cor": "1 Corinthians",
"1Co": "1 Corinthians",
"2Cor": "2 Corinthians",
"2 Cor": "2 Corinthians",
"2Co": "2 Corinthians",
"Gal": "Galatians",
"Ga": "Galatians",
"Eph": "Ephesians",
"Ep": "Ephesians",
"Phil": "Philippians",
"Php": "Philippians",
"Ph": "Philippians",
"Col": "Colossians",
"Co": "Colossians",
"1Thess": "1 Thessalonians",
"1 Thess": "1 Thessalonians",
"1Th": "1 Thessalonians",
"2Thess": "2 Thessalonians",
"2 Thess": "2 Thessalonians",
"2Th": "2 Thessalonians",
"1Tim": "1 Timothy",
"1 Tim": "1 Timothy",
"1Ti": "1 Timothy",
"2Tim": "2 Timothy",
"2 Tim": "2 Timothy",
"2Ti": "2 Timothy",
"Tit": "Titus",
"Ti": "Titus",
"Phm": "Philemon",
"Pm": "Philemon",
"Heb": "Hebrews",
"He": "Hebrews",
"Jam": "James",
"Jas": "James",
"Jm": "James",
"1Pet": "1 Peter",
"1 Pet": "1 Peter",
"1Pe": "1 Peter",
"1P": "1 Peter",
"2Pet": "2 Peter",
"2 Pet": "2 Peter",
"2Pe": "2 Peter",
"2P": "2 Peter",
"1Joh": "1 John",
"1 Joh": "1 John",
"1Jn": "1 John",
"2Joh": "2 John",
"2 Joh": "2 John",
"2Jn": "2 John",
"3Joh": "3 John",
"3 Joh": "3 John",
"3Jn": "3 John",
"Jud": "Jude",
"Rev": "Revelation",
"Re": "Revelation",
}
return book_variations.get(book)