saait

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

commit 1f2bea100210ce5dab1d3801efa0968b89020f31
parent 893bbfdd9283e8f38700a2f5623c95a37c2c6f41
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 15 Feb 2020 00:12:34 +0100

strip TABs and spaces before values too, improve comments wording

Diffstat:
Mpages/001-example.cfg | 13++++++-------
Mpages/002-example.cfg | 13++++++-------
Msaait.c | 7++++---
3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/pages/001-example.cfg b/pages/001-example.cfg @@ -1,7 +1,6 @@ -filename=example.html -title=Example page -description=This is an example page -keywords=example -created=2009-04-12 -updated=2009-04-12 -#index=0 +filename = example.html +title = Example page +description = This is an example page +keywords = example +created = 2009-04-12 +updated = 2009-04-12 diff --git a/pages/002-example.cfg b/pages/002-example.cfg @@ -1,7 +1,6 @@ -filename=example2.html -title=Example page 2 -description=This is an example page 2 -keywords=example -created=2009-04-13 -updated=2009-04-13 -#index=0 +filename = example2.html +title = Example page 2 +description = This is an example page 2 +keywords = example +created = 2009-04-13 +updated = 2009-04-13 diff --git a/saait.c b/saait.c @@ -257,8 +257,8 @@ parsevars(const char *file, const char *s) exit(1); } - /* trim whitespace at end of key: but whitespace in names are - allowed */ + /* trim whitespace at end of key: but whitespace inside names + are allowed */ for (keyend = s++; keyend > keystart && (keyend[-1] == ' ' || keyend[-1] == '\t'); keyend--) @@ -270,7 +270,8 @@ parsevars(const char *file, const char *s) exit(1); } - valuestart = s; + /* trim whitespace before value */ + valuestart = &s[strspn(s, " \t")]; s = &s[strcspn(s, "\r\n")]; valueend = s;