fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", relpath);
fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s Atom Feed\" href=\"%satom.xml\" />\n",
name, relpath);
- fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.min.css\" />\n", relpath);
+ 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 src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></a>",
relpath, relpath);
fputs("</td><td><h1>", fp);
xmlencode(fp, strippedname, strlen(strippedname));
- fputs("</h1><span class=\"desc\">", fp);
+ fputs("</h1></td></tr><tr><td></td><td><span class=\"desc\">", fp);
xmlencode(fp, description, strlen(description));
fputs("</span></td></tr>", fp);
if (cloneurl[0]) {
if (license)
fprintf(fp, " | <a href=\"%sfile/%s.html\">LICENSE</a>",
relpath, license);
+ fprintf(fp, " | <a href=\"%s%s.tar.gz\">Download</a>",
+ relpath, strippedname);
fputs("</td></tr></table>\n<hr/>\n<div id=\"content\">\n", fp);
}
}
int
-call_py(const char *filename, FILE *fp, const char *s, size_t len)
+call_chroma(const char *filename, FILE *fp, const char *s, size_t len)
{
// Flush HTML-file
fflush(fp);
// Redirect STDOUT
dup2(fileno(fp), 1);
- // Python Pygments script for syntax highlighting.
- FILE *child = popen("/usr/local/share/stagit/highlight.py", "w");
+ char cmd[] = "chroma --html --html-only --html-lines --html-lines-table --filename ";
+ strcat(cmd, filename);
+
+ FILE *child = popen(cmd, "w");
if (child == NULL) {
printf("child is null: %s", strerror(errno));
exit(1);
git_off_t len = git_blob_rawsize(blob);
if (len > 0) {
- lc = call_py(filename, fp, s, len);
+ lc = call_chroma(filename, fp, s, len);
}
return lc;
printcommit(FILE *fp, struct commitinfo *ci)
{
fprintf(fp, "<b>commit</b> <a href=\"%scommit/%s.html\">%s</a>\n",
- relpath, ci->oid, ci->oid);
+ relpath, ci->oid, ci->oid);
if (ci->parentoid[0])
fprintf(fp, "<b>parent</b> <a href=\"%scommit/%s.html\">%s</a>\n",
- relpath, ci->parentoid, ci->parentoid);
+ relpath, ci->parentoid, ci->parentoid);
if (ci->author) {
fputs("<b>Author:</b> ", fp);
strcpy(cwd, getcwd(cwd, sizeof(cwd)));
cp("/usr/local/share/stagit/syntax.css", strcat(cwd, "/syntax.css"));
strcpy(cwd, getcwd(cwd, sizeof(cwd)));
- cp("/usr/local/share/stagit/style.min.css", strcat(cwd, "/style.min.css"));
+ cp("/usr/local/share/stagit/style.css", strcat(cwd, "/style.css"));
/* strip .git suffix */
if (!(strippedname = strdup(name)))
submodules = ".gitmodules";
git_object_free(obj);
+ /* Generate tarball */
+ char tarball[255];
+ sprintf(tarball, "tar -zcf %s.tar.gz --ignore-failed-read --exclude='.git' %s",
+ strippedname, repodir);
+ system(tarball);
+
/* log for HEAD */
fp = efopen("log.html", "w");
relpath = "";