all repos — eureka @ 63a29748073b190bccad7cb745eed77c51f3000e

static site generator based on the 100r.co engine

added font templates, fixed return values; cleand up options; v2.0.0
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmPA7YUACgkQO3+8IhRO
Y5jD+hAAiORW3Jw3a5fqK+bwCoeZXHJfm0u2NlMAcXmBSoKNjnPMPXE80Z4GZoxJ
BKlj1aBjOyLahKZvHJJfqVYieppo0qGrS4zxCMDyzho2cL1y3DSXpE7xPg6767cD
LXBBkB/OLTsQIZwPBY/zR7XLjX1DYXmp+/vRK3dhYf+1FJ/Lkaf4tr8LCVRmOMEE
K8mu1ORJNcLuSWLL2XQUBJrr5tXe5+QPUrO5R3bKu4NqSgIXbuhY+wq2b+8iHkrH
RPFEUn00v6D/IsWuetfd37kcZcAv/XIswoz1c+8yExOEjieUr4bObdS5OTCbbh97
He/2lT9p/SGA/YlSH47cX1DPCcFtd+U7y4agzDVlXH8OixktgZM+ZMmsjhMVgXjm
gpidqpelpMY+lMJhykhv3NKIX+GYtJKVnV2uJpFHYEdgZLNdUwuW0PRAzNlklCwT
F9JUoyiZ6RKEPWM7lga2t6TqZDYNPqt3hGfL2AkkrCRsPViP3UdCfnx/H1iuBj7T
JtYZPM0R/D4aa3nxpTC0o3W8w1iy9DcXOWtDX7yaKuOtYrks2tdsO52V2SeF0SL6
S8Igx1NM3PLulHmxrmDtSVjIduGQ7+wF5pgxXDNcxqKQ5iSQPSrGWdJjLT5UMQRy
xrxHYPENK+2Tz7gfJAQZZeA0xf0ZL40f9IzMKeKlvWcvPK8W9CQ=
=uxFi
-----END PGP SIGNATURE-----
commit

63a29748073b190bccad7cb745eed77c51f3000e

parent

bccea6d1d8158bb539cce97f08299c04860388b6

4 files changed, 91 insertions(+), 74 deletions(-)

jump to
M README.mdREADME.md

@@ -81,7 +81,7 @@ // shorthand for bold

{@bold text} // shorthand for italic -{~italic text} +{\italic text} // shorthand for code {`short code}

@@ -96,7 +96,7 @@ // shorthand for blockquote

{>longer quote} // shorthand for strikethrough -{\crossed-out text} +{~crossed-out text} // shorthand for level 3 heading {!heading text}

@@ -112,6 +112,11 @@ {;}

// shorthand for publish date (renders as <time class='publish-date'>) {+2022-02-22} + +// shorthand for explicit monospace, sans, and serif font respecively: +{=some mono text} +{(some sans serif text} +{)some serif text} ``` # configuration

@@ -122,12 +127,15 @@ - **LEXICON_SIZE**: max size of the `Lexicon`, corresponds to the number of pages `eureka` can keep track of

- **TAG\_BODY\_SIZE**: max size for an individual markup body (ie, a markup token as above, minus the curly brackets and the rune), in bytes - **NAME**: the title of the site - **DOMAIN**: currently unused - - **LOGO**: HTML to put in the header h1 verbatim - - **ABOUT**: HTML content for the front page, placed between `<header>` and `<nav>` - - **CONTACT**: the contact info line at the bottom of every page (except the front page, where it would typically already be in **@ABOUT** - - **FOOTER**: arbitrary footer HTML - - **LICENSE**: the license link at the bottom of every page - - **SITEROOT**: the path where the rendered HTML is placed + - **LOGO_HTML**: HTML to put in the header h1 verbatim + - **ABOUT_HTML**: HTML content for the front page, placed between `<header>` and `<nav>` + - **CONTACT_HTML**: the contact info line at the bottom of every page (except the front page, where it would typically already be in **@ABOUT** + - **FOOTER_HTML**: arbitrary footer HTML + - **LICENSE_HTML**: the license link at the bottom of every page + - **SITEROOT**: the path where the rendered HTML is placed; include trailing slash - **MAINCSS** and **FRONTCSS**: to differentiate styles used for the landing page and the rest of the site + - **TWTXT**: path to the twtxt file relative to the SITEROOT; if you don't want twtxt on the front page, use a nonexistent filename +# deployment +Static sites are dead easy to deploy. Included in the repo is the deployment script I use - you can easily adapt this to your own use case.
M config.def.hconfig.def.h

@@ -1,39 +1,27 @@

-#define DESC "lair of drkste aka nilix: software artisan, digital philosopher" -#define LEXICON_SIZE 1024 -#define MAINCSS "/nilfm.css" -#define FOOTER \ - "<a href='/git/'><img src='/img/git.svg' " \ - "alt='nilFM hack " \ - "lab'/></a>&nbsp;\n" \ - "<a href='https://webring.xxiivv.com'><img src='/img/webring.svg' " \ - "alt='xxiivv webring'/></a>&nbsp;\n<a " \ - "href='https://lightcrystal.systems'><img " \ - "src='/img/lightcrystal_bw_small.svg' alt='lightcrystal.systems'/><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 CONTACT \ - "contact: <a href='mailto:nilix@nilfm.cc' " \ - "class='mono'>nilix@nilfm.cc</a> [<a " \ - "href='/serv/90587A740FA4FFA0971575383B7FBC22144E6398.asc' " \ - "class='mono'>0x90587A740FA4FFA0</a>]<br/>\n" \ - "" +/* clang-format off */ + +#define MAINCSS "/nilfm.css?v=20220112.1" #define DOMAIN "https://nilfm.cc" -#define FRONTCSS "/nilfm.css" -#define ABOUT \ - "Derek Stevens &lt;<a " \ - "href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a>&gt;<br/>\n" \ - "software artisan, digital philosopher<br/><br/>\n" \ - "[<a " \ - "href='/serv/90587A740FA4FFA0971575383B7FBC22144E6398.asc' " \ - "class='mono'>0x90587A740FA4FFA0" \ - "</a>]\n" -#define LOGO "<img src='/img/nilfm_blackHole_128.png' alt='blackhole://nilFM'/>" +#define LEXICON_SIZE 1024 +#define TWTXT "/twtxt.txt" +#define FRONTCSS "/nilfm.css?v=20220112.1" +#define CONTACT_HTML "contact: <a href='mailto:nilix@nilfm.cc' class='mono'>nilix@nilfm.cc</a> [<a href='/serv/90587A740FA4FFA0971575383B7FBC22144E6398.asc' class='mono'>0x90587A740FA4FFA0</a>]<br/>\n" \ +"" #define NAME "nilFM" -#define TWTXT "/twtxt.txt" -#define SEPARATEH1 0+#define TAG_BODY_SIZE 4096 +#define ABOUT_HTML "Derek Stevens &lt;<a class='mono' href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a>&gt;<br/>\n" \ +"software artisan, digital philosopher<br/><br/>\n" \ +"[<a href='/serv/90587A740FA4FFA0971575383B7FBC22144E6398.asc' class='mono'>0x90587A740FA4FFA0</a>]\n" \ +"" +#define FOOTER_HTML "<a href='/git/'><img src='/img/git.svg' alt='nilFM hack lab'/></a>&nbsp;\n" \ +"<a href='https://webring.xxiivv.com'><img src='/img/webring.svg' alt='xxiivv webring'/></a>&nbsp;\n" \ +"<a href='https://lightcrystal.systems'><img src='/img/lightcrystal_bw_small.svg' alt='lightcrystal.systems'/><br/>\n" \ +"<a href='/sitemap.html'>sitemap</a><br/>\n" \ +"" +#define LICENSE_HTML "<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 LOGO_HTML "<img src='/img/nilfm_blackHole_128.png' alt='blackhole://nilFM'/>" +#define DESC "lair of drkste aka nilix: software artisan, digital philosopher" +#define SITEROOT "../www/" + +/* clang-format on */
M main.cmain.c

@@ -389,25 +389,46 @@ fputs("</audio>\n", f);

return 1; } +int fpmono(FILE* f, Lexicon* l, char* s) { + fputs("<span style='font-family:monospace;'>", f); + int ret = fpmetatemplate(f, l, s); + fputs("</span>", f); + return ret; +} + +int fpserif(FILE* f, Lexicon* l, char* s) { + fputs("<span style='font-family:serif;'>", f); + int ret = fpmetatemplate(f, l, s); + fputs("</span>", f); + return ret; +} + +int fpsans(FILE* f, Lexicon* l, char* s) { + fputs("<span style='font-family:sans;'>", f); + int ret = fpmetatemplate(f, l, s); + fputs("</span>", f); + return ret; +} + int fppara(FILE* f, Lexicon* l, char* s) { fputs("<p>", f); - fpmetatemplate(f, l, s); + int ret = fpmetatemplate(f, l, s); fputs("</p>", f); - return 1; + return ret; } int fpul(FILE* f, Lexicon* l, char* s) { fputs("<ul>", f); - fpmetatemplate(f, l, s); + int ret = fpmetatemplate(f, l, s); fputs("</ul>", f); - return 1; + return ret; } int fpol(FILE* f, Lexicon* l, char* s) { fputs("<ol>", f); - fpmetatemplate(f, l, s); + int ret = fpmetatemplate(f, l, s); fputs("</ol>", f); - return 1; + return ret; } int fppublish(FILE* f, char* s) {

@@ -419,9 +440,9 @@ }

int fpli(FILE* f, Lexicon* l, char* s) { fputs("<li>", f); - fpmetatemplate(f, l, s); + int ret = fpmetatemplate(f, l, s); fputs("</li>", f); - return 1; + return ret; } int fph3(FILE* f, char* s) {

@@ -461,9 +482,9 @@ }

int fpstrike(FILE* f, Lexicon* l, char* s) { fputs("<s>", f); - fpmetatemplate(f, l, s); + int ret = fpmetatemplate(f, l, s); fputs("</s>", f); - return 1; + return ret; } int fppre(FILE* f, char* s) {

@@ -504,7 +525,7 @@ case '_':

return fpaudio(f, s + 1); case '`': return fpcode(f, s + 1); - case '~': + case '\\': return fpitalic(f, s + 1); case '>': return fpblock(f, s + 1);

@@ -514,7 +535,7 @@ case '$':

return fppre(f, s + 1); case '@': return fpbold(f, s + 1); - case '\\': + case '~': return fpstrike(f, l, s + 1); case '!': return fph3(f, s + 1);

@@ -536,6 +557,12 @@ case '|':

return fptbody(f, l, s + 1); case ';': return fptfoot(f); + case '=': + return fpmono(f, l, s + 1); + case '(': + return fpsans(f, l, s + 1); + case ')': + return fpserif(f, l, s + 1); } if (s[0]) { target = findf(l, s);

@@ -645,10 +672,10 @@ }

fputs("<footer>", f); if (!ismetanav(name)) { fpedited(f); - fputs(CONTACT, f); + fputs(CONTACT_HTML, f); } - fputs(FOOTER, f); - fputs(LICENSE, f); + fputs(FOOTER_HTML, f); + fputs(LICENSE_HTML, f); fputs("</footer>", f); return 1; }

