Convert usfm bibles into gemtext (python library/utility)
Strongs definitions: ignore them
| -rwxr-xr-x | usfm2gmi.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usfm2gmi.py b/usfm2gmi.py index fe188e7..fb25131 100755 --- a/usfm2gmi.py +++ b/usfm2gmi.py @@ -24,7 +24,7 @@ def smallcaps(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* ').split() + split = line.replace('\\', ' \\').replace('\\nd*','\\nd* ').replace('\\f*','\\f* ').replace('\\wj*','\\wj* ').replace('|strong',' |strong').split() out = '' nd = False if len(split) == 0: @@ -83,6 +83,10 @@ def convert(line): # TODO: support Endnotes (\fe and \fe*) elif word in ['\\ft']: continue # TODO: fancy formatting of more types + elif word == '\\w': + continue + elif '|strong' in word: + continue else: if nd: out += smallcaps(word) + ' ' |