Convert usfm bibles into gemtext (python library/utility)
minor fixes?
Zach DeCook 2023-04-29
parent 21a75c1 · commit 930590a
-rwxr-xr-xusfm2gmi.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/usfm2gmi.py b/usfm2gmi.py
index 5aa1a78..e618870 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('\\+nd*','\\+nd* ').replace('\\f*','\\f* ').replace('\\wj*','\\wj* ').replace('\\w*','\\w* ').replace('\\+w*', '\\+w* ').split()
+ split = line.replace('\\', ' \\').replace('\\nd*','\\nd* ').replace('\\+nd*','\\+nd* ').replace('\\f*','\\f* ').replace('\\wj*','\\wj* ').replace('\\w*',' \\w* ').replace('\\+w*', '\\+w* ').split()
out = ''
nd = False
if len(split) == 0:
@@ -67,7 +67,7 @@ def convert(line):
out += '\n* '
elif word in ['\\q', '\\q1']:
out += '\n> '
- elif word in ['\\q2']:
+ elif word in ['\\q2', '\\q22']: # \q22 is bad input
out += '\n>\t'
elif word in ['\\q3']:
out += '\n>\t\t'