logo

stagit

STAtic GIT web view generator (in C) git clone https://hacktivis.me/git/stagit.git
commit: c8d9110a5b3eacc4ccc059fff8b08cf49bd187cb
parent 92e9fdd3118ff831a9539693af848610649ed642
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun, 30 Apr 2017 19:24:33 +0200

HTML5, faviconurl, -Wall

Diffstat:

Mconfig.h1+
Mstagit.c26++++++++++++++------------
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 @@ -480,31 +480,33 @@ 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); + } fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s Atom Feed\" href=\"%satom.xml\" />\n", name, relpath); fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s Atom Feed (tags)\" href=\"%stags.xml\" />\n", name, 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)); 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); @@ -514,13 +516,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