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}
|
||||
|
||||
// shorthand for italic
|
||||
{~italic text}
|
||||
{\italic text}
|
||||
|
||||
// shorthand for code
|
||||
{`short code}
|
||||
|
@ -96,7 +96,7 @@ There is a markup language which makes writing long blog posts, memex entries, e
|
|||
{>longer quote}
|
||||
|
||||
// shorthand for strikethrough
|
||||
{\crossed-out text}
|
||||
{~crossed-out text}
|
||||
|
||||
// shorthand for level 3 heading
|
||||
{!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'>)
|
||||
{+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 @@ 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
|
||||
- **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.
|
||||
|
|
62
config.def.h
62
config.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> \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" \
|
||||
""
|
||||
/* clang-format off */
|
||||
|
||||
#define MAINCSS "/nilfm.css?v=20220112.1"
|
||||
#define DOMAIN "https://nilfm.cc"
|
||||
#define FRONTCSS "/nilfm.css"
|
||||
#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 LEXICON_SIZE 1024
|
||||
#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;
|
||||
}
|
||||
|
||||
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 fppublish(FILE* f, char* s) {
|
|||
|
||||
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 fpitalic(FILE* f, char* s) {
|
|||
|
||||
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 @@ int fptemplate(FILE* f, Lexicon* l, char* s) {
|
|||
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 @@ int fptemplate(FILE* f, Lexicon* l, char* s) {
|
|||
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 @@ int fptemplate(FILE* f, Lexicon* l, char* s) {
|
|||
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 @@ int fpfooter(FILE* f, char* name) {
|
|||
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 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) {
|
|||
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 @@ FILE* build(FILE* f, Lexicon* l, char* name, char* srcpath) {
|
|||
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 */
|
||||
|
|
8
tw.sh
8
tw.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}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue