0016-stagit-index.c-HTML5-it-Remove-Owner.patch (3508B)
- From 0d1b8ab205d7474b23cb53c9eb2df386a5b1c50d Mon Sep 17 00:00:00 2001
- From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
- Date: Wed, 1 Aug 2018 00:44:21 +0200
- Subject: [PATCH 16/22] stagit-index.c: HTML5 it, Remove Owner
- ---
- config.h | 2 ++
- stagit-index.c | 31 +++++++++++++++++++------------
- 2 files changed, 21 insertions(+), 12 deletions(-)
- diff --git a/config.h b/config.h
- index ee798da..2be90bb 100644
- --- a/config.h
- +++ b/config.h
- @@ -3,3 +3,5 @@ static const unsigned summarylen = 70; /* summary length in the log */
- static const int showlinecount = 1; /* display line count or file size in file tree index */
- static const char *assetpath = "/git/"; /* Where are the assets (example: assetpath/style.css ) */
- static const char *faviconurl = "/git/logo.png"; /* Where is the favicon (example: /favicon.png ) */
- +static const char *repo_name = "/git/";
- +static const char *repo_description = "Lanodan’s git repositories";
- diff --git a/stagit-index.c b/stagit-index.c
- index 3d38142..19eb047 100644
- --- a/stagit-index.c
- +++ b/stagit-index.c
- @@ -12,6 +12,7 @@
- #include <git2.h>
- #include "compat.h"
- +#include "config.h"
- static git_repository *repo;
- @@ -73,24 +74,32 @@ writeheader(FILE *fp)
- "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"
- "<title>", fp);
- xmlencode(fp, description, strlen(description));
- - fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", relpath);
- + if(strlen(faviconurl) > 0) {
- + fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%s\" />\n", faviconurl);
- + } else {
- + fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", assetpath);
- + }
- fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", relpath);
- - fputs("</head>\n<body>\n", fp);
- - fprintf(fp, "<table>\n<tr><td><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></td>\n"
- - "<td><span class=\"desc\">", relpath);
- - xmlencode(fp, description, strlen(description));
- - fputs("</span></td></tr><tr><td></td><td>\n"
- - "</td></tr>\n</table>\n<hr/>\n<div id=\"content\">\n"
- + fputs("</head>\n<body>\n<header>", fp);
- + fprintf(fp, "<img src=\"%slogo.png\" alt=\"logo\" width=\"32\" height=\"32\" />",
- + assetpath);
- + fputs("<h1>", fp);
- + xmlencode(fp, repo_name, strlen(repo_name));
- + fputs("</h1><span class=\"desc\">", fp);
- + xmlencode(fp, repo_description, strlen(repo_description));
- + fputs("</span></header>", fp);
- + fputs("<main>\n"
- "<table id=\"index\"><thead>\n"
- - "<tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Owner</b></td>"
- - "<td><b>Last commit</b></td></tr>"
- + "<tr><th>Name</th><th>Description</th>"
- + "<th>Last commit</th></tr>"
- "</thead><tbody>\n", fp);
- }
- void
- writefooter(FILE *fp)
- {
- - fputs("</tbody>\n</table>\n</div>\n",fp);
- + fputs("</tbody>\n</table>\n",fp);
- + fputs("</main>\n", fp);
- fputs("\t<footer>Please <a href=\"https://hacktivis.me/about\">contact me</a> by any means for patches, issues(tracker will maybe be added oneday), thanks/donations, or whatever else.</footer>\n", fp);
- fputs("</body>\n</html>\n", fp);
- }
- @@ -132,8 +141,6 @@ writelog(FILE *fp)
- fputs("</a></td><td>", fp);
- xmlencode(fp, description, strlen(description));
- fputs("</td><td>", fp);
- - xmlencode(fp, owner, strlen(owner));
- - fputs("</td><td>", fp);
- if (author)
- printtimeshort(fp, &(author->when));
- fputs("</td></tr>", fp);
- --
- 2.26.2