refactor render.sh
This commit is contained in:
parent
88363b7a2d
commit
c2d8782354
20
render.sh
20
render.sh
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# render.sh: part of the tape-and-string framework.
|
# render.sh: part of the tape-and-string framework.
|
||||||
# v3.4-p3
|
# v3.4-p4
|
||||||
#B: Load
|
#B: Load
|
||||||
enable -f /usr/lib/bash/csv csv
|
enable -f /usr/lib/bash/csv csv
|
||||||
declare -A title
|
declare -A title
|
||||||
@ -24,6 +24,7 @@ function dirs {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
function docs {
|
function docs {
|
||||||
|
load_title
|
||||||
if ! test -d out; then
|
if ! test -d out; then
|
||||||
err "Cannot render, directory 'out' does not exist, run ./render.sh dir"
|
err "Cannot render, directory 'out' does not exist, run ./render.sh dir"
|
||||||
return 1
|
return 1
|
||||||
@ -70,12 +71,14 @@ function other {
|
|||||||
cp -rv 'in'/* out/
|
cp -rv 'in'/* out/
|
||||||
}
|
}
|
||||||
function all {
|
function all {
|
||||||
|
load_title
|
||||||
dirs
|
dirs
|
||||||
docs
|
docs
|
||||||
sass
|
sass
|
||||||
other
|
other
|
||||||
}
|
}
|
||||||
function info {
|
function info {
|
||||||
|
load_title
|
||||||
local i
|
local i
|
||||||
echo "* \$ignore"
|
echo "* \$ignore"
|
||||||
if [ ${#ignore[@]} -eq 0 ]; then
|
if [ ${#ignore[@]} -eq 0 ]; then
|
||||||
@ -90,16 +93,16 @@ function info {
|
|||||||
echo " - $i :: ${title[$i]}"
|
echo " - $i :: ${title[$i]}"
|
||||||
done
|
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
|
#E: Definition
|
||||||
#B: Logic
|
#B: Logic
|
||||||
#B: Logic/LoadDefs
|
#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
|
#B: Logic/LoadDefs/ignore
|
||||||
if test -f ignore.txt; then
|
if test -f ignore.txt; then
|
||||||
while read -r i; do
|
while read -r i; do
|
||||||
@ -115,6 +118,7 @@ fi
|
|||||||
case $1 in
|
case $1 in
|
||||||
dir) dirs;;
|
dir) dirs;;
|
||||||
doc) docs;;
|
doc) docs;;
|
||||||
|
docs) docs;;
|
||||||
s[ac]ss) sass;;
|
s[ac]ss) sass;;
|
||||||
other) other;;
|
other) other;;
|
||||||
rest) other;;
|
rest) other;;
|
||||||
|
Loading…
Reference in New Issue
Block a user