From 949b3d31b6bab235b12ab269e309cf3d1fa7b61c Mon Sep 17 00:00:00 2001 From: Joursoir Date: Wed, 19 May 2021 08:21:34 +0000 Subject: ctimeline: handle all context infos; split branch and config context --- ctimeline.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ctimeline.c b/ctimeline.c index d27fca5..f2a114a 100644 --- a/ctimeline.c +++ b/ctimeline.c @@ -80,7 +80,7 @@ struct ctimeline_branch *add_branch(const char *name) return br; } -void handle_config_context(const char *name, const char *value) +void handle_branch_context(const char *name, const char *value) { if(strcmp(name, "branch.name") == 0) { ctx.cur_branch = add_branch(value); @@ -100,6 +100,28 @@ void handle_config_context(const char *name, const char *value) } } +void handle_config_context(const char *name, const char *value) +{ + if(strcmp(name, "title") == 0) { + ctx.head_title = string_alloc( + ctx.head_title, value); + } + else if(strcmp(name, "css") == 0) { + ctx.css = string_alloc( + ctx.css, value); + } + else if(strcmp(name, "header.title") == 0) { + ctx.header_title = string_alloc( + ctx.header_title, value); + } + else if(strcmp(name, "header.desc") == 0) { + ctx.header_desc = string_alloc( + ctx.header_desc, value); + } + else + handle_branch_context(name, value); +} + void skip_line(FILE *f) { int c; -- cgit v1.2.3-18-g5258