[PATCH 1/2] config: add root-desc-html and repo.desc-html

Andy Green andy at warmcat.com
Thu Jun 21 08:46:28 CEST 2018

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

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 <andy at warmcat.com>
 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".
+	Optional additional raw html to show in the header after root-desc.
+	Default value: none.
 	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::
 	The value to show as repository description. Default value: none.
+	Optional additional raw html to show in the header after repo.desc.
+	Default value: none.
 	Override the default email-filter. Default value: none. See also:
 	"enable-filter-overrides". See also: "FILTER API".

More information about the CGit mailing list