scripturelookup 0.0.4__tar.gz → 0.0.5__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.
Files changed (28) hide show
  1. {scripturelookup-0.0.4/src/scripturelookup.egg-info → scripturelookup-0.0.5}/PKG-INFO +4 -2
  2. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/README.md +1 -0
  3. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/scripturelookup/command_line.py +2 -0
  4. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/scripturelookup/data.py +13 -1
  5. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/scripturelookup/lookup.py +85 -94
  6. {scripturelookup-0.0.4 → scripturelookup-0.0.5/src/scripturelookup.egg-info}/PKG-INFO +4 -2
  7. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/.github/workflows/publish.yml +0 -0
  8. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/.gitignore +0 -0
  9. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/LICENSE +0 -0
  10. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/pyproject.toml +0 -0
  11. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/requirements.txt +0 -0
  12. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/setup.cfg +0 -0
  13. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/geezify-python-main/LICENSE +0 -0
  14. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/geezify-python-main/README.md +0 -0
  15. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/geezify-python-main/arabify.py +0 -0
  16. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/geezify-python-main/arabify_test.py +0 -0
  17. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/geezify-python-main/geezify.py +0 -0
  18. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/geezify-python-main/geezify_test.py +0 -0
  19. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/geezify-python-main/test_data.py +0 -0
  20. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/scripturelookup/__init__.py +0 -0
  21. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/scripturelookup/data/metadata-languages.min.json +0 -0
  22. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/scripturelookup/data/metadata-scriptures.min.json +0 -0
  23. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/scripturelookup/numbers.py +0 -0
  24. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/scripturelookup.egg-info/SOURCES.txt +0 -0
  25. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/scripturelookup.egg-info/dependency_links.txt +0 -0
  26. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/scripturelookup.egg-info/entry_points.txt +0 -0
  27. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/scripturelookup.egg-info/requires.txt +0 -0
  28. {scripturelookup-0.0.4 → scripturelookup-0.0.5}/src/scripturelookup.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: scripturelookup
3
- Version: 0.0.4
3
+ Version: 0.0.5
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
@@ -34,6 +34,7 @@ Requires-Python: >=3.8
34
34
  Description-Content-Type: text/markdown
35
35
  License-File: LICENSE
36
36
  Requires-Dist: requests
37
+ Dynamic: license-file
37
38
 
38
39
  # Scripture Lookup
39
40
 
@@ -157,6 +158,7 @@ Several options are available. Some are only applicable to certain commands.
157
158
  - **skip_fragment** (optional) – Whether fragments should be skipped on URLs. Default: False.
158
159
  - **skip_book_name** (optional) – Whether book names should be skipped on labels. Default: False.
159
160
  - **abbreviated** (optional) – Whether book abbrevions should be used on labels. Default: False.
161
+ - **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.
160
162
 
161
163
 
162
164
  ## Acknowledgements
@@ -120,6 +120,7 @@ Several options are available. Some are only applicable to certain commands.
120
120
  - **skip_fragment** (optional) – Whether fragments should be skipped on URLs. Default: False.
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
+ - **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.
123
124
 
124
125
 
125
126
  ## Acknowledgements
@@ -19,6 +19,7 @@ def main_cli():
19
19
  parser.add_argument('--skip_fragment', action='store_true', help='Skip #frament in URLs.')
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
+ parser.add_argument('--skip_cleanup', action='store_true', help='Skip cleanup of the input string for faster parsing.')
22
23
 
23
24
  args = parser.parse_args()
24
25
 
@@ -36,6 +37,7 @@ def main_cli():
36
37
  skip_fragment = args.skip_fragment,
37
38
  skip_book_name = args.skip_book_name,
38
39
  abbreviated = args.abbreviated,
40
+ skip_cleanup = args.skip_cleanup,
39
41
  )
40
42
 
41
43
  print(result)
@@ -4,6 +4,7 @@ import sys
4
4
  import json
5
5
  import time
6
6
  import re
7
+ import unicodedata
7
8
 
