diff options
author | Andy Green <andy@warmcat.com> | 2018-06-13 10:02:20 +0800 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2018-06-13 10:32:44 +0200 |
commit | 1f7a538fef652473923c57b956ab38cd32c82a94 (patch) | |
tree | 093b7a3fa06e6b5025ec703c6064d0a1b06ad8f6 | |
parent | edd41cb20deeadc2264839ac0e73dd06af58f864 (diff) | |
download | cgit-1f7a538fef652473923c57b956ab38cd32c82a94.tar.gz |
config: add tree-readme list
Allows the user to specify a list of filenames that should be
rendered inline with tree view, if present in the directory.
Signed-off-by: Andy Green <andy@warmcat.com>
-rw-r--r-- | cgit.c | 11 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc.5.txt | 7 |
3 files changed, 18 insertions, 1 deletions
@@ -1,6 +1,6 @@ /* cgit.c: cgi for the git scm * - * Copyright (C) 2006-2014 cgit Development Team <cgit@lists.zx2c4.com> + * Copyright (C) 2006-2018 cgit Development Team <cgit@lists.zx2c4.com> * * Licensed under GNU General Public License v2 * (see COPYING for full license text) @@ -39,6 +39,12 @@ static void add_render_filter(const char *name, const char *cmd) item->util = filter; } +static void add_tree_readme(const char *name) +{ + string_list_insert(&ctx.cfg.tree_readme, name); +} + + static void process_cached_repolist(const char *path); static void repo_config(struct cgit_repo *repo, const char *name, const char *value) @@ -301,6 +307,8 @@ static void config_cb(const char *name, const char *value) add_mimetype(name + 9, value); else if (starts_with(name, "render.")) add_render_filter(name + 7, value); + else if (!strcmp(name, "tree-readme")) + add_tree_readme(value); else if (!strcmp(name, "include")) parse_configfile(expand_macros(value), config_cb); } @@ -435,6 +443,7 @@ static void prepare_context(void) ctx.page.etag = NULL; string_list_init(&ctx.cfg.mimetypes, 1); string_list_init(&ctx.cfg.render_filters, 1); + string_list_init(&ctx.cfg.tree_readme, 1); if (ctx.env.script_name) ctx.cfg.script_name = xstrdup(ctx.env.script_name); if (ctx.env.query_string) @@ -261,6 +261,7 @@ struct cgit_config { int branch_sort; int commit_sort; struct string_list mimetypes; + struct string_list tree_readme; struct string_list render_filters; struct cgit_filter *about_filter; struct cgit_filter *commit_filter; diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 793a0c1..5111197 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -469,6 +469,13 @@ strict-export:: repositories to match those exported by git-daemon. This option must be defined prior to scan-path. +tree-readme:: + Append given filename to the list of filenames to be rendered after the + tree navigation in tree view, if present in the directory being viewed. Eg, + 'tree-readme=README.md'. There must also be a corresponding render. + entry for the readme suffix, eg, + 'render.md=/usr/libexec/cgit/filters/html-converters/md2html' + virtual-root:: Url which, if specified, will be used as root for all cgit links. It will also cause cgit to generate 'virtual urls', i.e. urls like |