From e800bceb63806227be34a14fcbbbcfd92545e7c4 Mon Sep 17 00:00:00 2001 From: Georgios Atheridis Date: Tue, 27 Dec 2022 10:32:52 +0000 Subject: [PATCH] add namespaces to stagit-index output --- stagit-index.c | 22 ++++++++++++++++++++++ style.css | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/stagit-index.c b/stagit-index.c index 223756c..a5eddc4 100644 --- a/stagit-index.c +++ b/stagit-index.c @@ -6,6 +6,7 @@ #include #include #include +#include #include @@ -119,6 +120,20 @@ writeheader(FILE *fp) "\n", fp); } +void +writenamespace(FILE *fp) +{ + fputs("", fp); + namespace[0] = toupper(namespace[0]); + xmlencode(fp, namespace, strlen(description)); + namespace[0] = tolower(namespace[0]); + fputs("", fp); + fputs("", fp); + fputs("", fp); + fputs("", fp); +} + + void writefooter(FILE *fp) { @@ -204,6 +219,7 @@ main(int argc, char *argv[]) writeheader(stdout); + char *old_namespace = ""; for (i = 1; i < argc; i++) { repodir = argv[i]; if (!realpath(repodir, repodirabs)) @@ -219,6 +235,12 @@ main(int argc, char *argv[]) /* use directory name as name and namespace*/ name = basename(repodirabs); namespace = basename(dirname(repodirabs)); + if (strcmp(old_namespace, namespace) != 0) { + writenamespace(stdout); + old_namespace = malloc( sizeof *namespace ); + memcpy(old_namespace, namespace, strlen(namespace)); + } + /* read description or .git/description */ joinpath(path, sizeof(path), repodir, "description"); diff --git a/style.css b/style.css index 043ffcd..04b8093 100644 --- a/style.css +++ b/style.css @@ -89,6 +89,10 @@ td.num { text-align: right; } +td.namespace { + font-style: italic; +} + .desc { color: #555; } -- 2.30.2