8
9
  # Third-party libraries
9
10
  import requests
@@ -40,10 +41,21 @@ def update_data():
40
41
  for filename in ('metadata-languages.min.json', 'metadata-scriptures.min.json',):
41
42
  download_data(filename, os.path.join(data_directory, filename))
42
43
 
44
+ # Normalize text by removing anything that's not a letter or number, and converting to lowercase. This allows for a fuzzy comparison between input text and a known list of values.
45
+ def normalize_for_compare(text):
46
+ decomposed_text = unicodedata.normalize('NFKD', text)
47
+ normalized_text = ''.join([c for c in decomposed_text if unicodedata.category(c)[0] in ['L', 'N']]).lower()
48
+ return normalized_text
49
+
43
50
  languages = load_data('metadata-languages.min.json')
44
51
  scriptures = load_data('metadata-scriptures.min.json')
45
52
 
46
- reference_separators_pattern = r'|'.join([re.escape(s.strip()) for s in scriptures['summary']['punctuation']['referenceSeparator']] + [re.escape(';'), re.escape('\n')])
53
+ scriptures['mapToSlugNormalized'] = {}
54
+ for key, value in scriptures['mapToSlug'].items():
55
+ normalized_key = normalize_for_compare(key)
56
+ scriptures['mapToSlugNormalized'][normalized_key] = value
57
+
58
+ reference_separators_pattern = r'|'.join([re.escape(s.strip()) for s in scriptures['summary']['punctuation']['referenceSeparator']] + [re.escape(';'), re.escape('|'), re.escape('•'), re.escape('\n')])
47
59
  chapter_verse_separators_pattern = r'|'.join([re.escape(s.strip()) for s in scriptures['summary']['punctuation']['chapterVerseSeparator']] + [re.escape(':')])
48
60
  verse_group_separators_pattern = r'|'.join([re.escape(s.strip()) for s in scriptures['summary']['punctuation']['verseGroupSeparator']] + [re.escape(',')])
49
61
  verse_range_separators_pattern = r'|'.join([re.escape(s.strip()) for s in scriptures['summary']['punctuation']['verseRangeSeparator']] + [re.escape('-'), re.escape('–'), re.escape('〜')])
@@ -1,7 +1,6 @@
1
1
  # Python standard libraries
2
2
  import sys
3
3
  import re
4
- import unicodedata
5
4
 
6
5
  # Third-party libraries
7
6
  import icu
@@ -166,13 +165,6 @@ class Reference:
166
165
  return 0 < 1
167
166
 
168
167
 
169
- # Normalize text by removing anything that's not a letter or number, and converting to lowercase. This allows for a fuzzy comparison between input text and a known list of values.
170
- def normalizeForCompare(text):
171
- decomposed_text = unicodedata.normalize('NFKD', text)
172
- normalized_text = ''.join([c for c in decomposed_text if unicodedata.category(c)[0] in ['L', 'N']]).lower()
173
- return normalized_text
174
-
175
-
176
168
  # Parse verses into verse groups
177
169
  # Example: '1-2,5-7,9' –> [[1, 2], [5, 6, 7], [9]]
178
170
  def parse_verses_string(verses_string, lang = 'en'):
