Convert usfm bibles into gemtext (python library/utility)
enable superscript tag
| -rwxr-xr-x | usfm2gmi.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/usfm2gmi.py b/usfm2gmi.py index 5d52808..6865ac4 100755 --- a/usfm2gmi.py +++ b/usfm2gmi.py @@ -38,6 +38,7 @@ def convert(line, printStrongs=False): 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 + superS = False if len(split) == 0: return out elif split[0] in ['\\mt1','\\mt','\\ms','\\h']: @@ -111,6 +112,10 @@ def convert(line, printStrongs=False): continue elif word in ['\\nb']: continue + elif word == '\\+sup': + superS = True + elif word == '\\+sup*': + superS = False elif '|strong="' in word: spl = word.split('|') out += spl[0] @@ -130,6 +135,8 @@ def convert(line, printStrongs=False): else: if nd: out += smallcaps(word) + ' ' + if superS: + out += superscript(word) + ' ' else: out += word + ' ' return out |