all repos — eureka @ 9c134385629287d38a624301822b378cdb70d2d9

static site generator based on the 100r.co engine

add sitemap, update build to play nice with nirvash
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmKnQUgACgkQO3+8IhRO
Y5jAGQ//U0b5Vk9YMH4B3A6FfzOuK9re2VUTt6qqCw5bBljr9qmienh5NPFK2CP3
AF5fHQwvQ8VuD61lakOXbbi5jMlRjQpc+0iOOfO5oMI4nFXZftXYwYRamG1rZ0kB
s0k9Z7Ji7g7D2evMrBnvsuvPvhMV9GslHFQ6hFD/a1oN+Zo4ikCNRciif8Mquu7f
mEkocwTg5JHHbHqExl6cMcbRTqQ1CA7UsZuuOskbP1zrfSycoK3iMga5PhO+oOd9
3t9s4IhoK1tjZyOVcQ3wge8BZSFVmi8TyFRD1naT/3mZL8FqcjHQ2hPUpudlqWCx
3AOCl/LjICQc1b74R1rLtCSFPLuIy2k5yVVmi1o4RogcoOiV84PfOCgNO3yXrsjX
cOWZZIaz0xKutlp2PsUOuHpwPc8NmgtfTvWMgs6WBYzJc2aL5QdhR7YfmSFmM+MZ
+ONyRDHD9I2rut49AzBz/MuEqogGWi1oaXPxxAHq1SEg7j69OXdDxxRJMdILiBgA
FVzhBTG6G+wjRnUD/cnx4CF/61OW1NB6ruB1lJmj5KmBVksYYqAuVg0aSeR4IH2E
WXsloydmGZ2DqHtZn9ZOPk30M9OmTKggCvYcyYDgWB1Vdx5Fyv7eBuPxGAZ7y4Qu
zvbVpWtNyN1duTC4a+Bzv2nFamO1EQ6kV15MS775jsKzzzG40Sk=
=xJbb
-----END PGP SIGNATURE-----
commit

9c134385629287d38a624301822b378cdb70d2d9

parent

1e232e2b9a7ce4dbe73773b7cd9123cc15d7e9ad

4 files changed, 82 insertions(+), 26 deletions(-)

jump to
M .gitignore.gitignore

@@ -1,3 +1,4 @@

inc/ old/ config.h +map.htm
M build.shbuild.sh

@@ -22,7 +22,7 @@ # Cleanup

rm -f ./main # Linux(debug) -# cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wuninitialized -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined main.c -o main +#cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wuninitialized -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined main.c -o main # Linux(fast) cc main.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o main

@@ -47,10 +47,11 @@ fi

./main exitstatus=$? if [ "${exitstatus}" = "0" ]; then - ./thumbnailer.sh build & + echo "Generating thumbnails in the background" + (./thumbnailer.sh build > /dev/null 2>&1) & fi # Cleanup rm -f ./main -exit ${exitstatus}+exit ${exitstatus}
M config.def.hconfig.def.h

@@ -1,25 +1,37 @@