@@ -239,72 +231,75 @@ def convert_verse_groups_to_string(verse_groups, verse_range_separator, verse_gr
239
231
 
240
232
 
241
233
  # Parse one or more scripture references, URIs, URLs, or slugs
242
- def parse_references_string(input_string, lang = 'en', sort_by = None):
234
+ # The script will run faster if skip_cleanup is True, but all scripture references or URIs will be expected to have consistent formatting
235
+ def parse_references_string(input_string, lang = 'en', sort_by = None, skip_cleanup = False):
243
236
  lang = data.get_bcp47(lang)
244
237
 
245
238
  # Remove leading or trailing whitespace and punctuation
246
239
  punctuation_to_strip = ''.join(data.scriptures['summary']['punctuation']['referenceSeparator'] + data.scriptures['summary']['punctuation']['verseGroupSeparator'] + data.scriptures['summary']['punctuation']['verseRangeSeparator']) + '(;,.'
247
- input_string = input_string.strip().strip(punctuation_to_strip).rstrip(':').strip()
248
-
249
- # If language is English, replace roman numerals with numbers. Example: 'II Corinthians" –> "2 Corinthians"
250
- if lang == 'en':
251
- input_string = re.sub(r'\bi\s', '1', input_string, flags=re.IGNORECASE)
252
- input_string = re.sub(r'\bii\s', '2', input_string, flags=re.IGNORECASE)
253
- input_string = re.sub(r'\biii\s', '3', input_string, flags=re.IGNORECASE)
254
- input_string = re.sub(r'\biv\s', '4', input_string, flags=re.IGNORECASE)
255
-
256
- # Remove commas from book names so further normalization doesn't try to split it into two references. Example: "JST, Genesis 1" –> "JST Genesis 1"
257
- input_string = input_string.replace('\xa0', ' ')
258
- scripture_book_names = set()
259
- scripture_book_names_without_commas = []
260
- for volume_data in data.scriptures['structure'].values():
261
- for book_slug in volume_data['books'].keys():
262
- book_info = data.scriptures['languages'][lang]['translatedNames'].get(book_slug)
263
- if book_info:
264
- book_name = (book_info.get('name') or '').replace('\xa0', ' ')
265
- if book_name:
266
- scripture_book_names.add(book_name)
267
- book_abbrev = (book_info.get('abbrev') or '').replace('\xa0', ' ')
268
- if book_abbrev:
269
- scripture_book_names.add(book_abbrev)
270
- scripture_book_names = sorted(scripture_book_names, key=lambda x: (-len(x), x))
271
- for scripture_book_name in scripture_book_names:
272
- scripture_book_name_without_comma = re.sub(data.verse_group_separators_pattern, '', scripture_book_name)
273
- scripture_book_names_without_commas.append(scripture_book_name_without_comma)
274
- if scripture_book_name in input_string and re.search(data.verse_group_separators_pattern, scripture_book_name):
275
- input_string = input_string.replace(scripture_book_name, scripture_book_name_without_comma)
276
-
277
- # Normalize whitespace-separated references. Example: "Genesis 1:2 1 Nephi 3:7" –> "; Genesis 1:2 ; 1 Nephi 3:7"
278
- scripture_book_names_pattern = '|'.join([re.escape(sbn) for sbn in scripture_book_names_without_commas])
279
- input_string = re.sub(rf'(?:^|[^\-])\b({scripture_book_names_pattern})', r'; \1', input_string, flags=re.IGNORECASE)
280
240
 
281
- # 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"
282
- input_string = re.sub(r'\s+(?:and|y|e|et|&)\s+(\d+)', r',\1', input_string)
283
- input_string = re.sub(r'\s+(?:through|thru|to|al|a|à)\s+(\d+)', r'–\1', input_string)
284
-
285
- # Normalize verse sets. Example: "chapter 3 verse 7; vv. 3, 6" –> "chapter 3:7; :3, 6"
286
- input_string = re.sub(r'(?:^|\s)(?:verses|verse|vv\.|v\.|versículos|versículo|versets|verset)\s(\d+)', r':\1', input_string).replace('::', ':')
287
-
288
- # Normalize chapter sets. Example: "Genesis 1, 2, 4–5, Exodus 10; Alma 32" –> "Genesis 1; 2; 4–5; Exodus 10; Alma 32"
289
- if re.search(data.verse_group_separators_pattern, input_string) and not re.search(data.chapter_verse_separators_pattern, input_string):
290
- input_string = re.sub(rf'(?:{data.verse_group_separators_pattern})+', ';', input_string)
291
-
292
- # Normalize chapter:verse sets. Example: "Genesis 6:7a, 6:13a, 15; 1 Nephi 3:7 (twice), 8:21" –> "Genesis 6:7a; 6:13a, 15; 1 Nephi 3:7 (twice); 8:21"
293
- if re.search(data.chapter_verse_separators_pattern, input_string):
294
- references_list = re.split(data.reference_separators_pattern, input_string)
295
- new_references_list = []
296
- for reference in references_list:
297
- reference_parts = re.split(data.verse_group_separators_pattern, reference)
298
- reference_input_string = ''
299
- for part in reference_parts:
300
- if reference_input_string == '':
301
- reference_input_string += part
302
- elif re.search(data.chapter_verse_separators_pattern, part):
303
- reference_input_string += ';' + part
304
- else:
305
- reference_input_string += ',' + part
306
- new_references_list.append(reference_input_string)
307
- input_string = ';'.join(new_references_list)
241
+ if not skip_cleanup:
242
+ input_string = input_string.strip().strip(punctuation_to_strip).rstrip(':').strip()
243
+
244
+ # If language is English, replace roman numerals with numbers. Example: 'II Corinthians" –> "2 Corinthians"
245
+ if lang == 'en':
246
+ input_string = re.sub(r'\bi\s', '1', input_string, flags=re.IGNORECASE)
247
+ input_string = re.sub(r'\bii\s', '2', input_string, flags=re.IGNORECASE)
248
+ input_string = re.sub(r'\biii\s', '3', input_string, flags=re.IGNORECASE)
249
+ input_string = re.sub(r'\biv\s', '4', input_string, flags=re.IGNORECASE)
250
+
251
+ # Remove commas from book names so further normalization doesn't try to split it into two references. Example: "JST, Genesis 1" –> "JST Genesis 1"
252
+ input_string = input_string.replace('\xa0', ' ')
253
+ scripture_book_names = set()
254
+ scripture_book_names_without_commas = []
255
+ for volume_data in data.scriptures['structure'].values():
256
+ for book_slug in volume_data['books'].keys():
257
+ book_info = data.scriptures['languages'][lang]['translatedNames'].get(book_slug)
258
+ if book_info:
259
+ book_name = (book_info.get('name') or '').replace('\xa0', ' ')
260
+ if book_name:
261
+ scripture_book_names.add(book_name)
262
+ book_abbrev = (book_info.get('abbrev') or '').replace('\xa0', ' ')
263
+ if book_abbrev:
264
+ scripture_book_names.add(book_abbrev)
265
+ scripture_book_names = sorted(scripture_book_names, key=lambda x: (-len(x), x))
266
+ for scripture_book_name in scripture_book_names:
267
+ scripture_book_name_without_comma = re.sub(data.verse_group_separators_pattern, '', scripture_book_name)
268
+ scripture_book_names_without_commas.append(scripture_book_name_without_comma)
269
+ if scripture_book_name in input_string and re.search(data.verse_group_separators_pattern, scripture_book_name):
270
+ input_string = input_string.replace(scripture_book_name, scripture_book_name_without_comma)
271
+
272
+ # Normalize whitespace-separated references. Example: "Genesis 1:2 1 Nephi 3:7" –> "; Genesis 1:2 ; 1 Nephi 3:7"
273
+ scripture_book_names_pattern = '|'.join([re.escape(sbn) for sbn in scripture_book_names_without_commas])
274
+ input_string = re.sub(rf'(?:^|[^\-])\b({scripture_book_names_pattern})', r'; \1', input_string, flags=re.IGNORECASE)
275
+
276
+ # 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"
277
+ input_string = re.sub(r'\s+(?:and|y|e|et|&)\s+(\d+)', r',\1', input_string)
278
+ input_string = re.sub(r'\s+(?:through|thru|to|al|a|à)\s+(\d+)', r'–\1', input_string)
279
+
280
+ # Normalize verse sets. Example: "chapter 3 verse 7; vv. 3, 6" –> "chapter 3:7; :3, 6"
281
+ input_string = re.sub(r'(?:^|\s)(?:verses|verse|vv\.|v\.|versículos|versículo|versets|verset)\s(\d+)', r':\1', input_string).replace('::', ':')
282
+
283
+ # Normalize chapter sets. Example: "Genesis 1, 2, 4–5, Exodus 10; Alma 32" –> "Genesis 1; 2; 4–5; Exodus 10; Alma 32"
284
+ if re.search(data.verse_group_separators_pattern, input_string) and not re.search(data.chapter_verse_separators_pattern, input_string):
285
+ input_string = re.sub(rf'(?:{data.verse_group_separators_pattern})+', ';', input_string)
286
+
287
+ # Normalize chapter:verse sets. Example: "Genesis 6:7a, 6:13a, 15; 1 Nephi 3:7 (twice), 8:21" –> "Genesis 6:7a; 6:13a, 15; 1 Nephi 3:7 (twice); 8:21"
288
+ if re.search(data.chapter_verse_separators_pattern, input_string):
289
+ references_list = re.split(data.reference_separators_pattern, input_string)
290
+ new_references_list = []
291
+ for reference in references_list:
292
+ reference_parts = re.split(data.verse_group_separators_pattern, reference)
293
+ reference_input_string = ''
294
+ for part in reference_parts:
295
+ if reference_input_string == '':
296
+ reference_input_string += part
297
+ elif re.search(data.chapter_verse_separators_pattern, part):
298
+ reference_input_string += ';' + part
299
+ else:
300
+ reference_input_string += ',' + part
301
+ new_references_list.append(reference_input_string)
302
+ input_string = ';'.join(new_references_list)
308
303
 
309
304
  input_list = re.split(data.reference_separators_pattern, input_string)
310
305
 
@@ -317,11 +312,12 @@ def parse_references_string(input_string, lang = 'en', sort_by = None):
317
312
  if not input_string:
318
313
  continue
319
314
 
320
- # Remove trailing text. Example: "1 John 3:2 2" –> "1 John 3:2"
321
- trailing_text_match = re.match(rf'^.*?\d((?:\:|{data.closing_parenthesis_pattern})?\s+[^{data.opening_parenthesis_pattern}|\s]+)$', input_string)
322
- if trailing_text_match:
323
- trailing_text_string = trailing_text_match.group(1)
324
- input_string = input_string.removesuffix(trailing_text_string)
315
+ if not skip_cleanup:
316
+ # Remove trailing text. Example: "1 John 3:2 2" –> "1 John 3:2"
317
+ trailing_text_match = re.match(rf'^.*?\d((?:\:|{data.closing_parenthesis_pattern})?\s+[^{data.opening_parenthesis_pattern}|\s]+)$', input_string)
318
+ if trailing_text_match:
319
+ trailing_text_string = trailing_text_match.group(1)
320
+ input_string = input_string.removesuffix(trailing_text_string)
325
321
 
326
322
  verses_string = None
327
323
  context_verses_string = None
@@ -389,12 +385,7 @@ def parse_references_string(input_string, lang = 'en', sort_by = None):
389
385
  book_slug = None
390
386
  skip_book_name = False
391
387
  if book_string:
392
- book_slug = data.scriptures['mapToSlug'].get(book_string, None)
393
- if not book_slug:
394
- for key, value in data.scriptures['mapToSlug'].items():
395
- if normalizeForCompare(book_string) == normalizeForCompare(key):
396
- book_slug = value
397
- break
388
+ book_slug = data.scriptures['mapToSlug'].get(book_string, None) or data.scriptures['mapToSlugNormalized'].get(data.normalize_for_compare(book_string), None)
398
389
  # Special handling for Abraham facsimiles
399
390
  if book_slug == 'facsimiles' or (not book_slug and 'fac' in book_string.lower()):
400
391
  if previous_book_slug == 'abraham' and not previous_chapter:
@@ -442,31 +433,31 @@ def parse_references_string(input_string, lang = 'en', sort_by = None):
442
433
 
443
434
  # Functions that can be called via Python or from the command line (see README.md for more information)
444
435
 
445
- def get_content(input_string, lang = 'en', separator = '\n', source = 'python-scripture-scraper', **kwargs):
446
- references = parse_references_string(input_string, lang = lang)
436
+ def get_content(input_string, lang = 'en', separator = '\n', source = 'python-scripture-scraper', skip_cleanup = False, **kwargs):
437
+ references = parse_references_string(input_string, lang = lang, skip_cleanup = skip_cleanup)
447
438
  return separator.join([ref.content(source = source) for ref in references])
448
439
 
449
- def get_label(input_string, lang = 'en', separator = '\n', sort_by = None, skip_book_name = False, abbreviated = False, **kwargs):
450
- references = parse_references_string(input_string, lang = lang, sort_by = sort_by)
440
+ def get_label(input_string, lang = 'en', separator = '\n', sort_by = None, skip_book_name = False, abbreviated = False, skip_cleanup = False, **kwargs):
441
+ references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup)
451
442
  return separator.join([ref.label(skip_book_name = skip_book_name, abbreviated = abbreviated) for ref in references])
