diff options
author | Andy Green | 2018-07-03 11:33:59 +0800 |
---|---|---|
committer | Yigit Sever | 2023-07-21 03:03:51 +0300 |
commit | f466091a0d5717d61853965aa3eb1441efdff007 (patch) | |
tree | 1b906a5012e27d580e1f82e39c3199398011515d /ui-shared.c | |
parent | 319e4e08ecfdabecce1304b2c60acb09d9d2a736 (diff) | |
download | cgit-f466091a0d5717d61853965aa3eb1441efdff007.tar.gz cgit-f466091a0d5717d61853965aa3eb1441efdff007.tar.bz2 cgit-f466091a0d5717d61853965aa3eb1441efdff007.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 3afa15e..1251c9a 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -768,6 +768,18 @@ static void print_rel_vcs_link(const char *url) | |||
768 | html(" Git repository'/>\n"); | 768 | html(" Git repository'/>\n"); |
769 | } | 769 | } |
770 | 770 | ||
771 | static int emit_css_link(struct string_list_item *s, void *arg) | ||
772 | { | ||
773 | html("<link rel='stylesheet' type='text/css' href='"); | ||
774 | if (s) | ||
775 | html_attr(s->string); | ||
776 | else | ||
777 | html_attr((const char *)arg); | ||
778 | html("'/>\n"); | ||
779 | |||
780 | return 0; | ||
781 | } | ||
782 | |||
771 | void cgit_print_docstart(void) | 783 | void cgit_print_docstart(void) |
772 | { | 784 | { |
773 | char *host = cgit_hosturl(); | 785 | char *host = cgit_hosturl(); |
@@ -787,9 +799,12 @@ void cgit_print_docstart(void) | |||
787 | htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); | 799 | htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); |
788 | if (ctx.cfg.robots && *ctx.cfg.robots) | 800 | if (ctx.cfg.robots && *ctx.cfg.robots) |
789 | htmlf("<meta name='robots' content='%s'/>\n", ctx.cfg.robots); | 801 | htmlf("<meta name='robots' content='%s'/>\n", ctx.cfg.robots); |
790 | html("<link rel='stylesheet' type='text/css' href='"); | 802 | |
791 | html_attr(ctx.cfg.css); | 803 | if (ctx.cfg.css.items) |
792 | html("'/>\n"); | 804 | for_each_string_list(&ctx.cfg.css, emit_css_link, NULL); |
805 | else | ||
806 | emit_css_link(NULL, "/cgit.css"); | ||
807 | |||
793 | if (ctx.cfg.favicon) { | 808 | if (ctx.cfg.favicon) { |
794 | html("<link rel='shortcut icon' href='"); | 809 | html("<link rel='shortcut icon' href='"); |
795 | html_attr(ctx.cfg.favicon); | 810 | html_attr(ctx.cfg.favicon); |