commit 3afa7a64852ecefaf30fbe624fb9d982bc122c31
parent 3f618f52abd4b338ffb7b987de12038f8d93502b
Author: Remy Noulin <loader2x@gmail.com>
Date: Mon, 31 Aug 2020 13:25:00 +0200
fix conversion of multiple internal link to other articles in the blog on a single line
forb.c | 27 ++++++++++++++++-----------
package.yml | 2 +-
2 files changed, 17 insertions(+), 12 deletions(-)
Diffstat:
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/forb.c b/forb.c
@@ -760,17 +760,22 @@ bool generateAPageOrAPost(char *filename, smallJsont *cfg, smallArrayt *postsFee
// (keep this block after code highlighting to get the correct status from the first line
// in the code block)
if (mdstatus equals searchcodeblock and hasG(l, "{\% post_url ")) {
- char *startp = hasG(l, "{\% post_url ");
- char *endp = hasG(l, " \%}");
- int start = startp - ssGet(l);
- int end = endp - ssGet(l);
- // post filename
- char *postFilemane = startp + strlen("{\% post_url ");
- *endp = 0;
- //lv(postFilemane);
- cleanCharP(url) = postToUrl(postFilemane);
- delG(l, start, end+3);
- insertG(l, start, url);
+ // convert all % post_url to valid url on the line
+ char *cursor = hasG(l, "{\% post_url ");
+ while (cursor) {
+ char *startp = cursor;
+ char *endp = findS(cursor, " \%}");
+ int start = startp - ssGet(l);
+ int end = endp - ssGet(l);
+ // post filename
+ char *postFilemane = startp + strlen("{\% post_url ");
+ *endp = 0;
+ //lv(postFilemane);
+ cleanCharP(url) = postToUrl(postFilemane);
+ delG(l, start, end+3);
+ insertG(l, start, url);
+ cursor = findS(ssGet(l)+start, "{\% post_url ");
+ }
//lv(l);
setPG(pf, iterIndexG(pf), l);
}
diff --git a/package.yml b/package.yml
@@ -1,6 +1,6 @@
---
name: forb
- version: 0.0.7
+ version: 0.0.8
description: static blog generator with configuration files inspired by jekyll
bin: ./forb.c
repository: