Convert usfm bibles into gemtext (python library/utility)
Wordlist Entry: handle more tags
Zach DeCook 2021-07-08
parent a3e7f46 · commit 4b03a40
-rwxr-xr-xusfm2gmi.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/usfm2gmi.py b/usfm2gmi.py
index ffdf65e..7bfef3b 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* ').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:
@@ -94,7 +94,8 @@ def convert(line):
# TODO: support Endnotes (\fe and \fe*)
elif word in ['\\ft']:
continue # TODO: fancy formatting of more types
- elif word in ['\\w','\\w*']:
+ # Words which appear in the glossary.
+ elif word in ['\\w','\\w*', '\\+w', '\\+w*']:
continue
elif '|strong="' in word:
spl = word.split('|')