all repos — cgit @ 537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4

a hyperfast web frontend for git written in c

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>
Lars Hjemli hjemli@gmail.com
Sun, 09 Aug 2009 13:27:21 +0200
commit

537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4

parent

e1782fff8a78b7f265432603351281ad2988bb40

6 files changed, 28 insertions(+), 2 deletions(-)

jump to
M cgit.ccgit.c

@@ -90,6 +90,8 @@ else if (!strcmp(name, "cache-static-ttl"))

ctx.cfg.cache_static_ttl = atoi(value); else if (!strcmp(name, "cache-dynamic-ttl")) ctx.cfg.cache_dynamic_ttl = atoi(value); + else if (!strcmp(name, "about-filter")) + ctx.cfg.about_filter = new_filter(value, 0); else if (!strcmp(name, "commit-filter")) ctx.cfg.commit_filter = new_filter(value, 0); else if (!strcmp(name, "embedded"))

@@ -146,6 +148,8 @@ else if (ctx.repo && !strcmp(name, "repo.max-stats"))

ctx.repo->max_stats = cgit_find_stats_period(value, NULL); else if (ctx.repo && !strcmp(name, "repo.module-link")) ctx.repo->module_link= xstrdup(value); + else if (ctx.repo && !strcmp(name, "repo.about-filter")) + ctx.repo->about_filter = new_filter(value, 0); else if (ctx.repo && !strcmp(name, "repo.commit-filter")) ctx.repo->commit_filter = new_filter(value, 0); else if (ctx.repo && !strcmp(name, "repo.source-filter"))
M cgit.hcgit.h

@@ -73,6 +73,7 @@ int enable_log_filecount;

int enable_log_linecount; int max_stats; time_t mtime; + struct cgit_filter *about_filter; struct cgit_filter *commit_filter; struct cgit_filter *source_filter; };

@@ -185,6 +186,7 @@ int snapshots;

int summary_branches; int summary_log; int summary_tags; + struct cgit_filter *about_filter; struct cgit_filter *commit_filter; struct cgit_filter *source_filter; };
M cgitrc.5.txtcgitrc.5.txt

@@ -16,6 +16,13 @@

GLOBAL SETTINGS --------------- +about-filter:: + Specifies a command which will be invoked to format the content of + about pages (both top-level and for each repository). The command will + get the content of the about-file on its STDIN, and the STDOUT from the + command will be included verbatim on the about page. Default value: + none. + agefile:: Specifies a path, relative to each repository path, which can be used to specify the date and time of the youngest commit in the repository.

@@ -234,6 +241,9 @@ same kind of virtual urls, so this option will probably be deprecated.

REPOSITORY SETTINGS ------------------- +repo.about-filter:: + Override the default about-filter. Default value: <about-filter>. + repo.clone-url:: A list of space-separated urls which can be used to clone this repo. Default value: none.
M shared.cshared.c

@@ -62,6 +62,7 @@ ret->max_stats = ctx.cfg.max_stats;

ret->module_link = ctx.cfg.module_link; ret->readme = NULL; ret->mtime = -1; + ret->about_filter = ctx.cfg.about_filter; ret->commit_filter = ctx.cfg.commit_filter; ret->source_filter = ctx.cfg.source_filter; return ret;
M ui-repolist.cui-repolist.c

@@ -273,6 +273,11 @@ }

void cgit_print_site_readme() { - if (ctx.cfg.root_readme) - html_include(ctx.cfg.root_readme); + if (!ctx.cfg.root_readme) + return; + if (ctx.cfg.about_filter) + cgit_open_filter(ctx.cfg.about_filter); + html_include(ctx.cfg.root_readme); + if (ctx.cfg.about_filter) + cgit_close_filter(ctx.cfg.about_filter); }
M ui-summary.cui-summary.c

@@ -83,6 +83,10 @@ strcpy(tmp + (slash - ctx.repo->readme + 1), path);

} else tmp = ctx.repo->readme; html("<div id='summary'>"); + if (ctx.repo->about_filter) + cgit_open_filter(ctx.repo->about_filter); html_include(tmp); + if (ctx.repo->about_filter) + cgit_close_filter(ctx.repo->about_filter); html("</div>"); }