452
443
 
453
- def get_church_uri(input_string, separator = '\n', sort_by = None, use_query_parameters = False, **kwargs):
454
- references = parse_references_string(input_string, lang = lang, sort_by = sort_by)
444
+ def get_church_uri(input_string, separator = '\n', sort_by = None, use_query_parameters = False, skip_cleanup = False, **kwargs):
445
+ references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup)
455
446
  return separator.join([ref.church_uri(use_query_parameters = use_query_parameters) for ref in references])
456
447
 
457
- def get_church_url(input_string, lang = 'en', separator = '\n', sort_by = None, skip_lang = False, skip_fragment = False, **kwargs):
458
- references = parse_references_string(input_string, lang = lang, sort_by = sort_by)
448
+ def get_church_url(input_string, lang = 'en', separator = '\n', sort_by = None, skip_lang = False, skip_fragment = False, skip_cleanup = False, **kwargs):
449
+ references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup)
459
450
  return separator.join([ref.church_url(skip_lang = skip_lang, skip_fragment = skip_fragment) for ref in references])
460
451
 
461
- 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, **kwargs):
462
- references = parse_references_string(input_string, lang = lang, sort_by = sort_by)
452
+ 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):
453
+ references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup)
463
454
  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])
464
455
 
465
- def get_reference_objects(input_string, lang = 'en', sort_by = None, **kwargs):
466
- return parse_references_string(input_string, lang = lang, sort_by = sort_by)
456
+ def get_reference_objects(input_string, lang = 'en', sort_by = None, skip_cleanup = False, **kwargs):
457
+ return parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup)
467
458
 
