versiref 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {versiref-0.1.0 → versiref-0.2.0}/PKG-INFO +7 -5
- {versiref-0.1.0 → versiref-0.2.0}/pyproject.toml +6 -7
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/bible_ref.py +78 -1
- versiref-0.2.0/src/versiref/data/book_names/en-douay-rheims_names.json +78 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/versification.py +20 -0
- versiref-0.1.0/.gitignore +0 -11
- versiref-0.1.0/.python-version +0 -1
- versiref-0.1.0/.vscode/settings.json +0 -12
- versiref-0.1.0/CONVENTIONS.MD +0 -4
- versiref-0.1.0/DESIGN.md +0 -88
- versiref-0.1.0/test_all_versions.py +0 -26
- versiref-0.1.0/tests/__init__.py +0 -1
- versiref-0.1.0/tests/test_bible_ref.py +0 -799
- versiref-0.1.0/tests/test_parse_and_format.py +0 -308
- versiref-0.1.0/tests/test_ref_parser.py +0 -353
- versiref-0.1.0/tests/test_style.py +0 -36
- versiref-0.1.0/tests/test_versification.py +0 -96
- versiref-0.1.0/uv.lock +0 -228
- {versiref-0.1.0 → versiref-0.2.0}/LICENSE +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/README.md +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/__init__.py +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/book_names/en-cmos_long.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/book_names/en-cmos_short.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/book_names/en-sbl_abbreviations.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/book_names/en-sbl_names.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/book_names/it-cei_abbreviazioni.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/book_names/it-cei_nomi.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/versifications/eng.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/versifications/lxx.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/versifications/nabre.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/versifications/nova-vulgata.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/versifications/org.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/versifications/rsc.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/versifications/rso.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/data/versifications/vulgata.json +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/py.typed +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/ref_parser.py +0 -0
- {versiref-0.1.0 → versiref-0.2.0}/src/versiref/ref_style.py +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: versiref
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: A package for sophisticated parsing, manipulation, and printing of references to the Bible
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Author-email: "Fr. John Lawrence M. Polis" <emptier-sank-dose@duck.com>
|
|
5
|
+
Author: Fr. John Lawrence M. Polis
|
|
6
|
+
Author-email: Fr. John Lawrence M. Polis <emptier-sank-dose@duck.com>
|
|
8
7
|
License-Expression: MIT
|
|
9
8
|
License-File: LICENSE
|
|
10
9
|
Classifier: Development Status :: 3 - Alpha
|
|
@@ -18,10 +17,13 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
21
|
Classifier: Topic :: Religion
|
|
22
22
|
Classifier: Topic :: Text Processing
|
|
23
|
-
Requires-Python: >=3.9
|
|
24
23
|
Requires-Dist: pyparsing>=3.2.3
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Project-URL: Homepage, https://github.com/fiapps/versiref
|
|
26
|
+
Project-URL: Issues, https://github.com/fiapps/versiref/issues
|
|
25
27
|
Description-Content-Type: text/markdown
|
|
26
28
|
|
|
27
29
|
# VersiRef
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "versiref"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.0"
|
|
4
4
|
description = "A package for sophisticated parsing, manipulation, and printing of references to the Bible"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -18,6 +18,7 @@ classifiers = [
|
|
|
18
18
|
"Programming Language :: Python :: 3.11",
|
|
19
19
|
"Programming Language :: Python :: 3.12",
|
|
20
20
|
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
21
22
|
"Topic :: Religion",
|
|
22
23
|
"Topic :: Text Processing",
|
|
23
24
|
]
|
|
@@ -33,14 +34,12 @@ Homepage = "https://github.com/fiapps/versiref"
|
|
|
33
34
|
Issues = "https://github.com/fiapps/versiref/issues"
|
|
34
35
|
|
|
35
36
|
[build-system]
|
|
36
|
-
requires = ["
|
|
37
|
-
build-backend = "
|
|
37
|
+
requires = ["uv_build>=0.9.28,<0.10.0"]
|
|
38
|
+
build-backend = "uv_build"
|
|
38
39
|
|
|
39
|
-
[tool.
|
|
40
|
+
[tool.uv.build-backend]
|
|
40
41
|
packages = ["src/versiref"]
|
|
41
|
-
|
|
42
|
-
[tool.hatch.build.targets.wheel.sources]
|
|
43
|
-
"data" = "src/versiref/data"
|
|
42
|
+
include = ["src/versiref/data/**"]
|
|
44
43
|
|
|
45
44
|
[tool.mypy]
|
|
46
45
|
strict = true
|
|
@@ -6,7 +6,7 @@ This module provides classes for representing and manipulating Bible references.
|
|
|
6
6
|
from dataclasses import dataclass, field
|
|
7
7
|
from typing import Generator, Optional
|
|
8
8
|
|
|
9
|
-
from versiref.ref_style import RefStyle
|
|
9
|
+
from versiref.ref_style import RefStyle, standard_names
|
|
10
10
|
from versiref.versification import Versification
|
|
11
11
|
|
|
12
12
|
|
|
@@ -98,6 +98,21 @@ class SimpleBibleRef:
|
|
|
98
98
|
ranges: list[VerseRange] = field(default_factory=list)
|
|
99
99
|
original_text: Optional[str] = None
|
|
100
100
|
|
|
101
|
+
def __str__(self) -> str:
|
|
102
|
+
"""Return a string representation of this simple Bible reference.
|
|
103
|
+
|
|
104
|
+
Shows a concise representation using the reference's original text
|
|
105
|
+
or formatted representation.
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
A string representation of this simple Bible reference
|
|
109
|
+
|
|
110
|
+
"""
|
|
111
|
+
ref_part = self.original_text or self.format(
|
|
112
|
+
RefStyle(names=standard_names("en-sbl_abbreviations"))
|
|
113
|
+
)
|
|
114
|
+
return f'SimpleBibleRef("{ref_part}")'
|
|
115
|
+
|
|
101
116
|
@classmethod
|
|
102
117
|
def for_range(
|
|
103
118
|
cls,
|
|
@@ -320,6 +335,23 @@ class BibleRef:
|
|
|
320
335
|
versification: Optional[Versification] = None
|
|
321
336
|
original_text: Optional[str] = None
|
|
322
337
|
|
|
338
|
+
def __str__(self) -> str:
|
|
339
|
+
"""Return a string representation of this Bible reference.
|
|
340
|
+
|
|
341
|
+
Shows a concise representation using the versification identifier if available,
|
|
342
|
+
and the reference's original text or formatted representation.
|
|
343
|
+
|
|
344
|
+
Returns:
|
|
345
|
+
A string representation of this Bible reference
|
|
346
|
+
|
|
347
|
+
"""
|
|
348
|
+
ref_part = self.original_text or self.format(
|
|
349
|
+
RefStyle(names=standard_names("en-sbl_abbreviations"))
|
|
350
|
+
)
|
|
351
|
+
if self.versification is None:
|
|
352
|
+
return f'BibleRef("{ref_part}")'
|
|
353
|
+
return f'BibleRef("{ref_part}", versification={self.versification})'
|
|
354
|
+
|
|
323
355
|
@classmethod
|
|
324
356
|
def for_range(
|
|
325
357
|
cls,
|
|
@@ -394,6 +426,51 @@ class BibleRef:
|
|
|
394
426
|
return False
|
|
395
427
|
return all(ref.is_valid(self.versification) for ref in self.simple_refs)
|
|
396
428
|
|
|
429
|
+
def range_keys(self) -> Generator[tuple[int, int], None, None]:
|
|
430
|
+
"""Yield an integer key range for each verse range in the ref.
|
|
431
|
+
|
|
432
|
+
Book numbers are derived from self.versification, so it cannot be None.
|
|
433
|
+
If any book ID in the simple refs is not included in the versification,
|
|
434
|
+
no ranges for that book are yielded.
|
|
435
|
+
|
|
436
|
+
Verse numbers less than 0 (undefined) are replaced with:
|
|
437
|
+
- 0 for start verses
|
|
438
|
+
- the last verse number for the chapter for end verses
|
|
439
|
+
|
|
440
|
+
Yields:
|
|
441
|
+
(start_key, end_key): integer keys for the start and end of a range in the ref
|
|
442
|
+
Each key has 2 book digits, 3 chapter digits, and 3 verse digits.
|
|
443
|
+
|
|
444
|
+
"""
|
|
445
|
+
if self.versification is None:
|
|
446
|
+
return
|
|
447
|
+
for simple_ref in self.simple_refs:
|
|
448
|
+
if simple_ref.book_id not in self.versification.max_verses:
|
|
449
|
+
continue
|
|
450
|
+
else:
|
|
451
|
+
book_num = (
|
|
452
|
+
list(self.versification.max_verses.keys()).index(simple_ref.book_id)
|
|
453
|
+
+ 1
|
|
454
|
+
)
|
|
455
|
+
for range_ref in simple_ref.range_refs():
|
|
456
|
+
range = range_ref.ranges[0]
|
|
457
|
+
|
|
458
|
+
# Replace undefined start verse with 0
|
|
459
|
+
start_verse = 0 if range.start_verse < 0 else range.start_verse
|
|
460
|
+
|
|
461
|
+
# Replace undefined end verse with last verse of chapter
|
|
462
|
+
end_verse = range.end_verse
|
|
463
|
+
if end_verse < 0:
|
|
464
|
+
end_verse = self.versification.last_verse(
|
|
465
|
+
simple_ref.book_id, range.end_chapter
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
start_key = (
|
|
469
|
+
book_num * 1000000 + range.start_chapter * 1000 + start_verse
|
|
470
|
+
)
|
|
471
|
+
end_key = book_num * 1000000 + range.end_chapter * 1000 + end_verse
|
|
472
|
+
yield (start_key, end_key)
|
|
473
|
+
|
|
397
474
|
def range_refs(self) -> Generator["BibleRef", None, None]:
|
|
398
475
|
"""Yield a new BibleRef for each verse range across all simple refs.
|
|
399
476
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"GEN": "Genesis",
|
|
3
|
+
"EXO": "Exodus",
|
|
4
|
+
"LEV": "Leviticus",
|
|
5
|
+
"NUM": "Numbers",
|
|
6
|
+
"DEU": "Deuteronomy",
|
|
7
|
+
"JOS": "Josue",
|
|
8
|
+
"JDG": "Judges",
|
|
9
|
+
"RUT": "Ruth",
|
|
10
|
+
"1SA": "1 Kings",
|
|
11
|
+
"2SA": "2 Kings",
|
|
12
|
+
"1KI": "3 Kings",
|
|
13
|
+
"2KI": "4 Kings",
|
|
14
|
+
"1CH": "1 Paralipomenon",
|
|
15
|
+
"2CH": "2 Paralipomenon",
|
|
16
|
+
"EZR": "1 Esdras",
|
|
17
|
+
"NEH": "Nehemias",
|
|
18
|
+
"TOB": "Tobias",
|
|
19
|
+
"JDT": "Judith",
|
|
20
|
+
"EST": "Esther",
|
|
21
|
+
"JOB": "Job",
|
|
22
|
+
"PSA": "Psalm",
|
|
23
|
+
"PSAS": "Psalms",
|
|
24
|
+
"PRO": "Proverbs",
|
|
25
|
+
"ECC": "Ecclesiastes",
|
|
26
|
+
"SNG": "Canticle of Canticles",
|
|
27
|
+
"WIS": "Wisdom",
|
|
28
|
+
"SIR": "Ecclesiasticus",
|
|
29
|
+
"ISA": "Isaias",
|
|
30
|
+
"JER": "Jeremias",
|
|
31
|
+
"LAM": "Lamentations",
|
|
32
|
+
"BAR": "Baruch",
|
|
33
|
+
"EZK": "Ezechiel",
|
|
34
|
+
"DAN": "Daniel",
|
|
35
|
+
"HOS": "Osee",
|
|
36
|
+
"JOL": "Joel",
|
|
37
|
+
"AMO": "Amos",
|
|
38
|
+
"OBA": "Abdias",
|
|
39
|
+
"JON": "Jonas",
|
|
40
|
+
"MIC": "Micheas",
|
|
41
|
+
"NAM": "Nahum",
|
|
42
|
+
"HAB": "Habacuc",
|
|
43
|
+
"ZEP": "Sophonias",
|
|
44
|
+
"HAG": "Aggaeus",
|
|
45
|
+
"ZEC": "Zacharias",
|
|
46
|
+
"MAL": "Malachias",
|
|
47
|
+
"1MA": "1 Machabees",
|
|
48
|
+
"2MA": "2 Machabees",
|
|
49
|
+
"MAT": "Matthew",
|
|
50
|
+
"MRK": "Mark",
|
|
51
|
+
"LUK": "Luke",
|
|
52
|
+
"JHN": "John",
|
|
53
|
+
"ACT": "Acts",
|
|
54
|
+
"ROM": "Romans",
|
|
55
|
+
"1CO": "1 Corinthians",
|
|
56
|
+
"2CO": "2 Corinthians",
|
|
57
|
+
"GAL": "Galatians",
|
|
58
|
+
"EPH": "Ephesians",
|
|
59
|
+
"PHP": "Philippians",
|
|
60
|
+
"COL": "Colossians",
|
|
61
|
+
"1TH": "1 Thessalonians",
|
|
62
|
+
"2TH": "2 Thessalonians",
|
|
63
|
+
"1TI": "1 Timothy",
|
|
64
|
+
"2TI": "2 Timothy",
|
|
65
|
+
"TIT": "Titus",
|
|
66
|
+
"PHM": "Philemon",
|
|
67
|
+
"HEB": "Hebrews",
|
|
68
|
+
"JAS": "James",
|
|
69
|
+
"1PE": "1 Peter",
|
|
70
|
+
"2PE": "2 Peter",
|
|
71
|
+
"1JN": "1 John",
|
|
72
|
+
"2JN": "2 John",
|
|
73
|
+
"3JN": "3 John",
|
|
74
|
+
"JUD": "Jude",
|
|
75
|
+
"REV": "Apocalypse",
|
|
76
|
+
"1ES": "3 Esdras",
|
|
77
|
+
"2ES": "4 Esdras"
|
|
78
|
+
}
|
|
@@ -13,11 +13,31 @@ class Versification:
|
|
|
13
13
|
Versifications are defined by JSON data that is loaded from a file when an instance is created.
|
|
14
14
|
The class provides methods to query information about the versification, such as the last verse
|
|
15
15
|
of a given chapter in a given book.
|
|
16
|
+
|
|
17
|
+
Attributes:
|
|
18
|
+
max_verses: last valid verse number for each chapter of each book
|
|
19
|
+
The order of keys defines the book order.
|
|
20
|
+
identifier: optional name for the versification
|
|
21
|
+
|
|
16
22
|
"""
|
|
17
23
|
|
|
18
24
|
max_verses: dict[str, list[int]] = field(default_factory=dict)
|
|
19
25
|
identifier: Optional[str] = None
|
|
20
26
|
|
|
27
|
+
def __str__(self) -> str:
|
|
28
|
+
"""Return a string representation of this versification.
|
|
29
|
+
|
|
30
|
+
If an identifier is set, returns a concise form: Versification.named("identifier")
|
|
31
|
+
Otherwise, returns the default dataclass representation.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
A string representation of this versification
|
|
35
|
+
|
|
36
|
+
"""
|
|
37
|
+
if self.identifier:
|
|
38
|
+
return f'Versification.named("{self.identifier}")'
|
|
39
|
+
return object.__str__(self)
|
|
40
|
+
|
|
21
41
|
@classmethod
|
|
22
42
|
def from_file(
|
|
23
43
|
cls, file_path: str, identifier: Optional[str] = None
|
versiref-0.1.0/.gitignore
DELETED
versiref-0.1.0/.python-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.13
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mypy-type-checker.importStrategy": "fromEnvironment",
|
|
3
|
-
"mypy-type-checker.ignorePatterns": [
|
|
4
|
-
"build/*.py"
|
|
5
|
-
],
|
|
6
|
-
"python.testing.pytestArgs": [
|
|
7
|
-
"tests"
|
|
8
|
-
],
|
|
9
|
-
"python.testing.unittestEnabled": false,
|
|
10
|
-
"python.testing.pytestEnabled": true,
|
|
11
|
-
"ruff.configuration": "pyproject.toml"
|
|
12
|
-
}
|
versiref-0.1.0/CONVENTIONS.MD
DELETED
versiref-0.1.0/DESIGN.md
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# VersiRef Design Document
|
|
2
|
-
|
|
3
|
-
VersiRef is a Python package for sophisticated parsing, manipulation, and printing of references to the Bible.
|
|
4
|
-
|
|
5
|
-
This design document was created prior to the implementation, and so may not fully correspond to it.
|
|
6
|
-
|
|
7
|
-
## SimpleBibleRef
|
|
8
|
-
|
|
9
|
-
An instance of `SimpleBibleRef` represents a sequence of verse ranges within a single book of the Bible.
|
|
10
|
-
These ranges are not necessarily in numeric order because the person who creates the citation may prefer a different order.
|
|
11
|
-
The class is naive in that it doesn't specify its versification (this is something like `datetime`'s naive classes, which don't specify a time zone).
|
|
12
|
-
In the simplest case, it designates a single chapter and verse, such as John 3:16.
|
|
13
|
-
More generally, each range contains a start chapter, start verse, start subverse, end chapter, end verse, and end subverse.
|
|
14
|
-
Each range also has `original_text: Optional[str]`: this is the text from which the range was parsed, if any.
|
|
15
|
-
The class stores a list of such ranges, a book ID, and the `original_text` from which the book ID was parsed.
|
|
16
|
-
Book IDs are the three-letter codes used by Paratext, e.g., "GEN", "1CO", or "JHN".
|
|
17
|
-
The start and end chapter numbers will almost always be the same, but the volume of data is probably not large enough to justify complicating the code by optimizing for that.
|
|
18
|
-
Similarly, subverse divisions (e.g., "a" or "d") will often not be used: when there is none, the subverse will be an empty string.
|
|
19
|
-
We can just store all six values for each range, even in the trivial case where the range is a single verse.
|
|
20
|
-
Chapter and verse numbers are `int`s: on careful consideration, we never need to use strings for either.
|
|
21
|
-
Although some Bible translations use letters for "chapter numbers" (e.g., Greek Esther in Rahlfs and NAB), we don't need to support that explicitly: Paratext's scheme represents these as numbered chapters with a different book name (ESG instead of EST).
|
|
22
|
-
The rare case of verse numbers like "4kk" can be represented as verse 4, subverse "kk": that is how it would parse anyway.
|
|
23
|
-
As a special case, a `SimpleBibleRef` with an empty list of ranges refers to the entire book.
|
|
24
|
-
The constructor takes a book ID and an `original_text`, which defaults to `None`.
|
|
25
|
-
|
|
26
|
-
## BibleRef
|
|
27
|
-
|
|
28
|
-
An instance of `BibleRef` represents a sequence of verse ranges within a one or more books of the Bible.
|
|
29
|
-
It holds an array of `SimpleBibleRef` and the `Versification` they use.
|
|
30
|
-
|
|
31
|
-
## Versification
|
|
32
|
-
|
|
33
|
-
An instance of `Versification` represents a way of dividing the text of the Bible into chapters and verses.
|
|
34
|
-
Versifications are defined by JSON data that is loaded from a file when an instance is created.
|
|
35
|
-
Alternatively, the JSON data could be converted to Python data and stored as constants in code.
|
|
36
|
-
The `last_verse(book, chapter)` method returns the integer number of the last verse of the given chapter of the given book.
|
|
37
|
-
If the book is unknown or the chapter does not exist, it returns -1.
|
|
38
|
-
An initial, trivial implementation will not load a data file and will simply return 99 from `last_verse()` regardless of its arguments.
|
|
39
|
-
Support for mapping verses between versifications can be added at a later stage.
|
|
40
|
-
|
|
41
|
-
For versification data, we can use JSON files from a [UBSCAP GitHub repo](https://github.com/ubsicap/versification_json).
|
|
42
|
-
These are under an MIT license.
|
|
43
|
-
As the README notes, some of the files contain errors: there are mappings from verses that do not exist according to the max verse counts.
|
|
44
|
-
However, it seems the best starting point available, and those known errors will be harmless because such mappings will never be applied.
|
|
45
|
-
There's a JSON schema in the repo that can be used for validation.
|
|
46
|
-
The `maxVerses` property of the top-level object contains the data `last_verse()` must return.
|
|
47
|
-
|
|
48
|
-
The JSON files have data for Paratext's seven standard versifications.
|
|
49
|
-
Mappings are defined relative to the mapping called "Original" (`org.json`) for lack of a better name: This uses the BHS OT, the UBS GNT NT, and the "Catholic" deuterocanon.
|
|
50
|
-
|
|
51
|
-
It would not be hard to derive `maxVerses` and `excludedVerses` data for specific Bibles from verse lists exported from Accordance.
|
|
52
|
-
Mappings for these Bibles are an open question.
|
|
53
|
-
|
|
54
|
-
### Mapping verses between versifications
|
|
55
|
-
|
|
56
|
-
This would have to be done one range at a time, mapping the start and end of each.
|
|
57
|
-
When mapping a range start, if the location maps to a range, we pick the start of the range.
|
|
58
|
-
When mapping a range end, if the location maps to a range, we pick the end of the range.
|
|
59
|
-
For example, if 1KI 18:33 maps to 1KI 18:33-34 and we are mapping a range that starts at 1KI 18:33, then the mapped range starts at 1KI 18:33.
|
|
60
|
-
But if we are mapping a range that ends at 1KI 18:33, then the mapped range ends at 1KI 18:34.
|
|
61
|
-
However, we might not at first need code to handle the case where a location maps to a range, since it seems Paratext doesn't handle that. Consequently, its files don't define such mappings, even though there are cases in which they ought to be used.
|
|
62
|
-
|
|
63
|
-
## Style
|
|
64
|
-
|
|
65
|
-
A `Style` defines how a `SimpleBibleRef` or `BibleRef` is converted to a string and how strings are parsed to produce these classes.
|
|
66
|
-
|
|
67
|
-
* `names`: maps Bible book IDs to string abbreviations or to full names, depending on the style.
|
|
68
|
-
* `chapter_verse_separator`: Separates chapter number from verse ranges Defaults to ":".
|
|
69
|
-
* `verse_range_separator`: Separates ranges of verses in a single chapter. Defaults to ", ".
|
|
70
|
-
* `chapter_separator`: Defaults to "; ".
|
|
71
|
-
* `recognized_names`: maps abbreviations and/or full names to Bible book IDs. For flexibility in parsing, this typically recognizes additional abbreviations beyond those used in `names`. It defaults to the inverse of `names`.
|
|
72
|
-
|
|
73
|
-
### Named sets of book names/abbreviations
|
|
74
|
-
|
|
75
|
-
We need to have a way of supplying named sets of book names and book name abbreviations, so users can select, e.g., short SBL abbreviations.
|
|
76
|
-
These sets are simply dictionaries, but perhaps we need to store them in files or allow users to define their own set of abbreviations in a file.
|
|
77
|
-
|
|
78
|
-
### Bible IDs that require special handling
|
|
79
|
-
|
|
80
|
-
* PSA: we need to allow for both a singular and a plural form. The latter can be coded in abbreviation lists as PSAS, e.g., `"PSA": "Psalm", "PSAS": "Psalms"
|
|
81
|
-
* PS2: this is Psalm 151. It uses the PSA abbreviation (or PSAS when referenced with other psalms). Any abbreviation defined for PS2 will be ignored. Perhaps we should issue a warning if it's defined.
|
|
82
|
-
* ESG: this is Greek portions of Esther. Special handling may be required when it uses the same name as EST but letters for chapters (e.g., NABRE).
|
|
83
|
-
|
|
84
|
-
## RefParser
|
|
85
|
-
|
|
86
|
-
The constructor takes a `Style` and builds a PEG parser that recognizes Bible references in that style.
|
|
87
|
-
Whitespace is generally ignored by the parser (default for `pyparser`).
|
|
88
|
-
Various methods support parsing a whole string to a `SimpleBibleRef` or `BibleRef`, scanning a long string for references, and transforming a long string (e.g., to tag references).
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"""Run tests across all supported Python versions using uv."""
|
|
2
|
-
|
|
3
|
-
import subprocess
|
|
4
|
-
|
|
5
|
-
versions = ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
6
|
-
|
|
7
|
-
for version in versions:
|
|
8
|
-
print(f"\n=== Testing Python {version} ===")
|
|
9
|
-
try:
|
|
10
|
-
subprocess.run(
|
|
11
|
-
[
|
|
12
|
-
"uv",
|
|
13
|
-
"run",
|
|
14
|
-
"--isolated",
|
|
15
|
-
"--python",
|
|
16
|
-
version,
|
|
17
|
-
"python",
|
|
18
|
-
"-m",
|
|
19
|
-
"pytest",
|
|
20
|
-
"tests",
|
|
21
|
-
],
|
|
22
|
-
check=True,
|
|
23
|
-
)
|
|
24
|
-
print(f"✅ Python {version}: PASSED")
|
|
25
|
-
except subprocess.CalledProcessError:
|
|
26
|
-
print(f"❌ Python {version}: FAILED")
|
versiref-0.1.0/tests/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"""Test versiref with pytest."""
|