diff options
| author | Zach DeCook <zachdecook@librem.one> | 2021-02-26 00:22:31 -0500 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2021-02-26 00:22:31 -0500 |
| commit | 87e55508ab3abe19e4e7dac85c0800df9bd4717e (patch) | |
| tree | fb22a887b89538682bbe2375718b537199075360 /oeb.sh | |
| parent | e7224c7696ec23ed62b198f16f5f3d597daac9e2 (diff) | |
| download | cgi-bin-87e55508ab3abe19e4e7dac85c0800df9bd4717e.tar.gz | |
oeb: add working (janky) script
Diffstat (limited to 'oeb.sh')
| -rwxr-xr-x | oeb.sh | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/oeb.sh b/oeb.sh index 83568e1..388fd5a 100755 --- a/oeb.sh +++ b/oeb.sh @@ -1,6 +1,12 @@ -#!/bin/sh -# parse query +#!/bin/bash test "$QUERY_STRING" || QUERY_STRING="$1" +if [ "$QUERY_STRING" = "" ] +then + printf "10 Enter a scripture reference\r\n" + return +fi + +# parse query book=$(echo $QUERY_STRING|cut -d' ' -f1) chstart=$(echo $QUERY_STRING|tr ':' ' ' |cut -d' ' -f2) vstart=$(echo $QUERY_STRING|tr '-' ':' | cut -d: -f2) @@ -11,5 +17,12 @@ chend=$(echo $QUERY_STRING|sed "s/$book //"| sed "s/:$vstart-/ /"|sed "s/ \?:\?$ #echo $chstart "\t" $vstart "\t" $chend "\t"$vend && exit file=$(find oeb/ -name '*'-$book'*') -grep '\c '$chstart $file -A500 | grep '\v '$vstart -A500 \ -| grep '\c '$(($chend + 1)) -B500 | grep '\v '$vend -B500 +if ! test "$file"; then + printf "51 that book doesn't exist yet in the OEB\r\n" + return 1 +fi +printf "20 text/gemini\r\n" +echo "# $book $chstart:$vstart - $chend:$vend" +grep '\c '"$chstart$" $file -A5000 | grep '\v '"$vstart " -A5000 \ +| tac|grep '\c '$(($chend + 1))'$' -A5000 | grep '\v '$vend' ' -A5000 | tac\ +| usfm2gmi/usfm2gmi.py |
