more liberal use of macros for better customizability

This commit is contained in:
Iris Lightshard 2021-10-06 13:51:53 -06:00
parent acc2de6dd7
commit 20c9d6b8bd
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398

52
main.c
View file

@ -19,11 +19,25 @@ WITH REGARD TO THIS SOFTWARE.
#define NAME "nilFM"
#define DOMAIN "https://nilfm.cc"
#define DESC "lair of drkste aka nilix: programmer, artist, philosopher"
#define ABOUT "Derek Stevens <"\
"<a href='mailto://nilix@nilfm.cc'>nilix@nilfm.cc</a>&gt;<br/>"\
"artist, programmer, philosopher<br/><br/>"\
"verify my signature: <a href='/serv/signingKey.pub'>signing public key</a><br/>"\
"send me an encrypted message: <a href='/serv/encryptionKey.pub'>encryption public key</a>"
#define CONTACT "contact: <a href='mailto://nilix@nilfm.cc'>nilix@nilfm.cc</a> (<a href='keys.html'>keys</a>)<br/>"
#define FOOTER1 "<a href='/git/'><img width='24' height='24' "\
"src='/img/git.svg' alt='visit the nilFM hack lab'/></a>&nbsp;"\
"<a rel='me' href='https://fosstodon.org/@nilix'><img width='24' "\
"height='24' "\
"src='/img/mastodon.svg' alt='visit me on Mastodon'/></a>&nbsp;"\
"<a href='https://vimeo.com/rexnillith'><img width='24' height='24' "\
"src='/img/vimeo.svg' alt='visit me on Vimeo'/></a>&nbsp;"
#define FOOTER2 "<a href='https://webring.xxiivv.com'><img width='24' height='24' "\
"src='/img/webring.svg' alt='visit the Webring'/></a><br/>"\
"<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"
@ -331,35 +345,10 @@ int fpfooter(FILE* f, char* name, char* path) {
fputs("<footer>", f);
if (!ismetanav(name)) {
fpedited(f, path);
fputs("contact: <a href='mailto://nilix@nilfm.cc'>nilix@nilfm.cc</a> ", f);
fputs("(<a href='keys.html'>keys</a>)<br/>", f);
fputs(CONTACT, 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><br/>",
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(FOOTER1, f);
fputs(FOOTER2, f);
fputs("</footer>", f);
return 1;
}
@ -375,7 +364,7 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) {
"<meta charset='utf-8'>"
"<meta name='description' content='%s'/>"
"<meta name='viewport' content='width=device-width,initial-scale=1'>",
"lair of drkste aka nilix: programmer, artist, philosopher");
DESC);
if (ismetanav(name)) {
fputs("<link rel='stylesheet' type='text/css' href='" FRONTCSS "'>", f);
} else {
@ -391,9 +380,9 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) {
/* header */
fputs("<header>", f);
if (ismetanav(name)) {
fputs("<h1>nilFM</h1>", f);
fputs("<h1>" NAME "</h1>", f);
} else {
fputs("<h1><a href='/'>nilFM</a></h1>", f);
fputs("<h1><a href='/'>" NAME "</a></h1>", f);
}
fputs("</header>", f);
@ -409,7 +398,6 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) {
/* main */
if (!ismetanav(name)) {
fputs("<main>\n\n", f);
fputs("<!-- Generated file, do not edit -->\n\n", f);
fprintf(f, "<h2>%s</h2>", name);
if (!fpinject(f, l, srcpath))
printf(">>> Building failed: %s\n", name);