all repos — eureka @ 0c611817344adaae15dace23104af4a073e76d31

static site generator based on the 100r.co engine

main: update footer, add webring/lieu icons; thumbnailer: skip zips too, update printed messages
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQJDBAABCAAtFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmCoBpMPHG5pbGl4QG5p
bGZtLmNjAAoJEDt/vCIUTmOYf28P/2g/ZtUoEBMoENjosSyopclbDHZ81bZreDE+
uPtdwYPT8uBI9Ud5fs/+oUpG5sLLwJjCSdkXiA2tDoJDtfFeQCnwPOSf7KmVNh/T
cXlzmzsGYCw0N267d/7xIo7u1fgN6D5M6A75JjMudLH6Tb95782IczXaafcMrM0V
Pkh3VyOkfQhFPvHpFfo/dBLo079uSNGW61EgyjHfSktnkTeB1N7MsHGzfM6o23oY
2bD4zWz4Mr7NFfRT6W+mofZxisiuwS/qRABXK/DERuf8/7urmqiJZHDzmNX1QITl
P+WcGVFRZqhdavf6apT7o/9WY24jmQ39R2XG1SOva/Qhl+bvyn4rZHdkrrw335BC
I/rYhoHv+q3fe2o1wHzvFbI1D5IFKc74cKxWrweDGaM/wh+kh/XoSA4jWUjIRo0B
qrW3c+nymAkKoz1A2dRij698zmj5TF3+sEEbpLUT/IDJVOQS+pWjErpOGuzeFGgr
i4rV6GsPxfZQSWnF64E4XesUhPnnAsUR0uPYXHbzGl6bWDmWMs+3E4237xNLd2J5
NlF1+78ilIDZPMNElPqjlxPe23/w/5fo04F10pHipVAmcbzXF2HwH/YGcevsRa11
gXTvsDIeszve+Wb3mJglfm804WcKdE4jIOs5IBDI7qLmU9wfg41fRrKbAXq+we4m
WnLDjfwe
=cifq
-----END PGP SIGNATURE-----
commit

0c611817344adaae15dace23104af4a073e76d31

parent

2b5d9a3416b4ee27d482bcd06f4102b6f89601ce

2 files changed, 39 insertions(+), 20 deletions(-)

jump to
M main.cmain.c

@@ -79,9 +79,7 @@

void fpedited(FILE* f, char* path) { struct stat attr; stat(path, &attr); - fputs("<span style='float:right'>", f); - fprintf(f, "Edited on %s ", ctime(&attr.st_mtime)); - fputs("</span>", f); + fprintf(f, "Edited on %s<br/>", ctime(&attr.st_mtime)); } int fpportal(FILE* f, Lexicon* l, char* s, int head) {

@@ -283,6 +281,34 @@ fclose(inc);

return 1; } +int fpfooter(FILE* f, char* name, char* path) { + if (!f || !name || !path) + return 0; + fputs("<footer>", f); + if (!ismetanav(name)) { + fpedited(f, path); + fputs( + "contact: <a href='mailto://drkste@zoho.com'>drkste@zoho.com</a> ", + f); + fputs("(<a href='keys.html'>keys</a>)<br/>", f); + } + fputs( + "<a href='https://webring.xxiivv.com'><img width='24' height='24' " + "src='/img/webring.svg' alt='visit the webring'/></a>&nbsp;", + f); + fputs( + "<a href='https://lieu.cblgh.org'><img width='24' height='24' " + "src='/img/lieu.svg' alt='search the webring'/></a><br/>", + f); + fputs( + "<a rel='license' " + "href='https://creativecommons.org/licenses/by-nc/4.0/" + "legalcode.txt'>CC-BY-NC 4</a>", + f); + fputs("</footer>", f); + return 1; +} + FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) { if (!f) return f;

@@ -333,16 +359,12 @@ fprintf(f, "<h2>%s</h2>", name);

if (!fpinject(f, l, srcpath)) printf(">>> Building failed: %s\n", name); fputs("\n\n</main>", f); - /* footer */ - fputs("<footer>", f); - fpedited(f, srcpath); - fputs( - "contact: <a href='mailto://drkste@zoho.com'>drkste@zoho.com</a> ", - f); - fputs("(<a href='keys.html'>keys</a>)", f); - /* fputs("<a href='" LICENSE "' target='_blank'>BY-NC-SA 4.0</a>", f) */; - fputs("</footer>", f); + } + /* footer */ + if (!fpfooter(f, name, srcpath)) { + printf(">>> Building failed: footer(%s)\n", name); } + /* end */ fputs("</body></html>", f); return f;
M thumbnailer.shthumbnailer.sh

@@ -1,6 +1,5 @@

#!/bin/sh -ROOT=../www SRC=../www/img SIZE=500

@@ -19,27 +18,25 @@

# generate thumbnails in /img/*/.thumb/ resize() { output=$(pathtrans $1) - if echo $1 | grep .gif > /dev/null; then + if echo $1 | grep -e .gif -e .zip > /dev/null; then return fi if [ ! -f ${output} ]; then - echo "generating thumbnail for $1" + echo "Generating thumbnail for $1" convert $1 -strip -auto-orient -resize ${SIZE} -dither FloydSteinberg -colors 16 ${output} fi } - - if [ -z $1 ]; then echo "usage: $0 [build|clean]" else case $1 in "build") - echo "creating new thumbnails" + echo "Updating thumbnails cache" for x in $(find ${SRC}/*/*); do resize $x; done;; "clean") - echo "cleaning thumbnails cache" + echo "Cleaning thumbnails cache" rm -rf ${SRC}/*/.thumb - echo "cleaned";; + echo "Cleaned";; esac fi