tAdd "Back to index" links from repository pages - stagit - static git page generator
(HTM) git clone git://src.adamsgaard.dk/stagit
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 8e6633b64f13aba222eab8996f83366ab12dc7c7
(DIR) parent 4e31f0fbbe6bf3b7836bf3e0f4a7087dbbf91e9c
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 3 Jan 2020 10:27:50 +0100
Add "Back to index" links from repository pages
Diffstat:
M stagit.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/stagit.c b/stagit.c
t@@ -51,6 +51,7 @@ static git_repository *repo;
static const char *relpath = "";
static const char *repodir;
+static char index_link[255] = "<a href=\"..\">Back to index</a>";
static char *name = "";
static char *strippedname = "";
t@@ -355,10 +356,10 @@ writeheader(FILE *fp, const char *title)
fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s Atom Feed\" href=\"%satom.xml\" />\n",
name, relpath);
fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", relpath);
- fputs("</head>\n<body>\n<table><tr><td>", fp);
+ fputs("</head>\n<body>\n<table style=\"width:100%\"><tr><td>", fp);
fprintf(fp, "<a href=\"../%s\"><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></a>",
relpath, relpath);
- fputs("</td><td><h1>", fp);
+ fputs("</td><td style=\"width:99%\"><h1>", fp);
xmlencode(fp, strippedname, strlen(strippedname));
fputs("</h1><span class=\"desc\">", fp);
xmlencode(fp, description, strlen(description));
t@@ -383,7 +384,9 @@ writeheader(FILE *fp, const char *title)
if (license)
fprintf(fp, " | <a href=\"%sfile/%s.html\">LICENSE</a>",
relpath, license);
- fputs("</td></tr></table>\n<hr/>\n<div id=\"content\">\n", fp);
+ fputs("</td>\n", fp);
+ fprintf(fp, "<td style=\"text-align:right;white-space:nowrap\">%s</td>", index_link);
+ fputs("</tr></table>\n<hr/>\n<div id=\"content\">\n", fp);
}
void