commit 143e7419ad416436f2f97d4aee1e9131114f97cc
parent db0fe324acd3dd9eef8c7e3fb5e214a29f979356
Author: Pollux <pollux@pollux.codes>
Date: Thu, 24 Jul 2025 00:36:55 -0500
feat: Add code element id and sticky class ("s")
These can be used for intelligent horizontal scrolling, since my site is
pretty narrow.
Signed-off-by: Pollux <pollux@pollux.codes>
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/stagit.c b/stagit.c
@@ -728,7 +728,7 @@ printshowfile(FILE *fp, struct commitinfo *ci) {
fputs("</span></td></tr>\n", fp);
}
fprintf(fp,
- "</table></pre><pre>%zu file%s changed, %zu insertion%s(+), %zu deletion%s(-)\n",
+ "</table></pre><pre id=\"code\"><span class=\"s\">%zu file%s changed, %zu insertion%s(+), %zu deletion%s(-)</span>\n",
ci->filecount, ci->filecount == 1 ? "" : "s", ci->addcount,
ci->addcount == 1 ? "" : "s", ci->delcount,
ci->delcount == 1 ? "" : "s");
@@ -738,7 +738,7 @@ printshowfile(FILE *fp, struct commitinfo *ci) {
for(i = 0; i < ci->ndeltas; i++) {
patch = ci->deltas[i]->patch;
delta = git_patch_get_delta(patch);
- fprintf(fp, "<b>diff --git a/<a id=\"h%zu\" href=\"%sfile/", i,
+ fprintf(fp, "<b class=\"s\">diff --git a/<a id=\"h%zu\" href=\"%sfile/", i,
relpath);
percentencode(fp, delta->old_file.path,
strlen(delta->old_file.path));
@@ -765,7 +765,7 @@ printshowfile(FILE *fp, struct commitinfo *ci) {
break;
fprintf(fp,
- "<a href=\"#h%zu-%zu\" id=\"h%zu-%zu\" class=\"h\">",
+ "<a href=\"#h%zu-%zu\" id=\"h%zu-%zu\" class=\"h s\">",
i, j, i, j);
xmlencode(fp, hunk->header, hunk->header_len);
fputs("</a>", fp);