Added dev build mode
This commit is contained in:
parent
8aee8ca0fc
commit
82b4e402fe
5
Makefile
5
Makefile
|
@ -6,6 +6,8 @@ EXE=bin/GenBlog
|
||||||
|
|
||||||
all: comp blog build
|
all: comp blog build
|
||||||
|
|
||||||
|
demo: comp blog buildd
|
||||||
|
|
||||||
comp: install
|
comp: install
|
||||||
$(CC) $(FLAGS) src/GenBlog.c -o $(EXE)
|
$(CC) $(FLAGS) src/GenBlog.c -o $(EXE)
|
||||||
|
|
||||||
|
@ -24,6 +26,9 @@ clean:
|
||||||
build:
|
build:
|
||||||
./build.sh
|
./build.sh
|
||||||
|
|
||||||
|
buildd:
|
||||||
|
./build.sh -d
|
||||||
|
|
||||||
blog: comp
|
blog: comp
|
||||||
@# Reset all blogs to start build.
|
@# Reset all blogs to start build.
|
||||||
@# Setup boilerplate html files for blog files
|
@# Setup boilerplate html files for blog files
|
||||||
|
|
52
build.sh
52
build.sh
|
@ -14,22 +14,42 @@ conv () {
|
||||||
sed -E "s|(\\!/)([^ \)]*)|!\/<a href=http:\/\/\2/>\2</a>|g" |
|
sed -E "s|(\\!/)([^ \)]*)|!\/<a href=http:\/\/\2/>\2</a>|g" |
|
||||||
|
|
||||||
sed -E '/%%BODY%%/r /dev/stdin' raw/template.html |
|
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
|
main () {
|
||||||
for file in raw/*.txt
|
while getopts "d" opt
|
||||||
do
|
do
|
||||||
case $file in
|
case $opt in
|
||||||
*index.txt)
|
d)
|
||||||
path=index.html
|
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>"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
path=${file/raw/site}
|
exit 2
|
||||||
path=${path/txt/html}
|
;;
|
||||||
;;
|
esac
|
||||||
esac
|
done
|
||||||
|
|
||||||
echo "Building $file"
|
mkdir -p site
|
||||||
conv < "$file" > $path
|
for file in raw/*.txt
|
||||||
done
|
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 "$@"
|
||||||
|
|
|
@ -40,8 +40,12 @@
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dev {
|
||||||
|
color: orange
|
||||||
|
}
|
||||||
</style>
|
</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">
|
</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>
|
<a href=/ style="text-decoration:none;color:white">Home</a>
|
||||||
|
|
Loading…
Reference in New Issue