stagit

highlight/make bold some fields

Hiltjo Posthuma contact@arjunchoudhary.com

commit: 6af8945 parent: 8c6aef7
2 files changed, 14 insertions(+), 8 deletions(-)
Mstyle.css+4-0
Murmoms.c+10-8
M · style.css +4, -0
 1@@ -48,6 +48,10 @@ pre {
 2 	font-family: monospace;
 3 }
 4 
 5+pre span.h {
 6+	color: blue;
 7+}
 8+
 9 pre span.i {
10 	color: green;
11 }
M · urmoms.c +10, -8
 1@@ -165,15 +165,15 @@ printcommit(FILE *fp, git_commit *commit)
 2 
 3 	/* TODO: show tag when commit has it */
 4 	git_oid_tostr(buf, sizeof(buf), git_commit_id(commit));
 5-	fprintf(fp, "commit <a href=\"%scommit/%s.html\">%s</a>\n",
 6+	fprintf(fp, "<b>commit</b> <a href=\"%scommit/%s.html\">%s</a>\n",
 7 		relpath, buf, buf);
 8 
 9 	if (git_oid_tostr(buf, sizeof(buf), git_commit_parent_id(commit, 0)))
10-		fprintf(fp, "parent <a href=\"%scommit/%s.html\">%s</a>\n",
11+		fprintf(fp, "<b>parent</b> <a href=\"%scommit/%s.html\">%s</a>\n",
12 			relpath, buf, buf);
13 
14 	if ((count = (int)git_commit_parentcount(commit)) > 1) {
15-		fprintf(fp, "Merge:");
16+		fprintf(fp, "<b>Merge:</b>");
17 		for (i = 0; i < count; ++i) {
18 			git_oid_tostr(buf, 8, git_commit_parent_id(commit, i));
19 			fprintf(fp, " <a href=\"%scommit/%s.html\">%s</a>",
20@@ -182,13 +182,13 @@ printcommit(FILE *fp, git_commit *commit)
21 		fputc('\n', fp);
22 	}
23 	if ((sig = git_commit_author(commit)) != NULL) {
24-		fprintf(fp, "Author: ");
25+		fprintf(fp, "<b>Author:</b> ");
26 		xmlencode(fp, sig->name, strlen(sig->name));
27 		fprintf(fp, " &lt;<a href=\"mailto:");
28 		xmlencode(fp, sig->email, strlen(sig->email));
29 		fputs("\">", fp);
30 		xmlencode(fp, sig->email, strlen(sig->email));
31-		fputs("</a>&gt;\nDate:   ", fp);
32+		fputs("</a>&gt;\n<b>Date:</b>   ", fp);
33 		printtime(fp, &sig->when);
34 		fputc('\n', fp);
35 	}
36@@ -238,7 +238,7 @@ printshowfile(git_commit *commit)
37 	if (!git_diff_get_stats(&diffstats, diff)) {
38 		if (!git_diff_stats_to_buf(&diffstatsbuf, diffstats,
39 		    GIT_DIFF_STATS_FULL | GIT_DIFF_STATS_SHORT, 80)) {
40-			fprintf(fp, "Diffstat:\n");
41+			fprintf(fp, "<b>Diffstat:</b>\n");
42 			fputs(diffstatsbuf.ptr, fp);
43 		}
44 		git_diff_stats_free(diffstats);
45@@ -253,10 +253,12 @@ printshowfile(git_commit *commit)
46 		}
47 
48 		delta = git_patch_get_delta(patch);
49-		fprintf(fp, "diff --git a/<a href=\"%sfile/%s\">%s</a> b/<a href=\"%sfile/%s\">%s</a>\n",
50+		fprintf(fp, "<b>diff --git a/<a href=\"%sfile/%s\">%s</a> b/<a href=\"%sfile/%s\">%s</a></b>\n",
51 			relpath, delta->old_file.path, delta->old_file.path,
52 			relpath, delta->new_file.path, delta->new_file.path);
53 
54+		/* TODO: add --- and +++ lines */
55+
56 #if 0
57 		switch (delta->flags) {
58 		case GIT_DIFF_FLAG_BINARY:
59@@ -273,7 +275,7 @@ printshowfile(git_commit *commit)
60 			if (git_patch_get_hunk(&hunk, &nhunklines, patch, j))
61 				break; /* TODO: handle error ? */
62 
63-			fprintf(fp, "%s\n", hunk->header);
64+			fprintf(fp, "<span class=\"h\">%s</span>\n", hunk->header);
65 
66 			for (k = 0; ; k++) {
67 				if (git_patch_get_line_in_hunk(&line, patch, j, k))