scripts for my gemini capsule
lsv: Better newlines, error handling
Zach DeCook 2021-02-27
parent 9313d97 · commit 42543a3
-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: