about summary refs log tree commit diff
path: root/usfm2gmi.py
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2021-02-25 15:46:38 -0500
committerZach DeCook <zachdecook@librem.one>2021-02-25 15:47:52 -0500
commitf3a3cd474a4443c92e69579216f6e3d8f70568d7 (patch)
tree3c391a41cfa74df29db17afc8fb142afc2150dbd /usfm2gmi.py
parente864999c34061abf4c8ba6bc393deeb88afd0d97 (diff)
downloadusfm2gmi-f3a3cd474a4443c92e69579216f6e3d8f70568d7.tar.gz
nd: Make God's name in smallcaps
Diffstat (limited to 'usfm2gmi.py')
-rwxr-xr-xusfm2gmi.py19
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