about summary refs log tree commit diff
path: root/lsv.py
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2021-02-27 22:04:51 -0500
committerZach DeCook <zachdecook@librem.one>2021-02-27 22:04:51 -0500
commit42543a360631a47aa0308fafb198d4fe27e182fd (patch)
treeb8f862e7970c035865afbe1c1bdd014352551e98 /lsv.py
parent9313d9755690c49901153897f61b981a95aee33b (diff)
downloadcgi-bin-42543a360631a47aa0308fafb198d4fe27e182fd.tar.gz
lsv: Better newlines, error handling
Diffstat (limited to 'lsv.py')
-rwxr-xr-xlsv.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lsv.py b/lsv.py
index 2e66ea2..64857ab 100755
--- a/lsv.py
+++ b/lsv.py
@@ -6,7 +6,9 @@ import sys
 
 def printf(line):
   if line:
-    print(' '.join(line.split(' ')[2:]),end= ' ')
+    notref = ' '.join(line.split(' ')[2:]).strip()
+    notref = notref.replace('||', "\n")
+    print(notref, end=' ')
   else:
     print('')
 
@@ -19,6 +21,10 @@ def main(qs):
     return
 
   passages = parse_string(qs)
+  # TODO: Also handle "john 3, tomato 2" errors?
+  if type(passages[0]) == tuple:
+    print("51 " + str(passages[0][0]) + "'\r\n")
+    return
   print("20 text/gemini\r\n")
   print("=> https://www.lsvbible.com/p/get-lsv.html Literal Standard Version text from lsvbible.com (CC-BY-ND-NC)")
   for passage in passages: