logo

etc_portage

Unnamed repository; edit this file 'description' to name the repository. git clone https://hacktivis.me/git/etc_portage.git

0012-HTML5-faviconurl-Wall.patch (3692B)


  1. From 5790cec7b177dfdda54f7b9ee0df4e1f1b5ed2c3 Mon Sep 17 00:00:00 2001
  2. From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
  3. Date: Sun, 30 Apr 2017 19:24:33 +0200
  4. Subject: [PATCH 12/22] HTML5, faviconurl, -Wall
  5. ---
  6. config.h | 1 +
  7. config.mk | 2 +-
  8. stagit.c | 26 ++++++++++++++------------
  9. 3 files changed, 16 insertions(+), 13 deletions(-)
  10. diff --git a/config.h b/config.h
  11. index 09a5b79..ee798da 100644
  12. --- a/config.h
  13. +++ b/config.h
  14. @@ -2,3 +2,4 @@
  15. static const unsigned summarylen = 70; /* summary length in the log */
  16. static const int showlinecount = 1; /* display line count or file size in file tree index */
  17. static const char *assetpath = "/git/"; /* Where are the assets (example: assetpath/style.css ) */
  18. +static const char *faviconurl = "/git/logo.png"; /* Where is the favicon (example: /favicon.png ) */
  19. diff --git a/config.mk b/config.mk
  20. index 90419a0..9a3cfe8 100644
  21. --- a/config.mk
  22. +++ b/config.mk
  23. @@ -20,7 +20,7 @@ LIBS = -L${GITLIB} -lgit2
  24. #LDFLAGS = ${LIBS}
  25. # optimized
  26. -CFLAGS = -O2 -std=c99 ${INCS}
  27. +CFLAGS = -O2 -std=c99 -Wall ${INCS}
  28. LDFLAGS = -s ${LIBS}
  29. # optimized static
  30. diff --git a/stagit.c b/stagit.c
  31. index ee7ffe9..2be3d6b 100644
  32. --- a/stagit.c
  33. +++ b/stagit.c
  34. @@ -352,29 +352,31 @@ writeheader(FILE *fp, const char *title)
  35. if (description[0])
  36. fputs(" - ", fp);
  37. xmlencode(fp, description, strlen(description));
  38. - fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", assetpath);
  39. + if(strlen(faviconurl) > 0) {
  40. + fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%s\" />\n", faviconurl);
  41. + }
  42. fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s Atom Feed\" href=\"%satom.xml\" />\n",
  43. name, relpath);
  44. fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", assetpath);
  45. - fputs("</head>\n<body>\n<table><tr><td>", fp);
  46. + fputs("</head>\n<body>\n<header>", fp);
  47. fprintf(fp, "<a href=\"..\"><img src=\"%slogo.png\" alt=\"logo\" width=\"32\" height=\"32\" /></a>",
  48. assetpath);
  49. - fputs("</td><td><h1>", fp);
  50. + fputs("<h1>", fp);
  51. xmlencode(fp, strippedname, strlen(strippedname));
  52. fputs("</h1><span class=\"desc\">", fp);
  53. xmlencode(fp, description, strlen(description));
  54. - fputs("</span></td></tr>", fp);
  55. + fputs("</span>", fp);
  56. if (cloneurl[0]) {
  57. - fputs("<tr class=\"url\"><td></td><td>git clone <a href=\"", fp);
  58. + fputs("<code class=\"url\"><td></td><td>git clone <a rel=\"vcs-git\" href=\"", fp);
  59. xmlencode(fp, cloneurl, strlen(cloneurl));
  60. fputs("\">", fp);
  61. xmlencode(fp, cloneurl, strlen(cloneurl));
  62. - fputs("</a></td></tr>", fp);
  63. + fputs("</a></code>", fp);
  64. }
  65. - fputs("<tr><td></td><td>\n", fp);
  66. - fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath);
  67. - fprintf(fp, "<a href=\"%sfiles.html\">Files</a> | ", relpath);
  68. - fprintf(fp, "<a href=\"%srefs.html\">Refs</a>", relpath);
  69. + fputs("</header><nav>\n", fp);
  70. + fprintf(fp, " <a rel=\"version-history\" href=\"%slog.html\">Log</a>", relpath);
  71. + fprintf(fp, " <a rel=\"index\" href=\"%sfiles.html\">Files</a>", relpath);
  72. + fprintf(fp, " <a href=\"%srefs.html\">Refs</a>", relpath);
  73. if (submodules)
  74. fprintf(fp, " | <a href=\"%sfile/%s.html\">Submodules</a>",
  75. relpath, submodules);
  76. @@ -384,13 +386,13 @@ writeheader(FILE *fp, const char *title)
  77. if (license)
  78. fprintf(fp, " | <a href=\"%sfile/%s.html\">LICENSE</a>",
  79. relpath, license);
  80. - fputs("</td></tr></table>\n<hr/>\n<div id=\"content\">\n", fp);
  81. + fputs("</nav>\n<main>\n", fp);
  82. }
  83. void
  84. writefooter(FILE *fp)
  85. {
  86. - fputs("</div>\n</body>\n</html>\n", fp);
  87. + fputs("</main>\n</body>\n</html>\n", fp);
  88. }
  89. int
  90. --
  91. 2.26.2