setup auto build system

This commit is contained in:
yosh 2022-11-29 12:58:16 -05:00
parent 62a41d9c17
commit 7cebc039d2
9 changed files with 116 additions and 86 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
build/*

View file

@ -0,0 +1,4 @@
<footer>
<p>this site is licensed under <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a><br>
see the <a href="https://git.unix.dog/yosh/website">source code repository</a></p>
</footer>

7
BUILDING-HTML/head.html Normal file
View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf8">
<title>var-TITLE</title>
<link rel="stylesheet" href="style/style.css">
</head>

View file

@ -0,0 +1,28 @@
<section id="lbartop">
<div class="titlebar tb-pink" aria-hidden="true">
<span class="tbl" title="navigation"></span>
<span class="tbr"></span>
</div>
<nav>
<h2>navigation</h2>
<ul>
<li><a href="index.html">home</a>
<li><a href="info.html">information</a>
<li><a href="thoughts.html">thoughts</a>
<li><a href="software.html">software, scripts</a>
<li><a href="links.html">links</a>
<li><a href="credits.html">credits</a>
</ul>
</nav>
</section>
<section id="lbarbot">
<div class="titlebar tb-lblue" aria-hidden="true">
<span class="tbl" title="miscellaneous!!"></span>
<span class="tbr"></span>
</div>
<hr>
<ul class="displist sbgridlist" aria-hidden="true">
<li><img src="img/buttons/tosviolation.gif" alt="this page is a tos violation">
<li><img src="img/buttons/anybrowser.gif" alt="best viewed with any browser">
</ul>
</section>

View file

@ -0,0 +1,4 @@
<div class="titlebar var-COLOR" aria-hidden="true">
<span class="tbl" title="var-TITLE"></span>
<span class="tbr"></span>
</div>

64
build.sh Executable file
View file

@ -0,0 +1,64 @@
#!/bin/sh
set -euf
NL='
'
IFS="$NL"
POSIXLY_CORRECT=1
cd "$GIT_WORK_TREE"
while getopts :c OPT; do
case "$OPT" in
c) rm -rf ./build; exit 0 ;;
*) exit 1 ;;
esac
done
KEYWORDS="$(ls -w 1 "./BUILDING-HTML/")"
# build dir structure
fd -E '/build' -E '/BUILDING-HTML' -t d -x mkdir -p build/{}
# copy files
fd -E '/build' -E '/BUILDING-HTML' -E 'LICENSE' -E 'build.sh' -t f -x cp {} build/{}
# first do html
for file in $(fd -t f -e html -d 1 . ".") ; do
file2="./build/${file##*/}"
tmp="$(cat "$file")"
for k in $KEYWORDS; do
case $k in
titlebar.html|head.html)
# grab var line
line="$(rg -e '\t*<!-- RES '"$k"' (.+) -->' -r '$1' <<-EOF
$tmp
EOF
)" || continue
# set params
IFS=":"
set -- $line
IFS=" $NL"
rep="$(cat "./BUILDING-HTML/$k")"
# replace vars
for j in $@; do
rep="$(sed -e "s/var-${j%%=*}/${j#*=}/g" <<-EOF
$rep
EOF
)"
done
# final replacement
tmp="$(sd "<!-- RES $k .+ -->" "${rep}" <<-EOF
$tmp
EOF
)"
;;
*)
tmp="$(sed -e "/<!-- RES $k -->/r ./BUILDING-HTML/$k" -e "//d" <<-EOF
$tmp
EOF
)"
;;
esac
done
printf '%s' "$tmp" > "$file2"
done

