about summary refs log tree commit diff
path: root/usfm2gmi.py
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2023-12-11 13:23:46 +0000
committerZach DeCook <zachdecook@librem.one>2023-12-11 13:23:46 +0000
commit55ed7b33bb8f11aafe68167e310b8df7b6b06413 (patch)
tree22861de9fbdae5c2a709add0eebe06e5d52c2eba /usfm2gmi.py
parent3679315e6fd1ba1c02a002ce208f385f5989b281 (diff)
downloadusfm2gmi-55ed7b33bb8f11aafe68167e310b8df7b6b06413.tar.gz
convert: add option to output strongs numbers
Diffstat (limited to 'usfm2gmi.py')
-rwxr-xr-xusfm2gmi.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/usfm2gmi.py b/usfm2gmi.py
index 222d800..afb6834 100755
--- a/usfm2gmi.py
+++ b/usfm2gmi.py
@@ -32,7 +32,7 @@ def superscript(word):
       new += c
   return new
 
-def convert(line):
+def convert(line, printStrongs=False):
   """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('\\+nd*','\\+nd* ').replace('\\f*','\\f* ').replace('\\wj*','\\wj* ').replace('\\w*',' \\w* ').replace('\\+w*', '\\+w* ').split()
@@ -113,7 +113,10 @@ def convert(line):
       continue
     elif '|strong="' in word:
       spl = word.split('|')
-      out += spl[0] + ' ' #superscript(spl[1][8:-1]) + ' '
+      out += spl[0]
+      if printStrongs:
+        out += superscript(spl[1][8:-1])
+      out += ' '
     # Remove those extra spaces that sneak in.
     elif word in [',', '.', ';', '”', ',”', '.”', '?”', ')', ':', '!', '?', '.’', '.’”', '?’”', '?’', ';”', '!”', ');', '),']:
       if out[-1] == ' ':