summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2009-08-09 11:27:21 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-08-09 11:41:54 (UTC)
commit537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4 (patch) (unidiff)
tree73b1d25a96dd171c5503fae1fefc6a27a7d58683
parente1782fff8a78b7f265432603351281ad2988bb40 (diff)
downloadcgit-537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4.zip
cgit-537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4.tar.gz
cgit-537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4.tar.bz2
Add 'about-filter' and 'repo.about-filter' options
These options can be used to execute a filter command on each about-page, both top-level and for each repository (repo.about-filter can be used to override the current about-filter). Signed-off-by: Lars Hjemli <hjemli@gmail.com>
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--shared.c1
-rw-r--r--ui-repolist.c9
-rw-r--r--ui-summary.c4
6 files changed, 28 insertions, 2 deletions
diff --git a/cgit.c b/cgit.c
index b3a98c1..cb1149d 100644
--- a/cgit.c
+++ b/cgit.c
@@ -90,6 +90,8 @@ void config_cb(const char *name, const char *value)
90 ctx.cfg.cache_static_ttl = atoi(value); 90 ctx.cfg.cache_static_ttl = atoi(value);
91 else if (!strcmp(name, "cache-dynamic-ttl")) 91 else if (!strcmp(name, "cache-dynamic-ttl"))
92 ctx.cfg.cache_dynamic_ttl = atoi(value); 92 ctx.cfg.cache_dynamic_ttl = atoi(value);
93 else if (!strcmp(name, "about-filter"))
94 ctx.cfg.about_filter = new_filter(value, 0);
93 else if (!strcmp(name, "commit-filter")) 95 else if (!strcmp(name, "commit-filter"))
94 ctx.cfg.commit_filter = new_filter(value, 0); 96 ctx.cfg.commit_filter = new_filter(value, 0);
95 else if (!strcmp(name, "embedded")) 97 else if (!strcmp(name, "embedded"))
@@ -146,6 +148,8 @@ void config_cb(const char *name, const char *value)
146 ctx.repo->max_stats = cgit_find_stats_period(value, NULL); 148 ctx.repo->max_stats = cgit_find_stats_period(value, NULL);
147 else if (ctx.repo && !strcmp(name, "repo.module-link")) 149 else if (ctx.repo && !strcmp(name, "repo.module-link"))
148 ctx.repo->module_link= xstrdup(value); 150 ctx.repo->module_link= xstrdup(value);
151 else if (ctx.repo && !strcmp(name, "repo.about-filter"))
152 ctx.repo->about_filter = new_filter(value, 0);
149 else if (ctx.repo && !strcmp(name, "repo.commit-filter")) 153 else if (ctx.repo && !strcmp(name, "repo.commit-filter"))
150 ctx.repo->commit_filter = new_filter(value, 0); 154 ctx.repo->commit_filter = new_filter(value, 0);
151 else if (ctx.repo && !strcmp(name, "repo.source-filter")) 155 else if (ctx.repo && !strcmp(name, "repo.source-filter"))
diff --git a/cgit.h b/cgit.h
index f10ba05..b8f4850 100644
--- a/cgit.h
+++ b/cgit.h
@@ -73,6 +73,7 @@ struct cgit_repo {
73 int enable_log_linecount; 73 int enable_log_linecount;
74 int max_stats; 74 int max_stats;
75 time_t mtime; 75 time_t mtime;
76 struct cgit_filter *about_filter;
76 struct cgit_filter *commit_filter; 77 struct cgit_filter *commit_filter;
77 struct cgit_filter *source_filter; 78 struct cgit_filter *source_filter;
78}; 79};
@@ -185,6 +186,7 @@ struct cgit_config {
185 int summary_branches; 186 int summary_branches;
186 int summary_log; 187 int summary_log;
187 int summary_tags; 188 int summary_tags;
189 struct cgit_filter *about_filter;
188 struct cgit_filter *commit_filter; 190 struct cgit_filter *commit_filter;
189 struct cgit_filter *source_filter; 191 struct cgit_filter *source_filter;
190}; 192};
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index ffb3e0f..d8e4b97 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -16,6 +16,13 @@ lines, and lines starting with '#', are ignored.
16 16
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
21 to specify the date and time of the youngest commit in the repository. 28 to specify the date and time of the youngest commit in the repository.
@@ -234,6 +241,9 @@ virtual-root::
234 241
235REPOSITORY SETTINGS 242REPOSITORY SETTINGS
236------------------- 243-------------------
244repo.about-filter::
245 Override the default about-filter. Default value: <about-filter>.
246
237repo.clone-url:: 247repo.clone-url::
238 A list of space-separated urls which can be used to clone this repo. 248 A list of space-separated urls which can be used to clone this repo.
239 Default value: none. 249 Default value: none.
diff --git a/shared.c b/shared.c
index 783604b..911a55a 100644
--- a/shared.c
+++ b/shared.c
@@ -62,6 +62,7 @@ struct cgit_repo *cgit_add_repo(const char *url)
62 ret->module_link = ctx.cfg.module_link; 62 ret->module_link = ctx.cfg.module_link;
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;
67 return ret; 68 return ret;
diff --git a/ui-repolist.c b/ui-repolist.c
index 2c13d50..25f076f 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -273,6 +273,11 @@ void cgit_print_repolist()
273 273
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 f2a9b46..a2c018e 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -83,6 +83,10 @@ void cgit_print_repo_readme(char *path)
83 } else 83 } else
84 tmp = ctx.repo->readme; 84 tmp = ctx.repo->readme;
85 html("<div id='summary'>"); 85 html("<div id='summary'>");
86 if (ctx.repo->about_filter)
87 cgit_open_filter(ctx.repo->about_filter);
86 html_include(tmp); 88 html_include(tmp);
89 if (ctx.repo->about_filter)
90 cgit_close_filter(ctx.repo->about_filter);
87 html("</div>"); 91 html("</div>");
88} 92}