diff options
| author | Zach DeCook <zachdecook@librem.one> | 2021-02-25 15:46:38 -0500 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2021-02-25 15:47:52 -0500 |
| commit | f3a3cd474a4443c92e69579216f6e3d8f70568d7 (patch) | |
| tree | 3c391a41cfa74df29db17afc8fb142afc2150dbd /usfm2gmi.py | |
| parent | e864999c34061abf4c8ba6bc393deeb88afd0d97 (diff) | |
| download | usfm2gmi-f3a3cd474a4443c92e69579216f6e3d8f70568d7.tar.gz | |
nd: Make God's name in smallcaps
Diffstat (limited to 'usfm2gmi.py')
| -rwxr-xr-x | usfm2gmi.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/usfm2gmi.py b/usfm2gmi.py index 806b94f..0337153 100755 --- a/usfm2gmi.py +++ b/usfm2gmi.py @@ -4,11 +4,23 @@ import fileinput def printf(string): print(string,end='') +def smallcaps(word): + sc = 'ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ' + new = '' + for c in word: + if c >= 'a' and c <= 'z': + # I like C programming. + new += sc[ord(c)-ord('a')] + else: + new += c + return new + 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('\\', ' \\').split() out = '' + nd = False if len(split) == 0: return out elif split[0] in ['\\mt1','\\mt','\\ms']: @@ -35,7 +47,14 @@ def convert(line): out += '\n> ' elif word in ['\\wj','\\wj*']: continue + elif word == '\\nd': + nd = True + elif word == '\\nd*': + nd = False else: + if nd: + out += smallcaps(word) + ' ' + else: out += word + ' ' return out |
