diff options
authorAndy Green <andy@warmcat.com>2018-06-18 14:24:57 +0800
committerAndy Green <andy@warmcat.com>2018-06-29 07:53:21 +0800
commit7d7ec486371658539009b8d348c517ccc90fb43c (patch)
parentconfig: add global inline-readme list (diff)
config: add repo inline-readme list
This allows the user to choose to override any global inline-readme list for a specific repo, using the same kind of semantics as the other repo overrides. Signed-off-by: Andy Green <andy@warmcat.com> Reviewed-by: John Keeping <john@keeping.me.uk>
4 files changed, 19 insertions, 1 deletions
diff --git a/cgit.c b/cgit.c
index bf62199..bdb2fad 100644
--- a/cgit.c
+++ b/cgit.c
@@ -105,7 +105,12 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va
repo->hide = atoi(value);
else if (!strcmp(name, "ignore"))
repo->ignore = atoi(value);
- else if (ctx.cfg.enable_filter_overrides) {
+ else if (!strcmp(name, "inline-readme")) {
+ if (repo->inline_readme.items == ctx.cfg.inline_readme.items)
+ string_list_init(&repo->inline_readme, 1);
+ string_list_append(&repo->inline_readme, value);
+ } else if (ctx.cfg.enable_filter_overrides) {
if (!strcmp(name, "about-filter"))
repo->about_filter = cgit_new_filter(value, ABOUT);
else if (!strcmp(name, "commit-filter"))
diff --git a/cgit.h b/cgit.h
index 981524a..999db9e 100644
--- a/cgit.h
+++ b/cgit.h
@@ -86,6 +86,7 @@ struct cgit_repo {
char *defbranch;
char *module_link;
struct string_list readme;
+ struct string_list inline_readme;
char *section;
char *clone_url;
char *logo;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 7ca8de9..62d7c2a 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -544,6 +544,16 @@ repo.ignore::
is not shown in the index and cannot be accessed by providing a direct
path. Default value: "0". See also: "repo.hide".
+ 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,
+ 'repo.inline-readme=README.md'. You may also want a corresponding render.
+ entry for the readme suffix, eg,
+ 'render.md=/usr/libexec/cgit/filters/html-converters/md2html'.
+ If not given, the repo will use any global 'inline-readme=' configuration;
+ if any 'repo.inline-readme' are given only they are used for that repo,
+ and the global 'inline-readme=' list is ignored for that repo.
Url which specifies the source of an image which will be used as a logo
on this repo's pages. Default value: global logo.
diff --git a/shared.c b/shared.c
index aad0024..3d7296d 100644
--- a/shared.c
+++ b/shared.c
@@ -77,6 +77,8 @@ struct cgit_repo *cgit_add_repo(const char *url)
ret->clone_url = ctx.cfg.clone_url;
ret->submodules.strdup_strings = 1;
ret->hide = ret->ignore = 0;
+ ret->inline_readme = ctx.cfg.inline_readme;
return ret;