logo

etc_portage

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

0016-stagit-index.c-HTML5-it-Remove-Owner.patch (3508B)


  1. From 0d1b8ab205d7474b23cb53c9eb2df386a5b1c50d Mon Sep 17 00:00:00 2001
  2. From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
  3. Date: Wed, 1 Aug 2018 00:44:21 +0200
  4. Subject: [PATCH 16/22] stagit-index.c: HTML5 it, Remove Owner
  5. ---
  6. config.h | 2 ++
  7. stagit-index.c | 31 +++++++++++++++++++------------
  8. 2 files changed, 21 insertions(+), 12 deletions(-)
  9. diff --git a/config.h b/config.h
  10. index ee798da..2be90bb 100644
  11. --- a/config.h
  12. +++ b/config.h
  13. @@ -3,3 +3,5 @@ static const unsigned summarylen = 70; /* summary length in the log */
  14. static const int showlinecount = 1; /* display line count or file size in file tree index */
  15. static const char *assetpath = "/git/"; /* Where are the assets (example: assetpath/style.css ) */
  16. static const char *faviconurl = "/git/logo.png"; /* Where is the favicon (example: /favicon.png ) */
  17. +static const char *repo_name = "/git/";
  18. +static const char *repo_description = "Lanodan’s git repositories";
  19. diff --git a/stagit-index.c b/stagit-index.c
  20. index 3d38142..19eb047 100644
  21. --- a/stagit-index.c
  22. +++ b/stagit-index.c
  23. @@ -12,6 +12,7 @@
  24. #include <git2.h>
  25. #include "compat.h"
  26. +#include "config.h"
  27. static git_repository *repo;
  28. @@ -73,24 +74,32 @@ writeheader(FILE *fp)
  29. "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"
  30. "<title>", fp);
  31. xmlencode(fp, description, strlen(description));
  32. - fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", relpath);
  33. + if(strlen(faviconurl) > 0) {
  34. + fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%s\" />\n", faviconurl);
  35. + } else {
  36. + fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", assetpath);
  37. + }
  38. fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", relpath);
  39. - fputs("</head>\n<body>\n", fp);
  40. - fprintf(fp, "<table>\n<tr><td><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></td>\n"
  41. - "<td><span class=\"desc\">", relpath);
  42. - xmlencode(fp, description, strlen(description));
  43. - fputs("</span></td></tr><tr><td></td><td>\n"
  44. - "</td></tr>\n</table>\n<hr/>\n<div id=\"content\">\n"
  45. + fputs("</head>\n<body>\n<header>", fp);
  46. + fprintf(fp, "<img src=\"%slogo.png\" alt=\"logo\" width=\"32\" height=\"32\" />",
  47. + assetpath);
  48. + fputs("<h1>", fp);
  49. + xmlencode(fp, repo_name, strlen(repo_name));
  50. + fputs("</h1><span class=\"desc\">", fp);
  51. + xmlencode(fp, repo_description, strlen(repo_description));
  52. + fputs("</span></header>", fp);
  53. + fputs("<main>\n"
  54. "<table id=\"index\"><thead>\n"
  55. - "<tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Owner</b></td>"
  56. - "<td><b>Last commit</b></td></tr>"
  57. + "<tr><th>Name</th><th>Description</th>"
  58. + "<th>Last commit</th></tr>"
  59. "</thead><tbody>\n", fp);
  60. }
  61. void
  62. writefooter(FILE *fp)
  63. {
  64. - fputs("</tbody>\n</table>\n</div>\n",fp);
  65. + fputs("</tbody>\n</table>\n",fp);
  66. + fputs("</main>\n", fp);
  67. fputs("\t<footer>Please <a href=\"https://hacktivis.me/about\">contact me</a> by any means for patches, issues(tracker will maybe be added oneday), thanks/donations, or whatever else.</footer>\n", fp);
  68. fputs("</body>\n</html>\n", fp);
  69. }
  70. @@ -132,8 +141,6 @@ writelog(FILE *fp)
  71. fputs("</a></td><td>", fp);
  72. xmlencode(fp, description, strlen(description));
  73. fputs("</td><td>", fp);
  74. - xmlencode(fp, owner, strlen(owner));
  75. - fputs("</td><td>", fp);
  76. if (author)
  77. printtimeshort(fp, &(author->when));
  78. fputs("</td></tr>", fp);
  79. --
  80. 2.26.2