0012-HTML5-faviconurl-Wall.patch (3692B)
- From 5790cec7b177dfdda54f7b9ee0df4e1f1b5ed2c3 Mon Sep 17 00:00:00 2001
- From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
- Date: Sun, 30 Apr 2017 19:24:33 +0200
- Subject: [PATCH 12/22] HTML5, faviconurl, -Wall
- ---
- config.h | 1 +
- config.mk | 2 +-
- stagit.c | 26 ++++++++++++++------------
- 3 files changed, 16 insertions(+), 13 deletions(-)
- diff --git a/config.h b/config.h
- index 09a5b79..ee798da 100644
- --- 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/config.mk b/config.mk
- index 90419a0..9a3cfe8 100644
- --- a/config.mk
- +++ b/config.mk
- @@ -20,7 +20,7 @@ LIBS = -L${GITLIB} -lgit2
- #LDFLAGS = ${LIBS}
- # optimized
- -CFLAGS = -O2 -std=c99 ${INCS}
- +CFLAGS = -O2 -std=c99 -Wall ${INCS}
- LDFLAGS = -s ${LIBS}
- # optimized static
- diff --git a/stagit.c b/stagit.c
- index ee7ffe9..2be3d6b 100644
- --- a/stagit.c
- +++ b/stagit.c
- @@ -352,29 +352,31 @@ 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=\"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);
- @@ -384,13 +386,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);
- }
- int
- --
- 2.26.2