Added shellscript support

This commit is contained in:
Atlas Cove 2023-02-17 13:13:52 +00:00
parent 50dde3f39c
commit 4cf014f274

View File

@ -1,14 +1,14 @@
#!/bin/bash #!/bin/bash
# render.sh: part of the tape-and-string framework. # render.sh: part of the tape-and-string framework.
# v3.3-p4 # v3.4-p1
#B: Load #B: Load
enable -f /usr/lib/bash/csv csv enable -f /usr/lib/bash/csv csv
declare -A title declare -A title
#E: Load #E: Load
#B: Definition #B: Definition
function inf { echo -e "\x1B[1;32mINF\x1B[0m: $*"; } function inf { 1>&2 echo -e "\x1B[1;32mINF\x1B[0m: $*"; }
function wrn { echo -e "\x1B[1;93mWRN\x1B[0m: $*"; } function wrn { 1>&2 echo -e "\x1B[1;93mWRN\x1B[0m: $*"; }
function err { echo -e "\x1B[1;31mERR\x1B[0m: $*"; } function err { 1>&2 echo -e "\x1B[1;31mERR\x1B[0m: $*"; }
function tape { function tape {
if test -d "$1"; then if test -d "$1"; then
err "tape: Passed directory, $1" err "tape: Passed directory, $1"
@ -20,6 +20,7 @@ function tape {
*.md) comrak --gfm "$1" ;; *.md) comrak --gfm "$1" ;;
*.html) cat $1 ;; *.html) cat $1 ;;
*.s[ac]ss) err "Told to render $1, shouldn't happen"; return 1 ;; *.s[ac]ss) err "Told to render $1, shouldn't happen"; return 1 ;;
*.sh) (inf "Running shellscript $1, I hope you know what you're doing..."; source $1 );;
*) pandoc --columns 168 -t html "$1" || echo "Skipping $i, unknown format" ;; *) pandoc --columns 168 -t html "$1" || echo "Skipping $i, unknown format" ;;
esac esac
} }
@ -127,15 +128,15 @@ if test -z "$*"; then
exit $? exit $?
fi fi
case $1 in case $1 in
dir) dirs;; dir) dirs;;
doc) docs;; doc) docs;;
s[ac]ss) sass;; s[ac]ss) sass;;
other) other;; other) other;;
rest) other;; rest) other;;
info) info;; info) info;;
vall) info; all;; vall) info; all;;
all) all;; all) all;;
*) all;; *) all;;
esac esac
#E: Logic #E: Logic
exit $? exit $?