Compare commits
4 Commits
bdbcfbbecd
...
c92d67b96c
Author | SHA1 | Date | |
---|---|---|---|
c92d67b96c | |||
3a82aaefde | |||
8f117a417a | |||
33ef377cc3 |
39
render.sh
39
render.sh
|
@ -1,27 +1,28 @@
|
|||
#!/bin/bash
|
||||
# render.sh: part of the tape-and-string framework.
|
||||
#V:3.6-p1
|
||||
#V:3.7r0
|
||||
#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,27 +49,26 @@ 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
|
||||
docs
|
||||
sass
|
||||
sassfn
|
||||
other
|
||||
}
|
||||
function info {
|
||||
|
@ -111,16 +111,21 @@ 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) inf "Removing out..."; rm -rf out;;
|
||||
*)
|
||||
err "Unknown value, $1."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
#E: Logic
|
||||
exit $?
|
||||
|
|
Loading…
Reference in New Issue
Block a user