stagit

Personal stagit fork
git clone git://git.alexwennerberg.com/stagit
Log | Files | Refs | README | LICENSE

commit ad2d1ad6ad71921d029c3fbba22a3d1b6f35cf5a
parent fb30edf6b64ef344074a4b3835981e926163dde6
Author: Armaan Bhojwani <me@armaanb.net>
Date:   Tue,  6 Apr 2021 14:38:37 -0400

Generate raw file if htmlized

Diffstat:
Msrc/stagit.c | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/stagit.c b/src/stagit.c @@ -848,7 +848,6 @@ writeblob(git_object *obj, const char *fpath, const char *filename, git_off_t fi fputs("<p> ", fp); xmlencode(fp, filename, strlen(filename)); fprintf(fp, " (%s)", convertbytes((int)filesize)); - fputs("</p><hr/>", fp); if (git_blob_is_binary((git_blob *)obj)) { @@ -857,6 +856,15 @@ writeblob(git_object *obj, const char *fpath, const char *filename, git_off_t fi writeblobhtml(filename, fp, (git_blob *)obj); if (ferror(fp)) err(1, "fwrite"); + else if (htmlized) { + /* NOTE: recurses */ + char newfpath[PATH_MAX]; + strcat(newfpath, fpath); + char newfilename[PATH_MAX]; + strcat(newfilename, filename); + writeblob(obj, strcat(newfpath, "-raw"), strcat(newfilename, "-raw"), filesize); + // TODO: Add view-raw button + } } writefooter(fp);