468
- def get_reference_attributes(input_string, lang = 'en', sort_by = None, **kwargs):
469
- references = parse_references_string(input_string, lang = lang, sort_by = sort_by)
459
+ def get_reference_attributes(input_string, lang = 'en', sort_by = None, skip_cleanup = False, **kwargs):
460
+ references = parse_references_string(input_string, lang = lang, sort_by = sort_by, skip_cleanup = skip_cleanup)
470
461
  return [ref.attributes() for ref in references]
471
462
 
472
463
  def get_langs(**kwargs):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: scripturelookup
3
- Version: 0.0.4
3
+ Version: 0.0.5
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
@@ -34,6 +34,7 @@ Requires-Python: >=3.8
34
34
  Description-Content-Type: text/markdown
35
35
  License-File: LICENSE
36
36
  Requires-Dist: requests
37
+ Dynamic: license-file
37
38
 
38
39
  # Scripture Lookup
39
40
 
@@ -157,6 +158,7 @@ Several options are available. Some are only applicable to certain commands.
157
158
  - **skip_fragment** (optional) – Whether fragments should be skipped on URLs. Default: False.
158
159
  - **skip_book_name** (optional) – Whether book names should be skipped on labels. Default: False.
159
160
  - **abbreviated** (optional) – Whether book abbrevions should be used on labels. Default: False.
161
+ - **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.
160
162
 
161
163
 
162
164
  ## Acknowledgements
File without changes