cld-ssg

The static site generator (to be) used for hellocld.com
git clone git://git.hellocld.com/cld-ssg
Log | Files | Refs

commit 845887b289e1bc17bd007806301a66f091137b31
parent b99df15c60ef686a717b2d79f3cbc10d34cc82e7
Author: Christopher Ray Langford <chris@hellocld.com>
Date:   Wed, 25 Sep 2019 08:07:34 -0400

Fixed issue with additional formatting in title breaking URL/struct title

Diffstat:
Mmain.c | 11+++++++++--
Mtestdir/2019-09-24-20-24-real-test.md | 2+-
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/main.c b/main.c @@ -97,12 +97,19 @@ const char *get_post_title(struct cmark_node *root) cmark_iter *t_iter = cmark_iter_new(root); while(cmark_iter_next(t_iter) != CMARK_EVENT_DONE) if(cmark_node_get_type(cmark_iter_get_node(t_iter)) == CMARK_NODE_HEADING) { - cmark_iter_next(t_iter); break; } cmark_node *t_title = cmark_iter_get_node(t_iter); cmark_iter_free(t_iter); - return cmark_node_get_literal(t_title); + t_iter = cmark_iter_new(t_title); + char *title = malloc(MAX_URL_CHARS); + while(cmark_iter_next(t_iter) != CMARK_EVENT_DONE) + if(cmark_node_get_type(cmark_iter_get_node(t_iter)) == CMARK_NODE_TEXT) + strcat(title, cmark_node_get_literal(cmark_iter_get_node(t_iter))); + free(t_iter); + free(t_title); + + return title; } /* Generates a tm struct based on the time in the post filename */ diff --git a/testdir/2019-09-24-20-24-real-test.md b/testdir/2019-09-24-20-24-real-test.md @@ -1,4 +1,4 @@ -# Real Test +# *Real* Test This one's the real deal, folks. Properly testing loading