all repos — eureka @ 6ed62214617c10c33370c16e981213e77be1e9ad

static site generator based on the 100r.co engine

add twtxt feed and tweak footer
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmDLAl0ACgkQO3+8IhRO
Y5hVUg//VeBzu8IqKcX5/X5r5c1NwkuvL+ycNObUpzRiZjAO+s5W/GnoTwRyFywz
S2Tb3niMszAXzyNwcUR9dsmOyUDTiNeN7iPd0y6xDSwKLTxwCn/7IafwPpnfFMc5
EdQi19NTkzlOEWCxszJ03a8NDMNM5Q0+Y8qWQQwHmSN1olgmdC1NJ2Hmxp7O7KuK
Y3flkMrB69dxAL5oCD9ZLbMMtYCC5Q+HBm+L05bRmRltfBzzIHAl1shBwLzmDzrC
W9wfyvmrMv9xd6i8aEZtK3+TqUGXquTPWzj0b92FSOXjlpO9CAi8Io1x5DD578EU
FYhSkCD/CqYT8bHXyTo5dCJqoBnUw1qxETuAX/S9S+9+CNCGl84xCvFga++dY/EX
dda9fqeyer+ScqRigeRvJ9JL8GtRIxqE9Pf8YRnGEvLe87gcgqZb/09CN3w+GuPd
pZaphMcUHBX3k9wOALD5DzL0KzedV+LxikfA6vBcSMUQO2exv95wO7uETmUDHzXB
tRRXNuY7zCV/O8xIC9qyeLZBycf3KPfj0E6csf4Sfce3QA7gxPoxEDk4UH/4XQHS
VICAm9WIWrdVQ4O0XlI1XHMHB5i77xCtXBSfApRFKMhq9SMs1tsnztfY+0HfSvsk
2zTLuPsVJHOo06CzBaIzVEmh1mBzHne+9zI+atw9goeBjPstFEo=
=ZKxq
-----END PGP SIGNATURE-----
commit

6ed62214617c10c33370c16e981213e77be1e9ad

parent

894b72e5f24d7a554724ecc89be84ae971f7aa28

1 files changed, 53 insertions(+), 4 deletions(-)

jump to
M main.cmain.c

@@ -3,7 +3,6 @@ #include <stdio.h>

#include <sys/stat.h> #include <sys/types.h> #include <time.h> - /* Copyright (c) 2021 Derek Stevens Copyright (c) 2021 Devine Lu Linvega

@@ -74,6 +73,41 @@ for (i = 0; i < l->len; ++i)

if (scmp(l->files[i], filename)) return i; return -1; +} + +int gettwtxt(FILE* f) { + char buf[1024] = {0}; + char line[256]; + char datebuf[16] = {0}; + char msgbuf[240] = {0}; + char* l; + FILE* twtxt = fopen(SITEROOT "twtxt.txt", "r"); + + scat(buf, "<div id='twtxtFeed'><h2>recent activity:</h2>"); + if (!twtxt) { + error("Get twtxt feed", "no twtxt.txt"); + return 0; + } else { + int i = 0; + while (fgets(line, 256, twtxt) && i < 3) { + l = line; + while (*l != 'T') { + ccat(datebuf, *l++); + } + while (*l != '\t') { + l++; + } + scat(msgbuf, l); + scat(buf, datebuf); + scat(buf, ": "); + scat(buf, msgbuf); + scat(buf, "<br/>"); + i++; + } + scat(buf, "</div>"); + fputs(buf, f); + return 1; + } } void fpedited(FILE* f, char* path) {

@@ -293,13 +327,26 @@ f);

fputs("(<a href='keys.html'>keys</a>)<br/>", f); } fputs( + "<a href='" DOMAIN "/git/'><img width='24' height='24' " + "src='/img/git.svg' alt='visit the nilFM hack lab'/></a>&nbsp;", + f); + fputs( + "<a rel=\"me\" href=\"https://fosstodon.org/@nilix\"><img width='24' " + "height='24' " + "src='/img/mastodon.svg' alt='visit me on Mastodon'/></a>&nbsp;", + f); + fputs( + "<a href='https://vimeo.com/rexnillith'><img width='24' height='24' " + "src='/img/vimeo.svg' alt='visit me on Vimeo'/></a>&nbsp;", + f); + fputs( "<a href='https://webring.xxiivv.com'><img width='24' height='24' " - "src='/img/webring.svg' alt='visit the webring'/></a>&nbsp;", + "src='/img/webring.svg' alt='visit the Webring'/></a><br/>", f); - fputs( + /*fputs( "<a href='https://lieu.cblgh.org'><img width='24' height='24' " "src='/img/lieu.svg' alt='search the webring'/></a><br/>", - f); + f);*/ fputs( "<a rel='license' " "href='https://creativecommons.org/licenses/by-nc/4.0/"

@@ -359,6 +406,8 @@ fprintf(f, "<h2>%s</h2>", name);

if (!fpinject(f, l, srcpath)) printf(">>> Building failed: %s\n", name); fputs("\n\n</main>", f); + } else { + gettwtxt(f); } /* footer */ if (!fpfooter(f, name, srcpath)) {