scripts for my gemini capsule
oeb: add working (janky) script
| -rw-r--r-- | .gitmodules | 6 | ||||
| m--------- | Open-English-Bible | 0 | ||||
| l--------- | oeb | 1 | ||||
| -rwxr-xr-x | oeb.sh | 21 | ||||
| m--------- | usfm2gmi | 0 |
5 files changed, 24 insertions, 4 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..00781ad --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "usfm2gmi"] + path = usfm2gmi + url = https://git.sr.ht/~earboxer/usfm2gmi +[submodule "Open-English-Bible"] + path = Open-English-Bible + url = https://github.com/openenglishbible/Open-English-Bible diff --git a/Open-English-Bible b/Open-English-Bible new file mode 160000 +Subproject c26b9f72a34110b5939a312cd357ce4820589ef @@ -0,0 +1 @@ +Open-English-Bible/artifacts/us-release/usfm
\ No newline at end of file @@ -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 diff --git a/usfm2gmi b/usfm2gmi new file mode 160000 +Subproject 5efacd000c0b2b19db9af6d3febb2369e271e03 |