diff --git a/render.sh b/render.sh index b02c077..37f42e0 100755 --- a/render.sh +++ b/render.sh @@ -1,27 +1,28 @@ #!/bin/bash # render.sh: part of the tape-and-string framework. -#V:3.6-p1 +#V:3.6-r2 #B: Load enable -f /usr/lib/bash/csv csv declare -A title #E: Load #B: Definition +#B: Definition/Ampelstatus function inf { 1>&2 echo -e "\x1B[1;32mINF\x1B[0m: $*"; } function wrn { 1>&2 echo -e "\x1B[1;93mWRN\x1B[0m: $*"; } function err { 1>&2 echo -e "\x1B[1;31mERR\x1B[0m: $*"; } +#E: Defintion/Ampelstatus function dirs { if test -d out; then wrn "Directory 'out' already exists." - return 0 fi - local i o dir + local i o dir odir dir=(`./pfiles.rb dir`) - inf "Creating directory structure..." + inf "\x1B[1m[dirs]\x1B[0m Creating directory structure..." echo ${dir[@]} for i in ${dir[@]}; do - o="${i/in/out}" - mkdir -pv $o + odir+="${i/in/out} " done + mkdir -pv $odir } function docs { load_title @@ -31,7 +32,7 @@ function docs { fi local i o doc doc=(`./pfiles.rb doc`) - inf "Rendering document files..." + inf "\x1B[1m[docs]\x1B[0m Rendering document files..." for i in ${doc[@]}; do o="${i/in/out}" o="${o%.*}.html" @@ -48,22 +49,21 @@ function sassfn { err "Cannot render, directory 'out' does not exist, run ./render.sh dir" exit 1 fi - inf "Rendering sass files..." + inf "\x1B[1m[sassfn]\x1B[0m Rendering sass files..." sass --no-source-map in/css:out/css } function other { - local other=`./pfiles.rb rest` + inf "\x1B[1m[other]\x1B[0m Hardlinking other files..." + local i other=`./pfiles.rb rest` for i in $other; do - if test -f $i; then + local o=${i/in/out} + if test -f $o; then inf "Skipping $i, file/hardlink exists..." continue fi - ln -v $i ${i/in/out} + ln -v $i $o done } -function sitemap { - ./gensimap.sh -} function all { load_title dirs @@ -111,16 +111,22 @@ if test -z "$*"; then fi case $1 in dir) dirs;; + dirs) dirs;; doc) docs;; docs) docs;; s[ac]ss) sassfn;; other) dirs; other;; rest) other;; info) info;; - sitemap) sitemap;; + sitemap) ./sitemap.sh;; vall) info; all;; all) all;; - *) all;; + clean) rm -rf out;; + *) + inf "Removing out..." + err "Unknown value, $1." + exit 1 + ;; esac #E: Logic exit $?