aboutsummaryrefslogtreecommitdiffstats
path: root/ui-shared.c
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2018-07-03 11:33:59 +0800
committerChristian Hesse <mail@eworm.de>2019-06-04 13:35:43 +0200
commit7d14fff9353709c5edd31f0d9b08d7783ccace57 (patch)
tree2142e08926769d803af1d8b44abf26a0962bb706 /ui-shared.c
parentui-shared: restrict to 15 levels (diff)
downloadcgit-7d14fff9353709c5edd31f0d9b08d7783ccace57.tar.xz
cgit-7d14fff9353709c5edd31f0d9b08d7783ccace57.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.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/ui-shared.c b/ui-shared.c
index d2358f2..8b378c9 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -767,6 +767,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();
@@ -786,9 +798,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);