scripturelookup 0.0.6__tar.gz → 0.0.7__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.
- {scripturelookup-0.0.6/src/scripturelookup.egg-info → scripturelookup-0.0.7}/PKG-INFO +2 -1
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/README.md +1 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup/command_line.py +2 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup/lookup.py +31 -19
- {scripturelookup-0.0.6 → scripturelookup-0.0.7/src/scripturelookup.egg-info}/PKG-INFO +2 -1
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/.github/workflows/publish.yml +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/.gitignore +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/LICENSE +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/pyproject.toml +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/requirements.txt +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/setup.cfg +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/geezify-python-main/LICENSE +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/geezify-python-main/README.md +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/geezify-python-main/arabify.py +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/geezify-python-main/arabify_test.py +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/geezify-python-main/geezify.py +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/geezify-python-main/geezify_test.py +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/geezify-python-main/test_data.py +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup/__init__.py +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup/data/metadata-languages.min.json +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup/data/metadata-scriptures.min.json +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup/data.py +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup/numbers.py +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup.egg-info/SOURCES.txt +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup.egg-info/dependency_links.txt +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup.egg-info/entry_points.txt +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup.egg-info/requires.txt +0 -0
- {scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scripturelookup
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Summary: Python and command-line utility for converting scripture references between formats.
|
|
5
5
|
Author-email: Samuel Bradshaw <samuel.h.bradshaw@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -161,6 +161,7 @@ Several options are available. Some are only applicable to certain commands.
|
|
|
161
161
|
- **skip_book_name** (optional) – Whether book names should be skipped on labels. Default: False.
|
|
162
162
|
- **abbreviated** (optional) – Whether book abbrevions should be used on labels. Default: False.
|
|
163
163
|
- **skip_cleanup** (optional) – Whether cleanup of the input string should be skipped when parsing. Can be used to speed up parsing if the input string is guaranteed to have well-formed references. Default: False.
|
|
164
|
+
- **range_split_limit** (optional) – Threshold where a range of sequential verses will be split into separate verse groups. Default: 1.
|
|
164
165
|
|
|
165
166
|
|
|
166
167
|
## Acknowledgements
|
|
@@ -121,6 +121,7 @@ Several options are available. Some are only applicable to certain commands.
|
|
|
121
121
|
- **skip_book_name** (optional) – Whether book names should be skipped on labels. Default: False.
|
|
122
122
|
- **abbreviated** (optional) – Whether book abbrevions should be used on labels. Default: False.
|
|
123
123
|
- **skip_cleanup** (optional) – Whether cleanup of the input string should be skipped when parsing. Can be used to speed up parsing if the input string is guaranteed to have well-formed references. Default: False.
|
|
124
|
+
- **range_split_limit** (optional) – Threshold where a range of sequential verses will be split into separate verse groups. Default: 1.
|
|
124
125
|
|
|
125
126
|
|
|
126
127
|
## Acknowledgements
|
|
@@ -20,6 +20,7 @@ def main_cli():
|
|
|
20
20
|
parser.add_argument('--skip_book_name', action='store_true', help='Skip scripture book name in labels.')
|
|
21
21
|
parser.add_argument('--abbreviated', action='store_true', help='Prefer abbreviated scripture book name in labels.')
|
|
22
22
|
parser.add_argument('--skip_cleanup', action='store_true', help='Skip cleanup of the input string for faster parsing.')
|
|
23
|
+
parser.add_argument('--range_split_limit', type=int, help='Threshold where a range of sequential verses will be split into separate verse groups. Default: 1.')
|
|
23
24
|
|
|
24
25
|
args = parser.parse_args()
|
|
25
26
|
|
|
@@ -38,6 +39,7 @@ def main_cli():
|
|
|
38
39
|
skip_book_name = args.skip_book_name,
|
|
39
40
|
abbreviated = args.abbreviated,
|
|
40
41
|
skip_cleanup = args.skip_cleanup,
|
|
42
|
+
range_split_limit = args.range_split_limit or 1,
|
|
41
43
|
)
|
|
42
44
|
|
|
43
45
|
print(result)
|
|
@@ -167,7 +167,7 @@ class Reference:
|
|
|
167
167
|
|
|
168
168
|
# Parse verses into verse groups
|
|
169
169
|
# Example: '1-2,5-7,9' –> [[1, 2], [5, 6, 7], [9]]
|
|
170
|
-
def parse_verses_string(verses_string, lang = 'en'):
|
|
170
|
+
def parse_verses_string(verses_string, lang = 'en', range_split_limit = 1):
|
|
171
171
|
verses_string = (verses_string or '').replace('p', '').strip()
|
|
172
172
|
if not verses_string:
|
|
173
173
|
return None
|
|
@@ -217,7 +217,19 @@ def parse_verses_string(verses_string, lang = 'en'):
|
|
|
217
217
|
else:
|
|
218
218
|
verse_groups.append([verse])
|
|
219
219
|
previous_verse = -1
|
|
220
|
-
|
|
220
|
+
|
|
221
|
+
# Split ranges at range split limit. Examples:
|
|
222
|
+
# [[2], [2, 3, 4], [2, 3]], limit 1 –> [[2], [2, 3, 4], [2, 3]]
|
|
223
|
+
# [[2], [2, 3, 4], [2, 3]], limit 2 –> [[2], [2, 3, 4], [2], [3]]
|
|
224
|
+
# [[2], [2, 3, 4], [2, 3]], limit 3 –> [[2], [2], [3], [4], [2], [3]]
|
|
225
|
+
refined_verse_groups = []
|
|
226
|
+
for group in verse_groups:
|
|
227
|
+
if len(group) <= range_split_limit:
|
|
228
|
+
refined_verse_groups.extend([v] for v in group)
|
|
229
|
+
else:
|
|
230
|
+
refined_verse_groups.append(group)
|
|
231
|
+
|
|
232
|
+
return refined_verse_groups
|
|
221
233
|
|
|
222
234
|
|
|
223
235
|
# Format verse groups to a localized string
|
|
@@ -235,7 +247,7 @@ def convert_verse_groups_to_string(verse_groups, verse_range_separator, verse_gr
|
|
|
235
247
|
|
|
236
248
|
# Parse one or more scripture references, URIs, URLs, or slugs
|
|
237
249
|
# The script will run faster if skip_cleanup is True, but all scripture references or URIs will be expected to have consistent formatting
|
|
238
|
-
def parse_references_string(input_string, lang = 'en', sort_by = None, skip_cleanup = False):
|
|
250
|
+
def parse_references_string(input_string, lang = 'en', sort_by = None, skip_cleanup = False, range_split_limit = 1):
|
|
239
251
|
lang = data.get_bcp47(lang)
|
|
240
252
|
|
|
241
253
|
# Remove leading or trailing whitespace and punctuation
|
|
@@ -382,8 +394,8 @@ def parse_references_string(input_string, lang = 'en', sort_by = None, skip_clea
|
|
|
382
394
|
chapter_string = chapter_match.group(1)
|
|
383
395
|
book_string = book_string.removesuffix(chapter_string).strip()
|
|
384
396
|
|
|
385
|
-
verse_groups = parse_verses_string(verses_string)
|
|
386
|
-
context_verse_groups = parse_verses_string(context_verses_string)
|
|
397
|
+
verse_groups = parse_verses_string(verses_string, range_split_limit = range_split_limit)
|
|
398
|
+
context_verse_groups = parse_verses_string(context_verses_string, range_split_limit = range_split_limit)
|
|
387
399
|
chapter = numbers.convert_number_to_int(chapter_string)
|
|
388
400
|
book_slug = None
|
|
389
401
|
skip_book_name = False
|
|
@@ -436,31 +448,31 @@ def parse_references_string(input_string, lang = 'en', sort_by = None, skip_clea
|
|
|
436
448
|
|
|
437
449
|
# Functions that can be called via Python or from the command line (see README.md for more information)
|
|
438
450
|
|
|
439
|
-
def get_content(input_string, lang = 'en', separator = '\n', source = 'python-scripture-scraper', skip_cleanup = False, **kwargs):
|
|
440
|
-
references = parse_references_string(input_string, lang = lang, skip_cleanup = skip_cleanup)
|
|
451
|
+
def get_content(input_string, lang = 'en', separator = '\n', source = 'python-scripture-scraper', skip_cleanup = False, range_split_limit = 1, **kwargs):
|
|
452
|
+
references = parse_references_string(input_string, lang = lang, skip_cleanup = skip_cleanup, range_split_limit = range_split_limit)
|
|
441
453
|
return separator.join([ref.content(source = source) for ref in references])
|
|
442
454
|
|
|
443
|
-
def get_label(input_string, lang = 'en', separator = '\n', sort_by = None, skip_book_name = False, abbreviated = False, skip_cleanup = False, **kwargs):
|
|
444
|
-
references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup)
|
|
455
|
+
def get_label(input_string, lang = 'en', separator = '\n', sort_by = None, skip_book_name = False, abbreviated = False, skip_cleanup = False, range_split_limit = 1, **kwargs):
|
|
456
|
+
references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup, range_split_limit = range_split_limit)
|
|
445
457
|
return separator.join([ref.label(skip_book_name = skip_book_name, abbreviated = abbreviated) for ref in references])
|
|
446
458
|
|
|
447
|
-
def get_church_uri(input_string, separator = '\n', sort_by = None, use_query_parameters = False, skip_cleanup = False, **kwargs):
|
|
448
|
-
references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup)
|
|
459
|
+
def get_church_uri(input_string, separator = '\n', sort_by = None, use_query_parameters = False, skip_cleanup = False, range_split_limit = 1, **kwargs):
|
|
460
|
+
references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup, range_split_limit = range_split_limit)
|
|
449
461
|
return separator.join([ref.church_uri(use_query_parameters = use_query_parameters) for ref in references])
|
|
450
462
|
|
|
451
|
-
def get_church_url(input_string, lang = 'en', separator = '\n', sort_by = None, skip_lang = False, skip_fragment = False, skip_cleanup = False, **kwargs):
|
|
452
|
-
references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup)
|
|
463
|
+
def get_church_url(input_string, lang = 'en', separator = '\n', sort_by = None, skip_lang = False, skip_fragment = False, skip_cleanup = False, range_split_limit = 1, **kwargs):
|
|
464
|
+
references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup, range_split_limit = range_split_limit)
|
|
453
465
|
return separator.join([ref.church_url(skip_lang = skip_lang, skip_fragment = skip_fragment) for ref in references])
|
|
454
466
|
|
|
455
|
-
def get_church_link(input_string, lang = 'en', separator = '\n', sort_by = None, link_class = None, link_target = None, skip_book_name = False, abbreviated = False, skip_lang = False, skip_fragment = False, skip_cleanup = False, **kwargs):
|
|
456
|
-
references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup)
|
|
467
|
+
def get_church_link(input_string, lang = 'en', separator = '\n', sort_by = None, link_class = None, link_target = None, skip_book_name = False, abbreviated = False, skip_lang = False, skip_fragment = False, skip_cleanup = False, range_split_limit = 1, **kwargs):
|
|
468
|
+
references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup, range_split_limit = range_split_limit)
|
|
457
469
|
return separator.join([ref.church_link(link_class = link_class, link_target = link_target, skip_book_name = skip_book_name, abbreviated = abbreviated, skip_lang = skip_lang, skip_fragment = skip_fragment) for ref in references])
|
|
458
470
|
|
|
459
|
-
def get_reference_objects(input_string, lang = 'en', sort_by = None, skip_cleanup = False, **kwargs):
|
|
460
|
-
return parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup)
|
|
471
|
+
def get_reference_objects(input_string, lang = 'en', sort_by = None, skip_cleanup = False, range_split_limit = 1, **kwargs):
|
|
472
|
+
return parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup, range_split_limit = range_split_limit)
|
|
461
473
|
|
|
462
|
-
def get_reference_attributes(input_string, lang = 'en', sort_by = None, skip_cleanup = False, **kwargs):
|
|
463
|
-
references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup)
|
|
474
|
+
def get_reference_attributes(input_string, lang = 'en', sort_by = None, skip_cleanup = False, range_split_limit = 1, **kwargs):
|
|
475
|
+
references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup, range_split_limit = range_split_limit)
|
|
464
476
|
return [ref.attributes() for ref in references]
|
|
465
477
|
|
|
466
478
|
def get_langs(**kwargs):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scripturelookup
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Summary: Python and command-line utility for converting scripture references between formats.
|
|
5
5
|
Author-email: Samuel Bradshaw <samuel.h.bradshaw@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -161,6 +161,7 @@ Several options are available. Some are only applicable to certain commands.
|
|
|
161
161
|
- **skip_book_name** (optional) – Whether book names should be skipped on labels. Default: False.
|
|
162
162
|
- **abbreviated** (optional) – Whether book abbrevions should be used on labels. Default: False.
|
|
163
163
|
- **skip_cleanup** (optional) – Whether cleanup of the input string should be skipped when parsing. Can be used to speed up parsing if the input string is guaranteed to have well-formed references. Default: False.
|
|
164
|
+
- **range_split_limit** (optional) – Threshold where a range of sequential verses will be split into separate verse groups. Default: 1.
|
|
164
165
|
|
|
165
166
|
|
|
166
167
|
## Acknowledgements
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup/data/metadata-languages.min.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{scripturelookup-0.0.6 → scripturelookup-0.0.7}/src/scripturelookup.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|