}
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);
return lc;
}
-int
+ int
writeblobhtml(const char *filename, FILE *fp, const git_blob *blob)
{
int lc = 0;
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;
}
-void
+ void
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);
}
}
-void
+ void
printshowfile(FILE *fp, struct commitinfo *ci)
{
const git_diff_delta *delta;