+#define DESC "lair of drkste aka nilix: artist, programmer, philosopher" #define LEXICON_SIZE 1024 +#define MAINCSS "/new.css" +#define FOOTER \ + "<a href='/git/'><img src='/img/git.svg' alt='visit the nilFM hack " \ + "lab.'/></a>&nbsp;\n" \ + "<a rel='me' href='https://cafe.nilfm.cc/u/nilix'><img src='/img/honk.svg' " \ + "alt='visit me on the Fediverse.'/></a>&nbsp;\n" \ + "<a href='https://webring.xxiivv.com'><img src='/img/webring.svg' " \ + "alt='visit the Webring.'/></a><br/>\n" \ + "<a href='/sitemap.html'>sitemap</a><br/>\n" +#define LICENSE \ + "<a rel='license' " \ + "href='https://creativecommons.org/licenses/by-nc/4.0/" \ + "legalcode.txt'>CC-BY-NC 4</a><br/>\n" \ + "<a href='/legal_disclaimer.html'>opinions are my own</a>" +#define SITEROOT "../www/" #define TAG_BODY_SIZE 4096 - -#define NAME "nilFM" +#define CONTACT \ + "contact: <a href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a> (<a " \ + "href='keys.html'>keys</a>)<br/>\n" \ + "" #define DOMAIN "https://nilfm.cc" -#define LOGO "<img src='/img/nilfm_blackHole_96.png' alt='blackHole://server'/>" -#define DESC "lair of drkste aka nilix: programmer, artist, philosopher" -#define ABOUT "Derek Stevens &lt;"\ - "<a href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a>&gt;<br/>\n"\ - "artist, programmer, philosopher<br/><br/>\n"\ - "verify my signature: <a href='/serv/signingKey.pub'>signing public key</a><br/>\n"\ - "send me an encrypted message: <a href='/serv/encryptionKey.pub'>encryption public key</a>\n" -#define CONTACT "contact: <a href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a> (<a href='keys.html'>keys</a>)<br/>\n" -#define FOOTER "<a href='/git/'><img "\ - "src='/img/git.svg' alt='visit the nilFM hack lab.'/></a>&nbsp;\n"\ - "<a rel='me' href='https://cafe.nilfm.cc/u/nilix'><img "\ - "src='/img/honk.svg' alt='visit me on the Fediverse.'/></a>&nbsp;\n"\ - "<a href='https://webring.xxiivv.com'><img "\ - "src='/img/webring.svg' alt='visit the Webring.'/></a><br/>\n" -#define LICENSE "<a rel='license' "\ - "href='https://creativecommons.org/licenses/by-nc/4.0/"\ - "legalcode.txt'>CC-BY-NC 4</a>" -#define SITEROOT "../www/" -#define MAINCSS "/new.css" #define FRONTCSS "/front.css" +#define ABOUT \ + "Derek Stevens &lt;<a " \ + "href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a>&gt;<br/>\n" \ + "artist, programmer, philosopher<br/><br/>\n" \ + "verify my signature: <a " \ + "href='/serv/90587A740FA4FFA0971575383B7FBC22144E6398.asc'>signing public " \ + "key</a><br/>\n" \ + "send me an encrypted message: <a " \ + "href='/serv/F5672E001CC962BE3B6C8887C65B677280C66DE5.asc'>encryption " \ + "public key</a>\n" \ + "" +#define LOGO "<img src='/img/nilfm_blackHole_96.png' alt='blackHole://server'/>" +#define NAME "nilFM"
M main.cmain.c

@@ -1,7 +1,9 @@

-#include <dirent.h> +#define _GNU_SOURCE + #include <stdio.h> +#include <stdlib.h> +#include <sys/dir.h> #include <sys/stat.h> -#include <sys/types.h> #include <time.h> #include "config.h"

@@ -623,6 +625,45 @@ if (!l->refs[i])

error("Orphaned", l->files[i]); } +void map(Lexicon* l) { + char dstpath[64]; + char srcpath[64]; + struct dirent** d; + FILE* siteMap; + int n, i = 0; + n = scandir("inc", &d, NULL, alphasort); + if (n < 0) + return; + dstpath[0] = 0; + srcpath[0] = 0; + scat(dstpath, SITEROOT); + scat(dstpath, "sitemap.html"); + scat(srcpath, "map.htm"); + siteMap = fopen("map.htm", "w"); + /* don't use shorthand for the <ul> tag because it will easily overflow + * TAG_BODY_SIZE */ + fprintf(siteMap, "<ul>\n"); + while (i < n) { + char filepath[64], filename[64]; + if (d[i]->d_name[0] != '.') { + scpy(d[i]->d_name, filepath, 64); + fprintf( + siteMap, + " {-{%s}}\n", + scsw( + scpy(d[i]->d_name, filename, ssin(d[i]->d_name, ".htm") + 1), + '_', + ' ')); + } + free(d[i++]); + } + free(d); + fprintf(siteMap, "</ul>\n"); + fclose(siteMap); + fclose(build(fopen(dstpath, "w"), l, "sitemap", srcpath)); + printf("Created sitemap\n"); +} + int main(void) { Lexicon lex; DIR* d;

@@ -633,6 +674,7 @@ if (!index(&lex, d))

return error("Indexing", "Failed"); if (!generate(&lex)) return error("Generating", "Failed"); + map(&lex); inspect(&lex); return 0; }