@@ -680,15 +707,9 @@ ismetanav(name) ? "home" : name);

fputs("</head>\n", f); fputs("<body>\n", f); /* header */ - if (SEPARATEH1) { - fputs("<header>\n", f); - if (ismetanav(name)) { - fputs("<h1>" LOGO "</h1>\n", f); - } else { - fputs("<a href='/'><h1>" LOGO "</h1></a>\n", f); - } - fputs("</header>\n", f); - } + fputs("<header>\n", f); + fputs("<a href='/'><h1>" LOGO_HTML "</h1></a>\n", f); + fputs("</header>\n", f); /* nav */ fputs("<nav>\n", f); if (!fpportal(f, l, "meta.nav", 0))

@@ -705,7 +726,7 @@ printf(">>> Building failed: %s\n", name);

fputs("\n</main>", f); } else { /* about & twtxt (main page only) */ - fputs("<div id='about'>" ABOUT "</div>\n", f); + fputs("<div id='about'>" ABOUT_HTML "</div>\n", f); gettwtxt(f); } /* footer */
M tw.shtw.sh

@@ -1,13 +1,13 @@

#!/bin/sh -twtxt=../www/twtxt.txt - +siteroot=$(grep "#define SITEROOT" config.h | awk '{print $3}' | sed -e 's/"//g') +twtxt=$(grep "#define TWTXT" config.h | awk '{print $3}' | sed -e 's/"//g') twt(){ self=$(mktemp) new=$(mktemp) echo "$(date -Is)\t$@" > ${self} - cat ${self} ${twtxt} > ${new} - cp ${new} ${twtxt} + cat ${self} ${siteroot}${twtxt} > ${new} + cp ${new} ${siteroot}${twtxt} rm ${new} rm ${self} }