about summary refs log tree commit diff
path: root/usfm2gmi.py
diff options
context:
space:
mode:
Diffstat (limited to 'usfm2gmi.py')
-rwxr-xr-xusfm2gmi.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/usfm2gmi.py b/usfm2gmi.py
index aca2e26..52cabfe 100755
--- a/usfm2gmi.py
+++ b/usfm2gmi.py
@@ -18,12 +18,12 @@ def smallcaps(word):
 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('\\', ' \\').replace('\\nd*','\\nd* ').replace('\\f*','\\f* ').split()
+  split = line.replace('\\', ' \\').replace('\\nd*','\\nd* ').replace('\\f*','\\f* ').replace('\\wj*','\\wj* ').split()
   out = ''
   nd = False
   if len(split) == 0:
     return out
-  elif split[0] in ['\\mt1','\\mt','\\ms']:
+  elif split[0] in ['\\mt1','\\mt','\\ms','\\h']:
     return '\n# ' + ' '.join(split[1:])
   # TODO: parse as word for title tags in title line
   elif split[0] in ['\\mt2','\\s']:
@@ -38,15 +38,20 @@ def convert(line):
   for word in split:
     if skip > 0:
       skip = skip - 1
-      continue
-    if word in ['\\v', '\\c']:
+    elif word in ['\\id','\\ide']:
+      skip = 1
+    elif word in ['\\v','\\c']:
       skip = 1
     elif word in ['\\p','\\m']:
       out += '\n'
     elif word in ['\\pi','\\pi1']:
       out += '\n\t'
-    elif word in ['\\q']:
+    elif word in ['\\q', '\\q1']:
       out += '\n> '
+    elif word in ['\\q2']:
+      out += '\n>\t'
+    elif word in ['\\q3']:
+      out += '\n>\t\t'
     elif word in ['\\wj','\\wj*']:
       continue
     elif word == '\\nd':