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
@echo "done."
# Create the photo galleries and create the index and preview html
# pages in site/, so they get parsed in the compile step
# Create the photo galleries and create the index and preview html pages.
PHOTODIRS != find photos/* -maxdepth 0 -mindepth 0 -type d
photos: ${PHOTODIRS}
mkdir -p ${SITE}/photos
cd photos && sh ${SCRIPTS}/mkphotoindex.sh > index.html
find photos -type f -not -name "*.html" -exec install -D {} www/{} \;
find photos -type f -name "*.html" -exec install -D {} site/{} \;
find photos -type f \( -not -name "*.html" \
-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:
find photos -name "*.jpg" -type f -exec jpegoptim -w 12 --all-progressive --strip-all "{}" +
# create the uugrn test calendar
calendar:
mkdir -p ${SITE}/uugcal
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
compile:
mkdir -p ${WWW}
zod ${SITE} ${WWW}
# 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?)
# indent the output properly. XXX is there a tool that does _only_
# indent? We don't need all the other tidy magic here...
tidy:
find ${WWW} -type f -name "*.html" \
-exec tidy -q -i -m -c -w 120 -f /dev/null {} \;
@ -54,17 +59,13 @@ fixperms:
doas chmod -R ugo+wrX,go-w ${WWW}
# 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}/
upload-remote: stagit
upload-remote:
doas rsync -a --delete -e ssh ${WWW}/ ${REMOTE}/
upload-all: upload-local upload-remote
build:
make clean; \
make photos; \
make stagit; \
make calendar; \
build: photos calendar stagit
make compile; \
make tidy; \
make fixperms;

View File

@ -59,12 +59,12 @@ do
then
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><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}"
echo "<p><a href=index.html>Back to Index</a></p>" >> "${_file_html}"
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 ]
then
echo "</tr><tr>"

View File

@ -13,7 +13,7 @@ add_repo() {(
mkdir -p www/code/${_dir}
cp site/code/*.{css,png} 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