diff options
author | Andy Green <andy@warmcat.com> | 2018-07-03 11:33:59 +0800 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2021-03-14 23:18:22 +0100 |
commit | 21c36836b16c225d335aa562fd42c74bbd8b4f8a (patch) | |
tree | 7d1599e7c511dd4ec88e30b1b5e746ed771a73b3 /ui-shared.c | |
parent | bd6f5683f6cde4212364354b3139c1d521f40f39 (diff) | |
download | cgit-21c36836b16c225d335aa562fd42c74bbd8b4f8a.tar.gz cgit-21c36836b16c225d335aa562fd42c74bbd8b4f8a.tar.zst cgit-21c36836b16c225d335aa562fd42c74bbd8b4f8a.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 acd8ab5..f998912 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); |