Convert usfm bibles into gemtext (python library/utility)
divine name: use another tag for this
Zach DeCook 2021-04-22
parent 726dd0d · commit e283c7c
-rwxr-xr-xusfm2gmi.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/usfm2gmi.py b/usfm2gmi.py
index d0a2167..ffdf65e 100755
--- a/usfm2gmi.py
+++ b/usfm2gmi.py
@@ -35,7 +35,7 @@ def superscript(word):
def convert(line):
"""Convert a string to a list of tuples, each a token"""
# TODO: preserve the lack of whitespace before a backslash.
- split = line.replace('\\', ' \\').replace('\\nd*','\\nd* ').replace('\\f*','\\f* ').replace('\\wj*','\\wj* ').replace('\\w*','\\w* ').split()
+ split = line.replace('\\', ' \\').replace('\\nd*','\\nd* ').replace('\\+nd*','\\+nd* ').replace('\\f*','\\f* ').replace('\\wj*','\\wj* ').replace('\\w*','\\w* ').split()
out = ''
nd = False
if len(split) == 0:
@@ -79,9 +79,9 @@ def convert(line):
out += '*'
elif word in ['\\em*', '\\it*']:
out = out.rstrip() + '*'
- elif word == '\\nd':
+ elif word in ['\\nd','\\+nd']:
nd = True
- elif word == '\\nd*':
+ elif word in ['\\nd*','\\+nd*']:
nd = False
# Footnotes (https://ubsicap.github.io/usfm/notes_basic/fnotes.html)
elif word == '\\f':