commit: 50535ce6876666e1c877d9a6f0bd05d5318c163e
parent 04148136f949cfac11d17a7b1a2436d00b3c6c84
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 30 Apr 2017 19:24:33 +0200
HTML5, faviconurl, -Wall
Diffstat:
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/config.h b/config.h
@@ -2,3 +2,4 @@
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 ) */
diff --git a/stagit.c b/stagit.c
@@ -512,7 +512,9 @@ writeheader(FILE *fp, const char *title)
if (description[0])
fputs(" - ", fp);
xmlencode(fp, description, strlen(description));
- fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", assetpath);
+ if(strlen(faviconurl) > 0) {
+ fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%s\" />\n", faviconurl);
+ }
fputs("<link rel=\"alternate\" type=\"application/atom+xml\" title=\"", fp);
xmlencode(fp, name, strlen(name));
fprintf(fp, " Atom Feed\" href=\"%satom.xml\" />\n", relpath);
@@ -520,25 +522,25 @@ writeheader(FILE *fp, const char *title)
xmlencode(fp, name, strlen(name));
fprintf(fp, " Atom Feed (tags)\" href=\"%stags.xml\" />\n", relpath);
fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", assetpath);
- fputs("</head>\n<body>\n<table><tr><td>", fp);
+ fputs("</head>\n<body>\n<header>", fp);
fprintf(fp, "<a href=\"..\"><img src=\"%slogo.png\" alt=\"logo\" width=\"32\" height=\"32\" /></a>",
assetpath);
- fputs("</td><td><h1>", fp);
+ fputs("<h1>", fp);
xmlencode(fp, strippedname, strlen(strippedname));
fputs("</h1><span class=\"desc\">", fp);
xmlencode(fp, description, strlen(description));
- fputs("</span></td></tr>", fp);
+ fputs("</span>", fp);
if (cloneurl[0]) {
- fputs("<tr class=\"url\"><td></td><td>git clone <a href=\"", fp);
+ fputs("<code class=\"url\"><td></td><td>git clone <a rel=\"vcs-git\" href=\"", fp);
xmlencode(fp, cloneurl, strlen(cloneurl)); /* not percent-encoded */
fputs("\">", fp);
xmlencode(fp, cloneurl, strlen(cloneurl));
- fputs("</a></td></tr>", fp);
+ fputs("</a></code>", fp);
}
- fputs("<tr><td></td><td>\n", fp);
- fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath);
- fprintf(fp, "<a href=\"%sfiles.html\">Files</a> | ", relpath);
- fprintf(fp, "<a href=\"%srefs.html\">Refs</a>", relpath);
+ fputs("</header><nav>\n", fp);
+ fprintf(fp, " <a rel=\"version-history\" href=\"%slog.html\">Log</a>", relpath);
+ fprintf(fp, " <a rel=\"index\" href=\"%sfiles.html\">Files</a>", relpath);
+ fprintf(fp, " <a href=\"%srefs.html\">Refs</a>", relpath);
if (submodules)
fprintf(fp, " | <a href=\"%sfile/%s.html\">Submodules</a>",
relpath, submodules);
@@ -548,13 +550,13 @@ 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("</nav>\n<main>\n", fp);
}
void
writefooter(FILE *fp)
{
- fputs("</div>\n</body>\n</html>\n", fp);
+ fputs("</main>\n</body>\n</html>\n", fp);
}
size_t