author | Mark Lodato <lodatom@gmail.com> | 2009-03-15 04:11:54 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-06-07 16:55:44 (UTC) |
commit | b5a3a2049648415e86d518a8bf2229b3e463b10f (patch) (unidiff) | |
tree | 37c44671e4557d38ba3d5905f0b595376aece5d6 | |
parent | 45e7fcecc1117440e6274ce3c6ab7d893c4986ee (diff) | |
download | cgit-b5a3a2049648415e86d518a8bf2229b3e463b10f.zip cgit-b5a3a2049648415e86d518a8bf2229b3e463b10f.tar.gz cgit-b5a3a2049648415e86d518a8bf2229b3e463b10f.tar.bz2 |
Add head-include configuration option.
This patch adds an option to the configuration file, "head-include",
which works just like "header" or "footer", except the content is put
into the HTML's <head> tag.
-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | ui-shared.c | 4 |
3 files changed, 6 insertions, 1 deletions
@@ -26,16 +26,18 @@ void config_cb(const char *name, const char *value) | |||
26 | else if (!strcmp(name, "root-readme")) | 26 | else if (!strcmp(name, "root-readme")) |
27 | ctx.cfg.root_readme = xstrdup(value); | 27 | ctx.cfg.root_readme = xstrdup(value); |
28 | else if (!strcmp(name, "css")) | 28 | else if (!strcmp(name, "css")) |
29 | ctx.cfg.css = xstrdup(value); | 29 | ctx.cfg.css = xstrdup(value); |
30 | else if (!strcmp(name, "favicon")) | 30 | else if (!strcmp(name, "favicon")) |
31 | ctx.cfg.favicon = xstrdup(value); | 31 | ctx.cfg.favicon = xstrdup(value); |
32 | else if (!strcmp(name, "footer")) | 32 | else if (!strcmp(name, "footer")) |
33 | ctx.cfg.footer = xstrdup(value); | 33 | ctx.cfg.footer = xstrdup(value); |
34 | else if (!strcmp(name, "head-include")) | ||
35 | ctx.cfg.head_include = xstrdup(value); | ||
34 | else if (!strcmp(name, "header")) | 36 | else if (!strcmp(name, "header")) |
35 | ctx.cfg.header = xstrdup(value); | 37 | ctx.cfg.header = xstrdup(value); |
36 | else if (!strcmp(name, "logo")) | 38 | else if (!strcmp(name, "logo")) |
37 | ctx.cfg.logo = xstrdup(value); | 39 | ctx.cfg.logo = xstrdup(value); |
38 | else if (!strcmp(name, "index-header")) | 40 | else if (!strcmp(name, "index-header")) |
39 | ctx.cfg.index_header = xstrdup(value); | 41 | ctx.cfg.index_header = xstrdup(value); |
40 | else if (!strcmp(name, "index-info")) | 42 | else if (!strcmp(name, "index-info")) |
41 | ctx.cfg.index_info = xstrdup(value); | 43 | ctx.cfg.index_info = xstrdup(value); |
@@ -131,16 +131,17 @@ struct cgit_query { | |||
131 | 131 | ||
132 | struct cgit_config { | 132 | struct cgit_config { |
133 | char *agefile; | 133 | char *agefile; |
134 | char *cache_root; | 134 | char *cache_root; |
135 | char *clone_prefix; | 135 | char *clone_prefix; |
136 | char *css; | 136 | char *css; |
137 | char *favicon; | 137 | char *favicon; |
138 | char *footer; | 138 | char *footer; |
139 | char *head_include; | ||
139 | char *header; | 140 | char *header; |
140 | char *index_header; | 141 | char *index_header; |
141 | char *index_info; | 142 | char *index_info; |
142 | char *logo; | 143 | char *logo; |
143 | char *logo_link; | 144 | char *logo_link; |
144 | char *module_link; | 145 | char *module_link; |
145 | char *repo_group; | 146 | char *repo_group; |
146 | char *robots; | 147 | char *robots; |
diff --git a/ui-shared.c b/ui-shared.c index de77bbf..fea2c40 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -491,18 +491,20 @@ void cgit_print_docstart(struct cgit_context *ctx) | |||
491 | html_attr(ctx->cfg.favicon); | 491 | html_attr(ctx->cfg.favicon); |
492 | html("'/>\n"); | 492 | html("'/>\n"); |
493 | } | 493 | } |
494 | if (host && ctx->repo) { | 494 | if (host && ctx->repo) { |
495 | html("<link rel='alternate' title='Atom feed' href='http://"); | 495 | html("<link rel='alternate' title='Atom feed' href='http://"); |
496 | html_attr(cgit_hosturl()); | 496 | html_attr(cgit_hosturl()); |
497 | html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.path, | 497 | html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.path, |
498 | fmt("h=%s", ctx->qry.head))); | 498 | fmt("h=%s", ctx->qry.head))); |
499 | html("' type='application/atom+xml'/>"); | 499 | html("' type='application/atom+xml'/>\n"); |
500 | } | 500 | } |
501 | if (ctx->cfg.head_include) | ||
502 | html_include(ctx->cfg.head_include); | ||
501 | html("</head>\n"); | 503 | html("</head>\n"); |
502 | html("<body>\n"); | 504 | html("<body>\n"); |
503 | if (ctx->cfg.header) | 505 | if (ctx->cfg.header) |
504 | html_include(ctx->cfg.header); | 506 | html_include(ctx->cfg.header); |
505 | } | 507 | } |
506 | 508 | ||
507 | void cgit_print_docend() | 509 | void cgit_print_docend() |
508 | { | 510 | { |