saait

Simple static page generator
git clone https://git.sinitax.com/codemadness/saait
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 7c19117912a82008cd2e65a62c399ec7f6c439ab
parent 35dcc5adb052a5e4e4e8c6aa53eac82c28a37360
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun,  4 Dec 2016 13:38:31 +0100

style

Diffstat:
Msaait.c | 17+++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/saait.c b/saait.c @@ -279,7 +279,7 @@ void writepage(FILE *fp, const char *filename, struct config *c, char *s) { struct variable *var, *v; - char *key, escape, *e, *value; + char *key, *e, *value; size_t keylen, line = 0; int op; @@ -289,7 +289,6 @@ writepage(FILE *fp, const char *filename, struct config *c, char *s) case '%': /* insert contents of filename set in variable */ case '#': /* insert value non-escaped */ case '$': /* insert value escaped */ - escape = (*s == '$'); if (*(s + 1) == '{') { s += 2; break; @@ -335,7 +334,8 @@ writepage(FILE *fp, const char *filename, struct config *c, char *s) } value = v->value; - if (op == '%') { + switch (op) { + case '%': if (value[0]) { value = readfile(value); fputs(value, fp); @@ -344,13 +344,14 @@ writepage(FILE *fp, const char *filename, struct config *c, char *s) for (e = s; *e && *e != '}'; e++) ; s = e; - continue; - } - - if (escape) + break; + case '$': xmlencode(value, fp); - else + break; + case '#': fputs(value, fp); + break; + } } }