diff options
author | Andy Green <andy@warmcat.com> | 2018-07-03 11:33:59 +0800 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-12-19 16:49:09 +0100 |
commit | 093ac9697068833a15cae2dbbd5ffbc0203741c0 (patch) | |
tree | 32653fc7b87d4f91abad02dc11f6afc07f3fab28 /ui-shared.c | |
parent | 91f25909b9572ebdf3a0fed8224bf03d0d9bf3db (diff) | |
download | cgit-093ac9697068833a15cae2dbbd5ffbc0203741c0.tar.gz cgit-093ac9697068833a15cae2dbbd5ffbc0203741c0.zip |
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 <andy@warmcat.com>
Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/ui-shared.c b/ui-shared.c index fbf5a2d..7c7a537 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("<link rel='stylesheet' type='text/css' href='"); + if (s) + html_attr(s->string); + else + html_attr((const char *)arg); + html("'/>\n"); + + return 0; +} + void cgit_print_docstart(void) { char *host = cgit_hosturl(); @@ -787,9 +799,12 @@ void cgit_print_docstart(void) htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); if (ctx.cfg.robots && *ctx.cfg.robots) htmlf("<meta name='robots' content='%s'/>\n", ctx.cfg.robots); - html("<link rel='stylesheet' type='text/css' href='"); - html_attr(ctx.cfg.css); - 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("<link rel='shortcut icon' href='"); html_attr(ctx.cfg.favicon); |