use more newlines in generated source, we can spare the bytes to make things readable
This commit is contained in:
parent
e1d19dc2a0
commit
3558233dd5
2 changed files with 44 additions and 40 deletions
16
config.def.h
16
config.def.h
|
@ -6,17 +6,17 @@
|
||||||
#define LOGO "<img src='/img/nilfm_blackHole_96.png' alt='blackHole://server'/>"
|
#define LOGO "<img src='/img/nilfm_blackHole_96.png' alt='blackHole://server'/>"
|
||||||
#define DESC "lair of drkste aka nilix: programmer, artist, philosopher"
|
#define DESC "lair of drkste aka nilix: programmer, artist, philosopher"
|
||||||
#define ABOUT "Derek Stevens <"\
|
#define ABOUT "Derek Stevens <"\
|
||||||
"<a href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a>><br/>"\
|
"<a href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a>><br/>\n"\
|
||||||
"artist, programmer, philosopher<br/><br/>"\
|
"artist, programmer, philosopher<br/><br/>\n"\
|
||||||
"verify my signature: <a href='/serv/signingKey.pub'>signing public key</a><br/>"\
|
"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>"
|
"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/>"
|
#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 "\
|
#define FOOTER "<a href='/git/'><img "\
|
||||||
"src='/img/git.svg' alt='visit the nilFM hack lab.'/></a> "\
|
"src='/img/git.svg' alt='visit the nilFM hack lab.'/></a> \n"\
|
||||||
"<a rel='me' href='https://cafe.nilfm.cc/u/nilix'><img "\
|
"<a rel='me' href='https://cafe.nilfm.cc/u/nilix'><img "\
|
||||||
"src='/img/honk.svg' alt='visit me on the Fediverse.'/></a> "\
|
"src='/img/honk.svg' alt='visit me on the Fediverse.'/></a> \n"\
|
||||||
"<a href='https://webring.xxiivv.com'><img "\
|
"<a href='https://webring.xxiivv.com'><img "\
|
||||||
"src='/img/webring.svg' alt='visit the Webring.'/></a><br/>"
|
"src='/img/webring.svg' alt='visit the Webring.'/></a><br/>\n"
|
||||||
#define LICENSE "<a rel='license' "\
|
#define LICENSE "<a rel='license' "\
|
||||||
"href='https://creativecommons.org/licenses/by-nc/4.0/"\
|
"href='https://creativecommons.org/licenses/by-nc/4.0/"\
|
||||||
"legalcode.txt'>CC-BY-NC 4</a>"
|
"legalcode.txt'>CC-BY-NC 4</a>"
|
||||||
|
|
68
main.c
68
main.c
|
@ -69,7 +69,7 @@ int gettwtxt(FILE* f) {
|
||||||
char *l, *d, *m;
|
char *l, *d, *m;
|
||||||
FILE* twtxt = fopen(SITEROOT "twtxt.txt", "r");
|
FILE* twtxt = fopen(SITEROOT "twtxt.txt", "r");
|
||||||
|
|
||||||
scat(buf, "<div id='twtxtFeed'><h2>recent activity:</h2><table>");
|
scat(buf, "<div id='twtxtFeed'><h2>recent activity:</h2>\n<table>\n");
|
||||||
if (!twtxt) {
|
if (!twtxt) {
|
||||||
error("Get twtxt feed", "no twtxt.txt");
|
error("Get twtxt feed", "no twtxt.txt");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -88,7 +88,7 @@ int gettwtxt(FILE* f) {
|
||||||
scat(buf, datebuf);
|
scat(buf, datebuf);
|
||||||
scat(buf, ":</td><td> ");
|
scat(buf, ":</td><td> ");
|
||||||
scat(buf, msgbuf);
|
scat(buf, msgbuf);
|
||||||
scat(buf, "</td></tr>");
|
scat(buf, "</td></tr>\n");
|
||||||
d = datebuf;
|
d = datebuf;
|
||||||
while (*d) {
|
while (*d) {
|
||||||
*d++ = 0;
|
*d++ = 0;
|
||||||
|
@ -100,8 +100,8 @@ int gettwtxt(FILE* f) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
fclose(twtxt);
|
fclose(twtxt);
|
||||||
scat(buf, "</table><a href='/twtxt.txt'>see all</a>");
|
scat(buf, "</table><a href='/twtxt.txt'>see all</a>\n");
|
||||||
scat(buf, "</div>");
|
scat(buf, "</div>\n");
|
||||||
fputs(buf, f);
|
fputs(buf, f);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ int fpportal(FILE* f, Lexicon* l, char* s, int head) {
|
||||||
if (head)
|
if (head)
|
||||||
fprintf(
|
fprintf(
|
||||||
f,
|
f,
|
||||||
"<h3 id='%s'><a href='%s.html'>%s</a></h3>",
|
"<h3 id='%s'><a href='%s.html'>%s</a></h3>\n",
|
||||||
scsw(filename, ' ', '_'),
|
scsw(filename, ' ', '_'),
|
||||||
filename,
|
filename,
|
||||||
s);
|
s);
|
||||||
|
@ -210,7 +210,7 @@ int fpimg(FILE* f, char* s) {
|
||||||
thumbtrans(src, thumb);
|
thumbtrans(src, thumb);
|
||||||
fprintf(f, "<a id='%s' href='%s'>\n", id, src);
|
fprintf(f, "<a id='%s' href='%s'>\n", id, src);
|
||||||
fprintf(f, "<img class='image' src='%s' alt='%s'/>\n", thumb, alt);
|
fprintf(f, "<img class='image' src='%s' alt='%s'/>\n", thumb, alt);
|
||||||
fputs("</a>", f);
|
fputs("</a>\n", f);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,14 +249,18 @@ int fphimg(FILE* f, char* s) {
|
||||||
|
|
||||||
fprintf(f, "<a id='%s' href='%s'>\n", id, href);
|
fprintf(f, "<a id='%s' href='%s'>\n", id, href);
|
||||||
fprintf(f, "<img class='image' src='%s' alt='%s'/>\n", thumb, alt);
|
fprintf(f, "<img class='image' src='%s' alt='%s'/>\n", thumb, alt);
|
||||||
fputs("</a>", f);
|
fputs("</a>\n", f);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fpaudio(FILE* f, char* s) {
|
int fpaudio(FILE* f, char* s) {
|
||||||
fputs("<audio class='player' preload='metadata' controls>", f);
|
fputs("<audio class='player' preload='metadata' controls>\n", f);
|
||||||
fprintf(f, "<source src='%s' type='audio/mpeg'>[HTML5 audio]", s);
|
fprintf(
|
||||||
fputs("</audio>", f);
|
f,
|
||||||
|
"<source src='%s' type='audio/mpeg'>[<a href='%s'>HTML5 audio</a>]\n",
|
||||||
|
s,
|
||||||
|
s);
|
||||||
|
fputs("</audio>\n", f);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,51 +520,51 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) {
|
||||||
if (!f)
|
if (!f)
|
||||||
return f;
|
return f;
|
||||||
/* begin */
|
/* begin */
|
||||||
fputs("<!DOCTYPE html><html lang='en'>", f);
|
fputs("<!DOCTYPE html>\n<html lang='en'>\n", f);
|
||||||
fputs("<head>", f);
|
fputs("<head>\n", f);
|
||||||
fprintf(
|
fprintf(
|
||||||
f,
|
f,
|
||||||
"<meta charset='utf-8'>"
|
"<meta charset='utf-8'>\n"
|
||||||
"<meta name='description' content='%s'/>"
|
"<meta name='description' content='%s'/>\n"
|
||||||
"<meta name='viewport' content='width=device-width,initial-scale=1'>",
|
"<meta name='viewport' content='width=device-width,initial-scale=1'>\n",
|
||||||
DESC);
|
DESC);
|
||||||
if (ismetanav(name)) {
|
if (ismetanav(name)) {
|
||||||
fputs("<link rel='stylesheet' type='text/css' href='" FRONTCSS "'>", f);
|
fputs("<link rel='stylesheet' type='text/css' href='" FRONTCSS "'>\n", f);
|
||||||
} else {
|
} else {
|
||||||
fputs("<link rel='stylesheet' type='text/css' href='" MAINCSS "'>", f);
|
fputs("<link rel='stylesheet' type='text/css' href='" MAINCSS "'>\n", f);
|
||||||
}
|
}
|
||||||
fprintf(
|
fprintf(
|
||||||
f,
|
f,
|
||||||
"<link rel='shortcut icon' href='/favicon.ico'>"
|
"<link rel='shortcut icon' href='/favicon.ico'>\n"
|
||||||
"<title>" NAME " — %s</title>",
|
"<title>" NAME " — %s</title>\n",
|
||||||
ismetanav(name) ? "home" : name);
|
ismetanav(name) ? "home" : name);
|
||||||
fputs("</head>", f);
|
fputs("</head>\n", f);
|
||||||
fputs("<body>", f);
|
fputs("<body>\n", f);
|
||||||
/* header */
|
/* header */
|
||||||
fputs("<header>", f);
|
fputs("<header>\n", f);
|
||||||
if (ismetanav(name)) {
|
if (ismetanav(name)) {
|
||||||
fputs("<h1>" NAME "</h1>", f);
|
fputs("<h1>" NAME "</h1>\n", f);
|
||||||
} else {
|
} else {
|
||||||
fputs("<h1><a href='/'>" NAME "</a></h1>", f);
|
fputs("<h1><a href='/'>" NAME "</a></h1>\n", f);
|
||||||
}
|
}
|
||||||
|
|
||||||
fputs("</header>", f);
|
fputs("</header>\n", f);
|
||||||
/* about (main page only) */
|
/* about (main page only) */
|
||||||
if (ismetanav(name)) {
|
if (ismetanav(name)) {
|
||||||
fputs("<div id='about'>" ABOUT "</div>", f);
|
fputs("<div id='about'>" ABOUT "</div>\n", f);
|
||||||
}
|
}
|
||||||
/* nav */
|
/* nav */
|
||||||
fputs("<nav>", f);
|
fputs("<nav>\n", f);
|
||||||
if (!fpportal(f, l, "meta.nav", 0))
|
if (!fpportal(f, l, "meta.nav", 0))
|
||||||
printf(">>> Building failed: %s\n", name);
|
printf(">>> Building failed: %s\n", name);
|
||||||
fputs("</nav>", f);
|
fputs("</nav>\n", f);
|
||||||
/* main */
|
/* main */
|
||||||
if (!ismetanav(name)) {
|
if (!ismetanav(name)) {
|
||||||
fputs("<main>\n\n", f);
|
fputs("<main>\n", f);
|
||||||
fprintf(f, "<h2>%s</h2>", name);
|
fprintf(f, "<h2>%s</h2>\n", name);
|
||||||
if (!fpinject(f, l, srcpath))
|
if (!fpinject(f, l, srcpath))
|
||||||
printf(">>> Building failed: %s\n", name);
|
printf(">>> Building failed: %s\n", name);
|
||||||
fputs("\n\n</main>", f);
|
fputs("\n</main>", f);
|
||||||
} else {
|
} else {
|
||||||
gettwtxt(f);
|
gettwtxt(f);
|
||||||
}
|
}
|
||||||
|
@ -570,7 +574,7 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* end */
|
/* end */
|
||||||
fputs("</body></html>", f);
|
fputs("</body>\n</html>\n", f);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue