]> git.armaanb.net Git - stagit.git/blobdiff - src/stagit.c
Generate raw file if htmlized
[stagit.git] / src / stagit.c
index be6d8593c9913d3ac5f02ba7fc2381d46dcaa9ae..b71eeda0db64c440eceda86eb7940ded010f574f 100644 (file)
@@ -367,7 +367,7 @@ writeheader(FILE *fp, const char *title)
        fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", relpath);
        fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%ssyntax.css\" />\n", relpath);
        fputs("</head>\n<body>\n<table><tr><td>", fp);
-       fprintf(fp, "<a href=\"../%s\"><img alt=\"Go home\" src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></a>",
+       fprintf(fp, "<a href=\"../%s\"><img alt=\"Home\" src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></a>",
                relpath, relpath);
        fputs("</td><td><h1>", fp);
        xmlencode(fp, strippedname, strlen(strippedname));
@@ -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);