From c2d8782354a6339c1334512ae40cc70d5e4050aa Mon Sep 17 00:00:00 2001 From: Atlas Cove Date: Sat, 18 Feb 2023 21:12:37 +0000 Subject: [PATCH] refactor render.sh --- render.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/render.sh b/render.sh index ae68b0d..c768e8e 100755 --- a/render.sh +++ b/render.sh @@ -1,6 +1,6 @@ #!/bin/bash # render.sh: part of the tape-and-string framework. -# v3.4-p3 +# v3.4-p4 #B: Load enable -f /usr/lib/bash/csv csv declare -A title @@ -24,6 +24,7 @@ function dirs { done } function docs { + load_title if ! test -d out; then err "Cannot render, directory 'out' does not exist, run ./render.sh dir" return 1 @@ -70,12 +71,14 @@ function other { cp -rv 'in'/* out/ } function all { + load_title dirs docs sass other } function info { + load_title local i echo "* \$ignore" if [ ${#ignore[@]} -eq 0 ]; then @@ -90,16 +93,16 @@ function info { echo " - $i :: ${title[$i]}" done } +function load_title { + local ii + while read -r ii; do + csv -a i "$ii" + title[in/${i[0]}]=${i[1]} + done < dat/title.csv +} #E: Definition #B: Logic #B: Logic/LoadDefs -#B: Logic/LoadDefs/title -while read -r ii; do - csv -a i "$ii" - title[in/${i[0]}]=${i[1]} -done < dat/title.csv -#E: Logic/LoadDefs/title -unset ii #B: Logic/LoadDefs/ignore if test -f ignore.txt; then while read -r i; do @@ -115,6 +118,7 @@ fi case $1 in dir) dirs;; doc) docs;; + docs) docs;; s[ac]ss) sass;; other) other;; rest) other;;