stagit

static git page generator  https://git.ce9e.org
git clone https://git.ce9e.org/stagit.git

commit
2ca7ff6e28f531211ad5439d446a287c356a2f29
parent
a30365a2d653297d6fffae202aa12cb8f08a175e
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-03-29 19:23
add url

Diffstat

M stagit.c.in 18 ++++++++++++++++--

1 files changed, 16 insertions, 2 deletions


diff --git a/stagit.c.in b/stagit.c.in

@@ -57,6 +57,7 @@ static const char *repodir;
   57    57 char repodirabs[PATH_MAX + 1];
   58    58 static char *reponame = "";
   59    59 static char description[255];
   -1    60 static char url[255];
   60    61 
   61    62 void
   62    63 joinpath(char *buf, size_t bufsiz, const char *path, const char *path2)
@@ -339,8 +340,14 @@ write_header(FILE *fp, const char *title, const char *relpath)
  339   340 		T("<a href=\"{relpath:%s}..\"><img src=\"{logo:%s}\" alt=\"\" width=\"32\" height=\"32\" /></a>");
  340   341 	T("<div>\n");
  341   342 	T("<h1>{reponame}</h1>");
  342    -1 	if (description[0]) {
  343    -1 		T("<div class=\"desc\">{description}</div>");
   -1   343 	if (description[0] || url[0]) {
   -1   344 		T("<div class=\"desc\">{description}");
   -1   345 		if (description[0] && url[0])
   -1   346 			T("&nbsp; ");
   -1   347 		if (url[0]) {
   -1   348 			T("<a href=\"{url}\">{url}</a>");
   -1   349 		}
   -1   350 		T("</div>");
  344   351 	}
  345   352 	if (cloneurl[0]) {
  346   353 		T("<div class=\"cloneurl\">git clone {cloneurl}{reponame}</div>\n");
@@ -823,6 +830,13 @@ get_metadata(void)
  823   830 			description[0] = '\0';
  824   831 		fclose(fpread);
  825   832 	}
   -1   833 
   -1   834 	joinpath(path, sizeof(path), repodir, "url");
   -1   835 	if ((fpread = fopen(path, "r"))) {
   -1   836 		if (!fgets(url, sizeof(url), fpread))
   -1   837 			url[0] = '\0';
   -1   838 		fclose(fpread);
   -1   839 	}
  826   840 }
  827   841 
  828   842 int