From f466091a0d5717d61853965aa3eb1441efdff007 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 3 Jul 2018 11:33:59 +0800 Subject: css: change to be a list Without changing the default behaviour of including /cgit.css if nothing declared, allow the "css" config to be given multiple times listing one or more alternative URL paths to be included in the document head area. Signed-off-by: Andy Green Signed-off-by: Christian Hesse --- ui-shared.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'ui-shared.c') diff --git a/ui-shared.c b/ui-shared.c index 3afa15e..1251c9a 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -768,6 +768,18 @@ static void print_rel_vcs_link(const char *url) html(" Git repository'/>\n"); } +static int emit_css_link(struct string_list_item *s, void *arg) +{ + html("\n"); + + return 0; +} + void cgit_print_docstart(void) { char *host = cgit_hosturl(); @@ -787,9 +799,12 @@ void cgit_print_docstart(void) htmlf("\n", cgit_version); if (ctx.cfg.robots && *ctx.cfg.robots) htmlf("\n", ctx.cfg.robots); - html("\n"); + + if (ctx.cfg.css.items) + for_each_string_list(&ctx.cfg.css, emit_css_link, NULL); + else + emit_css_link(NULL, "/cgit.css"); + if (ctx.cfg.favicon) { html("