summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c4
-rw-r--r--cgit.h2
-rw-r--r--cgitrc.5.txt10
-rw-r--r--cmd.c2
-rw-r--r--shared.c1
-rw-r--r--ui-repolist.c9
-rw-r--r--ui-summary.c28
-rw-r--r--ui-summary.h2
8 files changed, 48 insertions, 10 deletions
diff --git a/cgit.c b/cgit.c
index dbec196..7b228af 100644
--- a/cgit.c
+++ b/cgit.c
@@ -101,4 +101,6 @@ void config_cb(const char *name, const char *value)
101 else if (!strcmp(name, "cache-dynamic-ttl")) 101 else if (!strcmp(name, "cache-dynamic-ttl"))
102 ctx.cfg.cache_dynamic_ttl = atoi(value); 102 ctx.cfg.cache_dynamic_ttl = atoi(value);
103 else if (!strcmp(name, "about-filter"))
104 ctx.cfg.about_filter = new_filter(value, 0);
103 else if (!strcmp(name, "commit-filter")) 105 else if (!strcmp(name, "commit-filter"))
104 ctx.cfg.commit_filter = new_filter(value, 0); 106 ctx.cfg.commit_filter = new_filter(value, 0);
@@ -159,4 +161,6 @@ void config_cb(const char *name, const char *value)
159 else if (ctx.repo && !strcmp(name, "repo.module-link")) 161 else if (ctx.repo && !strcmp(name, "repo.module-link"))
160 ctx.repo->module_link= xstrdup(value); 162 ctx.repo->module_link= xstrdup(value);
163 else if (ctx.repo && !strcmp(name, "repo.about-filter"))
164 ctx.repo->about_filter = new_filter(value, 0);
161 else if (ctx.repo && !strcmp(name, "repo.commit-filter")) 165 else if (ctx.repo && !strcmp(name, "repo.commit-filter"))
162 ctx.repo->commit_filter = new_filter(value, 0); 166 ctx.repo->commit_filter = new_filter(value, 0);
diff --git a/cgit.h b/cgit.h
index b8557ac..4c854ea 100644
--- a/cgit.h
+++ b/cgit.h
@@ -75,4 +75,5 @@ struct cgit_repo {
75 int max_stats; 75 int max_stats;
76 time_t mtime; 76 time_t mtime;
77 struct cgit_filter *about_filter;
77 struct cgit_filter *commit_filter; 78 struct cgit_filter *commit_filter;
78 struct cgit_filter *source_filter; 79 struct cgit_filter *source_filter;
@@ -189,4 +190,5 @@ struct cgit_config {
189 int summary_tags; 190 int summary_tags;
190 struct string_list mimetypes; 191 struct string_list mimetypes;
192 struct cgit_filter *about_filter;
191 struct cgit_filter *commit_filter; 193 struct cgit_filter *commit_filter;
192 struct cgit_filter *source_filter; 194 struct cgit_filter *source_filter;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index dc63637..4d656fe 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -17,4 +17,11 @@ lines, and lines starting with '#', are ignored.
17GLOBAL SETTINGS 17GLOBAL SETTINGS
18--------------- 18---------------
19about-filter::
20 Specifies a command which will be invoked to format the content of
21 about pages (both top-level and for each repository). The command will
22 get the content of the about-file on its STDIN, and the STDOUT from the
23 command will be included verbatim on the about page. Default value:
24 none.
25
19agefile:: 26agefile::
20 Specifies a path, relative to each repository path, which can be used 27 Specifies a path, relative to each repository path, which can be used
@@ -243,4 +250,7 @@ virtual-root::
243REPOSITORY SETTINGS 250REPOSITORY SETTINGS
244------------------- 251-------------------
252repo.about-filter::
253 Override the default about-filter. Default value: <about-filter>.
254
245repo.clone-url:: 255repo.clone-url::
246 A list of space-separated urls which can be used to clone this repo. 256 A list of space-separated urls which can be used to clone this repo.
diff --git a/cmd.c b/cmd.c
index cf97da7..766f903 100644
--- a/cmd.c
+++ b/cmd.c
@@ -40,5 +40,5 @@ static void about_fn(struct cgit_context *ctx)
40{ 40{
41 if (ctx->repo) 41 if (ctx->repo)
42 cgit_print_repo_readme(); 42 cgit_print_repo_readme(ctx->qry.path);
43 else 43 else
44 cgit_print_site_readme(); 44 cgit_print_site_readme();
diff --git a/shared.c b/shared.c
index 783604b..911a55a 100644
--- a/shared.c
+++ b/shared.c
@@ -63,4 +63,5 @@ struct cgit_repo *cgit_add_repo(const char *url)
63 ret->readme = NULL; 63 ret->readme = NULL;
64 ret->mtime = -1; 64 ret->mtime = -1;
65 ret->about_filter = ctx.cfg.about_filter;
65 ret->commit_filter = ctx.cfg.commit_filter; 66 ret->commit_filter = ctx.cfg.commit_filter;
66 ret->source_filter = ctx.cfg.source_filter; 67 ret->source_filter = ctx.cfg.source_filter;
diff --git a/ui-repolist.c b/ui-repolist.c
index 2c13d50..25f076f 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -274,5 +274,10 @@ void cgit_print_repolist()
274void cgit_print_site_readme() 274void cgit_print_site_readme()
275{ 275{
276 if (ctx.cfg.root_readme) 276 if (!ctx.cfg.root_readme)
277 html_include(ctx.cfg.root_readme); 277 return;
278 if (ctx.cfg.about_filter)
279 cgit_open_filter(ctx.cfg.about_filter);
280 html_include(ctx.cfg.root_readme);
281 if (ctx.cfg.about_filter)
282 cgit_close_filter(ctx.cfg.about_filter);
278} 283}
diff --git a/ui-summary.c b/ui-summary.c
index ede4a62..a2c018e 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -67,10 +67,26 @@ void cgit_print_summary()
67} 67}
68 68
69void cgit_print_repo_readme() 69void cgit_print_repo_readme(char *path)
70{ 70{
71 if (ctx.repo->readme) { 71 char *slash, *tmp;
72 html("<div id='summary'>"); 72
73 html_include(ctx.repo->readme); 73 if (!ctx.repo->readme)
74 html("</div>"); 74 return;
75 } 75
76 if (path) {
77 slash = strrchr(ctx.repo->readme, '/');
78 if (!slash)
79 return;
80 tmp = xmalloc(slash - ctx.repo->readme + 1 + strlen(path) + 1);
81 strncpy(tmp, ctx.repo->readme, slash - ctx.repo->readme + 1);
82 strcpy(tmp + (slash - ctx.repo->readme + 1), path);
83 } else
84 tmp = ctx.repo->readme;
85 html("<div id='summary'>");
86 if (ctx.repo->about_filter)
87 cgit_open_filter(ctx.repo->about_filter);
88 html_include(tmp);
89 if (ctx.repo->about_filter)
90 cgit_close_filter(ctx.repo->about_filter);
91 html("</div>");
76} 92}
diff --git a/ui-summary.h b/ui-summary.h
index 3e13039..c01f560 100644
--- a/ui-summary.h
+++ b/ui-summary.h
@@ -3,5 +3,5 @@
3 3
4extern void cgit_print_summary(); 4extern void cgit_print_summary();
5extern void cgit_print_repo_readme(); 5extern void cgit_print_repo_readme(char *path);
6 6
7#endif /* UI_SUMMARY_H */ 7#endif /* UI_SUMMARY_H */