diff --git a/stagit-index.c b/stagit-index.c
@@ -69,14 +69,21 @@ writeheader(FILE *fp)
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n"
"<title>", fp);
xmlencode(fp, description, strlen(description));
- fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", relpath);
- fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", relpath);
+ fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/svg\" href=\"/icons/favicon.svg\" />\n");
+ fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/styles.css\" />\n", relpath);
fputs("</head>\n<body>\n", fp);
- fprintf(fp, "<table>\n<tr><td><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></td>\n"
- "<td><span class=\"desc\">", relpath);
+
+ // The navigation bar
+ fputs("<nav>\n", fp);
+ fputs("<a href=\"https://pablo.escobar.life\">@pablo 🚬️</a>\n", fp);
+ fputs("<a href=\"https://git.escobar.life\">repos 🙀️</a>\n", fp);
+ fputs("</nav>\n", fp);
+
+ fputs("<main>\n<h1>", fp);
xmlencode(fp, description, strlen(description));
- fputs("</span></td></tr><tr><td></td><td>\n"
- "</td></tr>\n</table>\n<hr/>\n<div id=\"content\">\n"
+ fputs("</h1>\n", fp);
+ fputs("<p>My personal repositories</p>\n", fp);
+ fputs("<div class=\"table-container\">\n"
"<table id=\"index\"><thead>\n"
"<tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Owner</b></td>"
"<td><b>Last commit</b></td></tr>"
@@ -86,7 +93,9 @@ writeheader(FILE *fp)
void
writefooter(FILE *fp)
{
- fputs("</tbody>\n</table>\n</div>\n</body>\n</html>\n", fp);
+ fputs("</tbody>\n</table>\n</div>\n</main>\n", fp);
+ fputs("<footer>Pablo © 2020</footer>\n", fp);
+ fputs("</body>\n</html>\n", fp);
}
int
@@ -128,7 +137,13 @@ writelog(FILE *fp)
xmlencode(fp, owner, strlen(owner));
fputs("</td><td>", fp);
if (author)
+ {
+ fputs("<time datetime=\"", fp);
+ printtimeshort(fp, &(author->when));
+ fputs("\">", fp);
printtimeshort(fp, &(author->when));
+ fputs("</time>", fp);
+ }
fputs("</td></tr>", fp);
git_commit_free(commit);
diff --git a/stagit.c b/stagit.c
@@ -459,47 +459,53 @@ 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", relpath);
+ fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/svg\" href=\"/icons/favicon.svg\"/>\n");
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", relpath);
- fputs("</head>\n<body>\n<table><tr><td>", fp);
- fprintf(fp, "<a href=\"../%s\"><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></a>",
- relpath, relpath);
- fputs("</td><td><h1>", fp);
+ fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/styles.css\" />\n", relpath);
+ fputs("</head>\n<body>\n", fp);
+
+ // The navigation bar
+ fputs("<nav>\n", fp);
+ fputs("<a href=\"https://pablo.escobar.life\">@pablo 🚬️</a>\n", fp);
+ fputs("<a href=\"https://git.escobar.life\">repos 🙀️</a>\n", fp);
+ fputs("</nav>\n", fp);
+
+ fputs("<main>\n<h1>", fp);
xmlencode(fp, strippedname, strlen(strippedname));
- fputs("</h1><span class=\"desc\">", fp);
+ fputs("</h1>\n<p>", fp);
xmlencode(fp, description, strlen(description));
- fputs("</span></td></tr>", fp);
+ fputs("</p>\n<ul>", fp);
if (cloneurl[0]) {
- fputs("<tr class=\"url\"><td></td><td>git clone <a href=\"", fp);
+ fputs("<li>git clone: <a href=\"", fp);
xmlencode(fp, cloneurl, strlen(cloneurl));
fputs("\">", fp);
xmlencode(fp, cloneurl, strlen(cloneurl));
- fputs("</a></td></tr>", fp);
+ fputs("</a></li>\n", 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);
+ fprintf(fp, "<li><a href=\"%slog.html\">Log</a></li>", relpath);
+ fprintf(fp, "<li><a href=\"%sfiles.html\">Files</a></li>", relpath);
+ fprintf(fp, "<li><a href=\"%srefs.html\">Refs</a></li>", relpath);
if (submodules)
- fprintf(fp, " | <a href=\"%sfile/%s.html\">Submodules</a>",
+ fprintf(fp, "<li><a href=\"%sfile/%s.html\">Submodules</a></li>\n",
relpath, submodules);
if (readme)
- fprintf(fp, " | <a href=\"%sfile/%s.html\">README</a>",
+ fprintf(fp, "<li><a href=\"%sfile/%s.html\">README</a></li>\n",
relpath, readme);
if (license)
- fprintf(fp, " | <a href=\"%sfile/%s.html\">LICENSE</a>",
+ fprintf(fp, "<li><a href=\"%sfile/%s.html\">LICENSE</a></li>\n",
relpath, license);
- fputs("</td></tr></table>\n<hr/>\n<div id=\"content\">\n", fp);
+ fputs("</ul>\n", fp);
}
void
writefooter(FILE *fp)
{
- fputs("</div>\n</body>\n</html>\n", fp);
+ fputs("</main>\n", fp);
+ fputs("<footer>Pablo © 2020</footer>\n", fp);
+ fputs("</body>\n</html>\n", fp);
}
size_t
@@ -530,7 +536,6 @@ writeblobhtml(FILE *fp, const git_blob *blob)
}
fputs("</pre>\n", fp);
-
return n;
}
@@ -632,12 +637,12 @@ printshowfile(FILE *fp, struct commitinfo *ci)
fwrite(&linestr[add], 1, del, fp);
fputs("</span></td></tr>\n", fp);
}
- fprintf(fp, "</table></pre><pre>%zu file%s changed, %zu insertion%s(+), %zu deletion%s(-)\n",
+ fprintf(fp, "</table>\n%zu file%s changed, %zu insertion%s(+), %zu deletion%s(-)\n",
ci->filecount, ci->filecount == 1 ? "" : "s",
ci->addcount, ci->addcount == 1 ? "" : "s",
ci->delcount, ci->delcount == 1 ? "" : "s");
- fputs("<hr/>", fp);
+ fputs("</pre>\n</div>\n<div class=\"codeblock\">\n<pre>", fp);
for (i = 0; i < ci->ndeltas; i++) {
patch = ci->deltas[i]->patch;
@@ -691,7 +696,13 @@ writelogline(FILE *fp, struct commitinfo *ci)
{
fputs("<tr><td>", fp);
if (ci->author)
+ {
+ fputs("<time datetime=\"", fp);
printtimeshort(fp, &(ci->author->when));
+ fputs("\">", fp);
+ printtimeshort(fp, &(ci->author->when));
+ fputs("</time>", fp);
+ }
fputs("</td><td>", fp);
if (ci->summary) {
fprintf(fp, "<a href=\"%scommit/%s.html\">", relpath, ci->oid);
@@ -766,9 +777,11 @@ writelog(FILE *fp, const git_oid *oid)
relpath = "../";
fpfile = efopen(path, "w");
writeheader(fpfile, ci->summary);
+ fputs("<div class=\"codeblock\">\n", fpfile);
fputs("<pre>", fpfile);
printshowfile(fpfile, ci);
fputs("</pre>\n", fpfile);
+ fputs("</div>\n", fpfile);
writefooter(fpfile);
fclose(fpfile);
}
@@ -909,23 +922,23 @@ writeblob(git_object *obj, const char *fpath, const char *filename, size_t files
fp = efopen(fpath, "w");
writeheader(fp, filename);
- fputs("<p> ", fp);
+ fputs("<div class=\"titled-block\">\n<h1>", fp);
xmlencode(fp, filename, strlen(filename));
fprintf(fp, " (%zuB)", filesize);
- fputs("</p><hr/>", fp);
+ fputs("</h1>\n<div class=\"codeblock\">", fp);
if (git_blob_is_binary((git_blob *)obj)) {
- fputs("<p>Binary file.</p>\n", fp);
+ fputs("<pre>Binary file</pre>\n", fp);
} else {
lc = writeblobhtml(fp, (git_blob *)obj);
if (ferror(fp))
err(1, "fwrite");
}
+ fputs("</div>\n</div>\n", fp);
writefooter(fp);
fclose(fp);
relpath = "";
-
return lc;
}
@@ -1048,7 +1061,7 @@ writefiles(FILE *fp, const git_oid *id)
git_commit *commit = NULL;
int ret = -1;
- fputs("<table id=\"files\"><thead>\n<tr>"
+ fputs("<div class=\"table-container\"><table id=\"files\"><thead>\n<tr>"
"<td><b>Mode</b></td><td><b>Name</b></td>"
"<td class=\"num\" align=\"right\"><b>Size</b></td>"
"</tr>\n</thead><tbody>\n", fp);
@@ -1057,7 +1070,7 @@ writefiles(FILE *fp, const git_oid *id)
!git_commit_tree(&tree, commit))
ret = writefilestree(fp, tree, "");
- fputs("</tbody></table>", fp);
+ fputs("</tbody></table></div>", fp);
git_commit_free(commit);
git_tree_free(tree);
@@ -1081,14 +1094,14 @@ writerefs(FILE *fp)
for (i = 0, j = 0, count = 0; i < refcount; i++) {
if (j == 0 && git_reference_is_tag(ris[i].ref)) {
if (count)
- fputs("</tbody></table><br/>\n", fp);
+ fputs("</tbody></table></div><br/>\n", fp);
count = 0;
j = 1;
}
/* print header if it has an entry (first). */
if (++count == 1) {
- fprintf(fp, "<h2>%s</h2><table id=\"%s\">"
+ fprintf(fp, "<h2>%s</h2><div class=\"table-container\"><table id=\"%s\">"
"<thead>\n<tr><td><b>Name</b></td>"
"<td><b>Last commit date</b></td>"
"<td><b>Author</b></td>\n</tr>\n"
@@ -1265,7 +1278,7 @@ main(int argc, char *argv[])
relpath = "";
mkdir("commit", S_IRWXU | S_IRWXG | S_IRWXO);
writeheader(fp, "Log");
- fputs("<table id=\"log\"><thead>\n<tr><td><b>Date</b></td>"
+ fputs("<div class=\"table-container\"><table id=\"log\"><thead>\n<tr><td><b>Date</b></td>"
"<td><b>Commit message</b></td>"
"<td><b>Author</b></td><td class=\"num\" align=\"right\"><b>Files</b></td>"
"<td class=\"num\" align=\"right\"><b>+</b></td>"
@@ -1309,7 +1322,7 @@ main(int argc, char *argv[])
writelog(fp, head);
}
- fputs("</tbody></table>", fp);
+ fputs("</tbody></table></div>", fp);
writefooter(fp);
fclose(fp);