Convert usfm bibles into gemtext (python library/utility)
wj: ignore. red letters considered harmful
| -rwxr-xr-x | usfm2gmi.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usfm2gmi.py b/usfm2gmi.py index 2d27827..4edf6b8 100755 --- a/usfm2gmi.py +++ b/usfm2gmi.py @@ -6,7 +6,8 @@ def printf(string): def convert(line): """Convert a string to a list of tuples, each a token""" - split = line.split() + # TODO: preserve the lack of whitespace before a backslash. + split = line.replace('\\', ' \\').split() out = '' if len(split) == 0: return out @@ -30,6 +31,8 @@ def convert(line): skip = 1 elif word == '\\p': out += '\n' + elif word in ['\\wj','\\wj*']: + continue else: out += word + ' ' return out |