added font templates, fixed return values; cleand up options; v2.0.0
This commit is contained in:
parent
bccea6d1d8
commit
63a2974807
4 changed files with 91 additions and 74 deletions
24
README.md
24
README.md
|
@ -81,7 +81,7 @@ There is a markup language which makes writing long blog posts, memex entries, e
|
||||||
{@bold text}
|
{@bold text}
|
||||||
|
|
||||||
// shorthand for italic
|
// shorthand for italic
|
||||||
{~italic text}
|
{\italic text}
|
||||||
|
|
||||||
// shorthand for code
|
// shorthand for code
|
||||||
{`short code}
|
{`short code}
|
||||||
|
@ -96,7 +96,7 @@ There is a markup language which makes writing long blog posts, memex entries, e
|
||||||
{>longer quote}
|
{>longer quote}
|
||||||
|
|
||||||
// shorthand for strikethrough
|
// shorthand for strikethrough
|
||||||
{\crossed-out text}
|
{~crossed-out text}
|
||||||
|
|
||||||
// shorthand for level 3 heading
|
// shorthand for level 3 heading
|
||||||
{!heading text}
|
{!heading text}
|
||||||
|
@ -112,6 +112,11 @@ There is a markup language which makes writing long blog posts, memex entries, e
|
||||||
|
|
||||||
// shorthand for publish date (renders as <time class='publish-date'>)
|
// shorthand for publish date (renders as <time class='publish-date'>)
|
||||||
{+2022-02-22}
|
{+2022-02-22}
|
||||||
|
|
||||||
|
// shorthand for explicit monospace, sans, and serif font respecively:
|
||||||
|
{=some mono text}
|
||||||
|
{(some sans serif text}
|
||||||
|
{)some serif text}
|
||||||
```
|
```
|
||||||
|
|
||||||
# configuration
|
# configuration
|
||||||
|
@ -122,12 +127,15 @@ The following macros are available in `config.h` to customize to your liking.
|
||||||
- **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
|
- **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
|
- **NAME**: the title of the site
|
||||||
- **DOMAIN**: currently unused
|
- **DOMAIN**: currently unused
|
||||||
- **LOGO**: HTML to put in the header h1 verbatim
|
- **LOGO_HTML**: HTML to put in the header h1 verbatim
|
||||||
- **ABOUT**: HTML content for the front page, placed between `<header>` and `<nav>`
|
- **ABOUT_HTML**: 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**
|
- **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**: arbitrary footer HTML
|
- **FOOTER_HTML**: arbitrary footer HTML
|
||||||
- **LICENSE**: the license link at the bottom of every page
|
- **LICENSE_HTML**: the license link at the bottom of every page
|
||||||
- **SITEROOT**: the path where the rendered HTML is placed
|
- **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
|
- **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.
|
||||||
|
|
62
config.def.h
62
config.def.h
|
@ -1,39 +1,27 @@
|
||||||
#define DESC "lair of drkste aka nilix: software artisan, digital philosopher"
|
/* clang-format off */
|
||||||
#define LEXICON_SIZE 1024
|
|
||||||
#define MAINCSS "/nilfm.css"
|
#define MAINCSS "/nilfm.css?v=20220112.1"
|
||||||
#define FOOTER \
|
|
||||||
"<a href='/git/'><img src='/img/git.svg' " \
|
|
||||||
"alt='nilFM hack " \
|
|
||||||
"lab'/></a> \n" \
|
|
||||||
"<a href='https://webring.xxiivv.com'><img src='/img/webring.svg' " \
|
|
||||||
"alt='xxiivv webring'/></a> \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" \
|
|
||||||
""
|
|
||||||
#define DOMAIN "https://nilfm.cc"
|
#define DOMAIN "https://nilfm.cc"
|
||||||
#define FRONTCSS "/nilfm.css"
|
#define LEXICON_SIZE 1024
|
||||||
#define ABOUT \
|
|
||||||
"Derek Stevens <<a " \
|
|
||||||
"href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a>><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 NAME "nilFM"
|
|
||||||
#define TWTXT "/twtxt.txt"
|
#define TWTXT "/twtxt.txt"
|
||||||
#define SEPARATEH1 0
|
#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 TAG_BODY_SIZE 4096
|
||||||
|
#define ABOUT_HTML "Derek Stevens <<a class='mono' href='mailto:nilix@nilfm.cc'>nilix@nilfm.cc</a>><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> \n" \
|
||||||
|
"<a href='https://webring.xxiivv.com'><img src='/img/webring.svg' alt='xxiivv webring'/></a> \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 */
|
||||||
|
|
71
main.c
71
main.c
|
@ -389,25 +389,46 @@ int fpaudio(FILE* f, char* s) {
|
||||||
return 1;
|
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) {
|
int fppara(FILE* f, Lexicon* l, char* s) {
|
||||||
fputs("<p>", f);
|
fputs("<p>", f);
|
||||||
fpmetatemplate(f, l, s);
|
int ret = fpmetatemplate(f, l, s);
|
||||||
fputs("</p>", f);
|
fputs("</p>", f);
|
||||||
return 1;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fpul(FILE* f, Lexicon* l, char* s) {
|
int fpul(FILE* f, Lexicon* l, char* s) {
|
||||||
fputs("<ul>", f);
|
fputs("<ul>", f);
|
||||||
fpmetatemplate(f, l, s);
|
int ret = fpmetatemplate(f, l, s);
|
||||||
fputs("</ul>", f);
|
fputs("</ul>", f);
|
||||||
return 1;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fpol(FILE* f, Lexicon* l, char* s) {
|
int fpol(FILE* f, Lexicon* l, char* s) {
|
||||||
fputs("<ol>", f);
|
fputs("<ol>", f);
|
||||||
fpmetatemplate(f, l, s);
|
int ret = fpmetatemplate(f, l, s);
|
||||||
fputs("</ol>", f);
|
fputs("</ol>", f);
|
||||||
return 1;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fppublish(FILE* f, char* s) {
|
int fppublish(FILE* f, char* s) {
|
||||||
|
@ -419,9 +440,9 @@ int fppublish(FILE* f, char* s) {
|
||||||
|
|
||||||
int fpli(FILE* f, Lexicon* l, char* s) {
|
int fpli(FILE* f, Lexicon* l, char* s) {
|
||||||
fputs("<li>", f);
|
fputs("<li>", f);
|
||||||
fpmetatemplate(f, l, s);
|
int ret = fpmetatemplate(f, l, s);
|
||||||
fputs("</li>", f);
|
fputs("</li>", f);
|
||||||
return 1;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fph3(FILE* f, char* s) {
|
int fph3(FILE* f, char* s) {
|
||||||
|
@ -461,9 +482,9 @@ int fpitalic(FILE* f, char* s) {
|
||||||
|
|
||||||
int fpstrike(FILE* f, Lexicon* l, char* s) {
|
int fpstrike(FILE* f, Lexicon* l, char* s) {
|
||||||
fputs("<s>", f);
|
fputs("<s>", f);
|
||||||
fpmetatemplate(f, l, s);
|
int ret = fpmetatemplate(f, l, s);
|
||||||
fputs("</s>", f);
|
fputs("</s>", f);
|
||||||
return 1;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fppre(FILE* f, char* s) {
|
int fppre(FILE* f, char* s) {
|
||||||
|
@ -504,7 +525,7 @@ int fptemplate(FILE* f, Lexicon* l, char* s) {
|
||||||
return fpaudio(f, s + 1);
|
return fpaudio(f, s + 1);
|
||||||
case '`':
|
case '`':
|
||||||
return fpcode(f, s + 1);
|
return fpcode(f, s + 1);
|
||||||
case '~':
|
case '\\':
|
||||||
return fpitalic(f, s + 1);
|
return fpitalic(f, s + 1);
|
||||||
case '>':
|
case '>':
|
||||||
return fpblock(f, s + 1);
|
return fpblock(f, s + 1);
|
||||||
|
@ -514,7 +535,7 @@ int fptemplate(FILE* f, Lexicon* l, char* s) {
|
||||||
return fppre(f, s + 1);
|
return fppre(f, s + 1);
|
||||||
case '@':
|
case '@':
|
||||||
return fpbold(f, s + 1);
|
return fpbold(f, s + 1);
|
||||||
case '\\':
|
case '~':
|
||||||
return fpstrike(f, l, s + 1);
|
return fpstrike(f, l, s + 1);
|
||||||
case '!':
|
case '!':
|
||||||
return fph3(f, s + 1);
|
return fph3(f, s + 1);
|
||||||
|
@ -536,6 +557,12 @@ int fptemplate(FILE* f, Lexicon* l, char* s) {
|
||||||
return fptbody(f, l, s + 1);
|
return fptbody(f, l, s + 1);
|
||||||
case ';':
|
case ';':
|
||||||
return fptfoot(f);
|
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]) {
|
if (s[0]) {
|
||||||
target = findf(l, s);
|
target = findf(l, s);
|
||||||
|
@ -645,10 +672,10 @@ int fpfooter(FILE* f, char* name) {
|
||||||
fputs("<footer>", f);
|
fputs("<footer>", f);
|
||||||
if (!ismetanav(name)) {
|
if (!ismetanav(name)) {
|
||||||
fpedited(f);
|
fpedited(f);
|
||||||
fputs(CONTACT, f);
|
fputs(CONTACT_HTML, f);
|
||||||
}
|
}
|
||||||
fputs(FOOTER, f);
|
fputs(FOOTER_HTML, f);
|
||||||
fputs(LICENSE, f);
|
fputs(LICENSE_HTML, f);
|
||||||
fputs("</footer>", f);
|
fputs("</footer>", f);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -680,15 +707,9 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) {
|
||||||
fputs("</head>\n", f);
|
fputs("</head>\n", f);
|
||||||
fputs("<body>\n", f);
|
fputs("<body>\n", f);
|
||||||
/* header */
|
/* header */
|
||||||
if (SEPARATEH1) {
|
fputs("<header>\n", f);
|
||||||
fputs("<header>\n", f);
|
fputs("<a href='/'><h1>" LOGO_HTML "</h1></a>\n", f);
|
||||||
if (ismetanav(name)) {
|
fputs("</header>\n", f);
|
||||||
fputs("<h1>" LOGO "</h1>\n", f);
|
|
||||||
} else {
|
|
||||||
fputs("<a href='/'><h1>" LOGO "</h1></a>\n", f);
|
|
||||||
}
|
|
||||||
fputs("</header>\n", f);
|
|
||||||
}
|
|
||||||
/* nav */
|
/* nav */
|
||||||
fputs("<nav>\n", f);
|
fputs("<nav>\n", f);
|
||||||
if (!fpportal(f, l, "meta.nav", 0))
|
if (!fpportal(f, l, "meta.nav", 0))
|
||||||
|
@ -705,7 +726,7 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) {
|
||||||
fputs("\n</main>", f);
|
fputs("\n</main>", f);
|
||||||
} else {
|
} else {
|
||||||
/* about & twtxt (main page only) */
|
/* about & twtxt (main page only) */
|
||||||
fputs("<div id='about'>" ABOUT "</div>\n", f);
|
fputs("<div id='about'>" ABOUT_HTML "</div>\n", f);
|
||||||
gettwtxt(f);
|
gettwtxt(f);
|
||||||
}
|
}
|
||||||
/* footer */
|
/* footer */
|
||||||
|
|
8
tw.sh
8
tw.sh
|
@ -1,13 +1,13 @@
|
||||||
#!/bin/sh
|
#!/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(){
|
twt(){
|
||||||
self=$(mktemp)
|
self=$(mktemp)
|
||||||
new=$(mktemp)
|
new=$(mktemp)
|
||||||
echo "$(date -Is)\t$@" > ${self}
|
echo "$(date -Is)\t$@" > ${self}
|
||||||
cat ${self} ${twtxt} > ${new}
|
cat ${self} ${siteroot}${twtxt} > ${new}
|
||||||
cp ${new} ${twtxt}
|
cp ${new} ${siteroot}${twtxt}
|
||||||
rm ${new}
|
rm ${new}
|
||||||
rm ${self}
|
rm ${self}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue