Warmcat homepage andy@warmcat.com
libwebsockets
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1745907819, "reponame":"cgit", "desc":"CGI gitweb", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/cgit", "f":3, "items": [ {"schema":"libjg2-1", "cid":"7e5083aa4fc94622f08cefaf28f20f47", "commit": {"type":"commit", "time": 1530589875, "time_ofs": 480, "oid_tree": { "oid": "628075f30acc5781b0acba40f6b7b25fb91718c5", "alias": []}, "oid":{ "oid": "8a3a2f9dad084a5d1b40f3fc0c96aac3b35949a9", "alias": []}, "msg": "css: change to be a list", "sig_commit": { "git_time": { "time": 1530589875, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }, "sig_author": { "git_time": { "time": 1530588839, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }}, "body": "css: change to be a list\n\nWithout changing the default behaviour of including\n/cgit.css if nothing declared, allow the \u0022css\u0022 config\nto be given multiple times listing one or more\nalternative URL paths to be included in the document\nhead area.\n\nSigned-off-by: Andy Green \u003candy@warmcat.com\u003e\n" , "diff": "diff --git a/cgit.c b/cgit.c\nindex 0c9f3e9..a4f79a4 100644\n--- a/cgit.c\n+++ b/cgit.c\n@@ -128,7 +128,7 @@ static void config_cb(const char *name, const char *value)\n \telse if (!strcmp(name, \u0022root-readme\u0022))\n \t\tctx.cfg.root_readme \u003d xstrdup(value);\n \telse if (!strcmp(name, \u0022css\u0022))\n-\t\tctx.cfg.css \u003d xstrdup(value);\n+\t\tstring_list_append(\u0026ctx.cfg.css, xstrdup(value));\n \telse if (!strcmp(name, \u0022favicon\u0022))\n \t\tctx.cfg.favicon \u003d xstrdup(value);\n \telse if (!strcmp(name, \u0022footer\u0022))\n@@ -362,7 +362,6 @@ static void prepare_context(void)\n \tctx.cfg.case_sensitive_sort \u003d 1;\n \tctx.cfg.branch_sort \u003d 0;\n \tctx.cfg.commit_sort \u003d 0;\n-\tctx.cfg.css \u003d \u0022/cgit.css\u0022;\n \tctx.cfg.logo \u003d \u0022/cgit.png\u0022;\n \tctx.cfg.favicon \u003d \u0022/favicon.ico\u0022;\n \tctx.cfg.local_time \u003d 0;\ndiff --git a/cgit.h b/cgit.h\nindex 6e6750c..85a6ef9 100644\n--- a/cgit.h\n+++ b/cgit.h\n@@ -192,7 +192,6 @@ struct cgit_config {\n \tchar *cache_root;\n \tchar *clone_prefix;\n \tchar *clone_url;\n-\tchar *css;\n \tchar *favicon;\n \tchar *footer;\n \tchar *head_include;\n@@ -203,6 +202,7 @@ struct cgit_config {\n \tchar *module_link;\n \tchar *project_list;\n \tstruct string_list readme;\n+\tstruct string_list css;\n \tchar *robots;\n \tchar *root_title;\n \tchar *root_desc;\ndiff --git a/cgitrc.5.txt b/cgitrc.5.txt\nindex f6f6502..784fda2 100644\n--- a/cgitrc.5.txt\n+++ b/cgitrc.5.txt\n@@ -126,7 +126,8 @@ commit-sort::\n \n css::\n \tUrl which specifies the css document to include in all cgit pages.\n-\tDefault value: \u0022/cgit.css\u0022.\n+\tDefault value: \u0022/cgit.css\u0022. May be given multiple times, each\n+\tcss URL path is added in the head section of the document in turn.\n \n email-filter::\n \tSpecifies a command which will be invoked to format names and email\ndiff --git a/ui-shared.c b/ui-shared.c\nindex 10baf8a..7a8d323 100644\n--- a/ui-shared.c\n+++ b/ui-shared.c\n@@ -734,6 +734,18 @@ static void print_rel_vcs_link(const char *url)\n \thtml(\u0022 Git repository'/\u003e\u005cn\u0022);\n }\n \n+static int emit_css_link(struct string_list_item *s, void *arg)\n+{\n+\thtml(\u0022\u003clink rel\u003d'stylesheet' type\u003d'text/css' href\u003d'\u0022);\n+\tif (s)\n+\t\thtml_attr(s-\u003estring);\n+\telse\n+\t\thtml_attr((const char *)arg);\n+\thtml(\u0022'/\u003e\u005cn\u0022);\n+\n+\treturn 0;\n+}\n+\n void cgit_print_docstart(void)\n {\n \tchar *host \u003d cgit_hosturl();\n@@ -753,9 +765,12 @@ void cgit_print_docstart(void)\n \thtmlf(\u0022\u003cmeta name\u003d'generator' content\u003d'cgit %s'/\u003e\u005cn\u0022, cgit_version);\n \tif (ctx.cfg.robots \u0026\u0026 *ctx.cfg.robots)\n \t\thtmlf(\u0022\u003cmeta name\u003d'robots' content\u003d'%s'/\u003e\u005cn\u0022, ctx.cfg.robots);\n-\thtml(\u0022\u003clink rel\u003d'stylesheet' type\u003d'text/css' href\u003d'\u0022);\n-\thtml_attr(ctx.cfg.css);\n-\thtml(\u0022'/\u003e\u005cn\u0022);\n+\n+\tif (ctx.cfg.css.items)\n+\t\tfor_each_string_list(\u0026ctx.cfg.css, emit_css_link, NULL);\n+\telse\n+\t\temit_css_link(NULL, \u0022/cgit.css\u0022);\n+\n \tif (ctx.cfg.favicon) {\n \t\thtml(\u0022\u003clink rel\u003d'shortcut icon' href\u003d'\u0022);\n \t\thtml_attr(ctx.cfg.favicon);\n","s":{"c":1745907819,"u": 5186}} ],"g": 5880,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}