BIN
img/buttons/quakenow.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -1,57 +1,18 @@
<!DOCTYPE html> <!-- RES head.html TITLE=~yosh -->
<html lang="en">
<head>
<meta charset="utf8">
<title>~yosh</title>
<link rel="stylesheet" href="style/style.css">
</head>
<body> <body>
<header> <header>
<h1>~yosh@unix.dog</h1> <h1>~yosh@unix.dog</h1>
</header> </header>
<section id="lbartop"> <!-- RES sidebar.html -->
<div class="titlebar tb-pink" aria-hidden="true">
<span class="tbl" title="navigation"></span>
<span class="tbr"></span>
</div>
<nav>
<h2>navigation</h2>
<ul>
<li><a href="index.html">home</a>
<li><a href="info.html">information</a>
<li><a href="thoughts.html">thoughts</a>
<li><a href="software.html">software, scripts</a>
<li><a href="links.html">links</a>
<li><a href="credits.html">credits</a>
</ul>
</nav>
</section>
<section id="lbarbot">
<div class="titlebar tb-lblue" aria-hidden="true">
<span class="tbl" title="miscellaneous!!"></span>
<span class="tbr"></span>
</div>
<hr>
<ul class="displist sbgridlist" aria-hidden="true">
<li><img src="img/buttons/tosviolation.gif" alt="this page is a tos violation">
<li><img src="img/buttons/anybrowser.gif" alt="best viewed with any browser">
</ul>
</section>
<main> <main>
<div class="titlebar tb-green" aria-hidden="true"> <!-- RES titlebar.html COLOR=tb-green:TITLE=welcome! -->
<span class="tbl" title="welcome!"></span>
<span class="tbr"></span>
</div>
<h2>welcome!</h2> <h2>welcome!</h2>
<p>yo what up. welcome to my unix.dog page<br> <p>yo what up. welcome to my unix.dog page<br>
take a look around!</p> take a look around!</p>
<p><img alt="under construction" src="img/construction.gif"><br> <p><img alt="under construction" src="img/construction.gif"><br>
very, very much under construction</p> very, very much under construction</p>
</main> </main>
<footer> <!-- RES footer.html -->
<p>this site is licensed under <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a><br>
see the <a href="https://git.unix.dog/yosh/website">source code repository</a></p>
</footer>
</body> </body>
</html> </html>

View file

@ -1,48 +1,12 @@
<!DOCTYPE html> <!-- RES head.html TITLE=~yosh -->
<html lang="en">
<head>
<meta charset="utf8">
<title>~yosh</title>
<link rel="stylesheet" href="style/style.css">
</head>
<body> <body>
<header> <header>
<h1>~yosh@unix.dog</h1> <h1>~yosh@unix.dog</h1>
</header> </header>
<section id="lbartop"> <!-- RES sidebar.html -->
<div class="titlebar tb-pink" aria-hidden="true">
<span class="tbl" title="navigation"></span>
<span class="tbr"></span>
</div>
<nav>
<h2>navigation</h2>
<ul>
<li><a href="index.html">home</a>
<li><a href="info.html">information</a>
<li><a href="thoughts.html">thoughts</a>
<li><a href="software.html">software, scripts</a>
<li><a href="links.html">links</a>
<li><a href="credits.html">credits</a>
</ul>
</nav>
</section>
<section id="lbarbot">
<div class="titlebar tb-lblue" aria-hidden="true">
<span class="tbl" title="miscellaneous!!"></span>
<span class="tbr"></span>
</div>
<hr>
<ul class="displist sbgridlist" aria-hidden="true">
<li><img src="img/buttons/tosviolation.gif" alt="this page is a tos violation">
<li><img src="img/buttons/anybrowser.gif" alt="best viewed with any browser">
</ul>
</section>
<main> <main>
<div class="titlebar tb-green" aria-hidden="true"> <!-- RES titlebar.html COLOR=tb-green:TITLE=information -->
<span class="tbl" title="information"></span>
<span class="tbr"></span>
</div>
<h2>myself</h2> <h2>myself</h2>
<p>I'm yosh. or yoshi. or yoshiyosh... or yoshiyoshiyosh...<br> <p>I'm yosh. or yoshi. or yoshiyosh... or yoshiyoshiyosh...<br>
my names get taken a lot. wonder why.<br> my names get taken a lot. wonder why.<br>
@ -67,8 +31,5 @@
<li><a href="https://twitter.com/yoshiyoshiyoshh"><img src="img/buttons/twitter.gif" alt="twitter"></a>(deprecated) <li><a href="https://twitter.com/yoshiyoshiyoshh"><img src="img/buttons/twitter.gif" alt="twitter"></a>(deprecated)
</ul> </ul>
</main> </main>
<footer> <!-- RES footer.html -->
<p>this site is licensed under <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a><br>
see the <a href="https://git.unix.dog/yosh/website">source code repository</a></p>
</footer>
</body> </body>