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 <a...@warmcat.com>
Reviewed-by: John Keeping <j...@keeping.me.uk>
---
 cgit.c       |    7 ++++++-
 cgit.h       |    1 +
 cgitrc.5.txt |   10 ++++++++++
 shared.c     |    2 ++
 4 files changed, 19 insertions(+), 1 deletion(-)

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 79605e7..99ea7a2 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".
 
+repo.inline-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,
+       '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.
+
 repo.logo::
        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 665f8ed..cd0782d 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;
 }
 

_______________________________________________
CGit mailing list
CGit@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/cgit

Reply via email to