Added dev build mode

This commit is contained in:
Stephen Cochrane 2020-11-10 10:24:09 +02:00
parent 8aee8ca0fc
commit 82b4e402fe
3 changed files with 46 additions and 17 deletions

View File

@ -6,6 +6,8 @@ EXE=bin/GenBlog
all: comp blog build
demo: comp blog buildd
comp: install
$(CC) $(FLAGS) src/GenBlog.c -o $(EXE)
@ -24,6 +26,9 @@ clean:
build:
./build.sh
buildd:
./build.sh -d
blog: comp
@# Reset all blogs to start build.
@# Setup boilerplate html files for blog files

View File

@ -14,22 +14,42 @@ conv () {
sed -E "s|(\\!/)([^ \)]*)|!\/<a href=http:\/\/\2/>\2</a>|g" |
sed -E '/%%BODY%%/r /dev/stdin' raw/template.html |
sed -E '/%%BODY%%/d'
sed -E '/%%BODY%%/d' |
sed 's/%%HEADER%%/'"$header"'/g'
}
mkdir -p site
for file in raw/*.txt
do
case $file in
*index.txt)
path=index.html
;;
*)
path=${file/raw/site}
path=${path/txt/html}
;;
esac
main () {
while getopts "d" opt
do
case $opt in
d)
dev="<h4 class=dev>Please note, this is the development page, things may be broken\.<\/h4><details><summary>Details<\/summary>This version of my website is hosted inside a docker container and pulls from origin\/dev every 10 seconds, hence it is possible for the site to be unstable, this is only for demo purposes\.<\/details>"
;;
*)
exit 2
;;
esac
done
echo "Building $file"
conv < "$file" > $path
done
mkdir -p site
for file in raw/*.txt
do
case $file in
*index.txt)
path=index.html
header="<h1>Skiqqy<\/h1>~ Pronounced skippy"
;;
*)
header="<h1>$(echo $file | cut -d "/" -f 2 | cut -d "." -f 1)<\/h1>"
path=${file/raw/site}
path=${path/txt/html}
;;
esac
[[ -n $dev ]] && header="$header$dev"
echo "Building $file"
conv < "$file" > $path
done
}
main "$@"

View File

@ -40,8 +40,12 @@
text-align: center;
font-size: 30px;
}
.dev {
color: orange
}
</style>
<div class="header"><h1>Skiqqy</h1>~ Pronounced skippy</div>
<div class="header">%%HEADER%%</div>
</style><div style="display:table;margin:16px auto"><div class=c><pre style="top:0;position:sticky;user-select:none;padding-right:64px">
<a href=/ style="text-decoration:none;color:white">Home</a>