Update website generation

This commit is contained in:
c0dev0id 2022-12-27 22:39:14 +01:00
parent 1e3279cab1
commit f4ec6cdadf
3 changed files with 20 additions and 19 deletions

View File

@ -8,33 +8,38 @@ REMOTE = sdk@codevoid.de:/home/www/htdocs/shagen
all: build-and-upload-all all: build-and-upload-all
@echo "done." @echo "done."
# Create the photo galleries and create the index and preview html # Create the photo galleries and create the index and preview html pages.
# pages in site/, so they get parsed in the compile step
PHOTODIRS != find photos/* -maxdepth 0 -mindepth 0 -type d PHOTODIRS != find photos/* -maxdepth 0 -mindepth 0 -type d
photos: ${PHOTODIRS} photos: ${PHOTODIRS}
mkdir -p ${SITE}/photos mkdir -p ${SITE}/photos
cd photos && sh ${SCRIPTS}/mkphotoindex.sh > index.html cd photos && sh ${SCRIPTS}/mkphotoindex.sh > index.html
find photos -type f -not -name "*.html" -exec install -D {} www/{} \; find photos -type f \( -not -name "*.html" \
find photos -type f -name "*.html" -exec install -D {} site/{} \; -not -name "*.txt" \
-not -name "*.meta" \
\) -exec install -D {} www/{} \;
find photos -type f \( -name "*.html" \
-o -name "*.meta" \
\) -exec install -D {} site/{} \;
${PHOTODIRS}:
cd "$@" && sh ${SCRIPTS}/mkphotos.sh > index.html
# (manual step) - it takes some time to optimize all images and it's not really necessary.
optimize: optimize:
find photos -name "*.jpg" -type f -exec jpegoptim -w 12 --all-progressive --strip-all "{}" + find photos -name "*.jpg" -type f -exec jpegoptim -w 12 --all-progressive --strip-all "{}" +
# create the uugrn test calendar
calendar: calendar:
mkdir -p ${SITE}/uugcal mkdir -p ${SITE}/uugcal
cd ${SITE}/uugcal && sh ${SCRIPTS}/mkuugcalendar.sh > index.html cd ${SITE}/uugcal && sh ${SCRIPTS}/mkuugcalendar.sh > index.html
${PHOTODIRS}:
cd "$@" && sh ${SCRIPTS}/mkphotos.sh > index.html
# invoke zod and compile the website into the www/ dir # invoke zod and compile the website into the www/ dir
compile: compile:
mkdir -p ${WWW} mkdir -p ${WWW}
zod ${SITE} ${WWW} zod ${SITE} ${WWW}
# after mixing different generators in the compile step, let's tidy and # after mixing different generators in the compile step, let's tidy and
# indent the output properly (XXX is there a tool that does _only_ # indent the output properly. XXX is there a tool that does _only_
# indent?) # indent? We don't need all the other tidy magic here...
tidy: tidy:
find ${WWW} -type f -name "*.html" \ find ${WWW} -type f -name "*.html" \
-exec tidy -q -i -m -c -w 120 -f /dev/null {} \; -exec tidy -q -i -m -c -w 120 -f /dev/null {} \;
@ -54,17 +59,13 @@ fixperms:
doas chmod -R ugo+wrX,go-w ${WWW} doas chmod -R ugo+wrX,go-w ${WWW}
# we can upload to the local and the remote webserver at the same time # we can upload to the local and the remote webserver at the same time
upload-local: stagit upload-local:
doas rsync -a --delete ${WWW}/ ${LOCAL}/ doas rsync -a --delete ${WWW}/ ${LOCAL}/
upload-remote: stagit upload-remote:
doas rsync -a --delete -e ssh ${WWW}/ ${REMOTE}/ doas rsync -a --delete -e ssh ${WWW}/ ${REMOTE}/
upload-all: upload-local upload-remote upload-all: upload-local upload-remote
build: build: photos calendar stagit
make clean; \
make photos; \
make stagit; \
make calendar; \
make compile; \ make compile; \
make tidy; \ make tidy; \
make fixperms; make fixperms;

View File

@ -59,12 +59,12 @@ do
then then
echo "<h1>$TITLE</h1>" > "${_file_html}" echo "<h1>$TITLE</h1>" > "${_file_html}"
echo "<p>File: ${_file} (<a href=\"/photos/$DIR/${_file}\" target=_blank>Open Original</a>)</p>" >> "${_file_html}" echo "<p>File: ${_file} (<a href=\"/photos/$DIR/${_file}\" target=_blank>Open Original</a>)</p>" >> "${_file_html}"
echo "<p><img class=\"photo-mid\" src=\"/photos/$DIR/${_file_mid}\"></p>" >> "${_file_html}" echo "<p><img class=\"photo-mid\" alt=\"Preview Image ${_count}\" src=\"/photos/$DIR/${_file_mid}\"></p>" >> "${_file_html}"
[ -f "${_file_descr}" ] && cat "${_file_descr}" >> "${_file_html}" [ -f "${_file_descr}" ] && cat "${_file_descr}" >> "${_file_html}"
echo "<p><a href=index.html>Back to Index</a></p>" >> "${_file_html}" echo "<p><a href=index.html>Back to Index</a></p>" >> "${_file_html}"
fi fi
echo "<td class=\"photo-td\" ><a href=\"/photos/$DIR/${_file_html}\"><img class=\"photo-img\" src=\"${_file_thm}\"></a></td>" echo "<td class=\"photo-td\" ><a href=\"/photos/$DIR/${_file_html}\"><img alt=\"Thumbnail Image ${_count}\" class=\"photo-img\" src=\"${_file_thm}\"></a></td>"
if [ $(( _count % 3 )) -eq 0 ] if [ $(( _count % 3 )) -eq 0 ]
then then
echo "</tr><tr>" echo "</tr><tr>"

View File

@ -13,7 +13,7 @@ add_repo() {(
mkdir -p www/code/${_dir} mkdir -p www/code/${_dir}
cp site/code/*.{css,png} www/code/${_dir}/ cp site/code/*.{css,png} www/code/${_dir}/
cd www/code/${_dir} cd www/code/${_dir}
stagit -u https://stefanhagen.de/code ${_fulldir} stagit -u https://stefanhagen.de/code/ -l 100 ${_fulldir}
)} )}
mkdir -p code mkdir -p code