From mboxrd@z Thu Jan 1 00:00:00 1970 From: andy at warmcat.com (Andy Green) Date: Thu, 21 Jun 2018 14:46:28 +0800 Subject: [PATCH 1/2] config: add root-desc-html and repo.desc-html In-Reply-To: <45190b3f-ced1-2b5f-9d3e-c9da90192867@warmcat.com> References: <45190b3f-ced1-2b5f-9d3e-c9da90192867@warmcat.com> Message-ID: <152956358883.741.17751697642155677046.stgit@mail.warmcat.com> These are optional, default-empty raw html strings that are emitted after the corresponding text-only versions root-desc and repo.desc when they are used in the header area. This provides a flexible way to place buttons or links in the header region for both the repo index page and for repos individually. The existing root-desc and repo.desc keep their original meaning as a shortish text-only repo description. Signed-off-by: Andy Green --- cgit.c | 4 ++++ cgit.h | 2 ++ cgitrc.5.txt | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/cgit.c b/cgit.c index bdb2fad..1b819e7 100644 --- a/cgit.c +++ b/cgit.c @@ -52,6 +52,8 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va repo->clone_url = xstrdup(value); else if (!strcmp(name, "desc")) repo->desc = xstrdup(value); + else if (!strcmp(name, "desc-html")) + repo->desc_html = xstrdup(value); else if (!strcmp(name, "owner")) repo->owner = xstrdup(value); else if (!strcmp(name, "homepage")) @@ -142,6 +144,8 @@ static void config_cb(const char *name, const char *value) ctx.cfg.root_title = xstrdup(value); else if (!strcmp(name, "root-desc")) ctx.cfg.root_desc = xstrdup(value); + else if (!strcmp(name, "root-desc-html")) + ctx.cfg.root_desc_html = xstrdup(value); else if (!strcmp(name, "root-readme")) ctx.cfg.root_readme = xstrdup(value); else if (!strcmp(name, "css")) diff --git a/cgit.h b/cgit.h index 99ea7a2..1094062 100644 --- a/cgit.h +++ b/cgit.h @@ -81,6 +81,7 @@ struct cgit_repo { char *name; char *path; char *desc; + char *desc_html; char *owner; char *homepage; char *defbranch; @@ -207,6 +208,7 @@ struct cgit_config { char *robots; char *root_title; char *root_desc; + char *root_desc_html; char *root_readme; char *script_name; char *section; diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 99fc799..4ddb51e 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -378,6 +378,10 @@ root-desc:: Text printed below the heading on the repository index page. Default value: "a fast webinterface for the git dscm". +root-desc-html:: + Optional additional raw html to show in the header after root-desc. + Default value: none. + root-readme:: The content of the file specified with this option will be included verbatim below the "about" link on the repository index page. Default @@ -503,6 +507,10 @@ repo.defbranch:: repo.desc:: The value to show as repository description. Default value: none. +repo.desc-html:: + Optional additional raw html to show in the header after repo.desc. + Default value: none. + repo.email-filter:: Override the default email-filter. Default value: none. See also: "enable-filter-overrides". See also: "FILTER API".