]> git.armaanb.net Git - stagit.git/commitdiff
highlight/make bold some fields
authorHiltjo Posthuma <hiltjo@codemadness.org>
Mon, 7 Dec 2015 18:46:07 +0000 (19:46 +0100)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Mon, 7 Dec 2015 18:46:07 +0000 (19:46 +0100)
style.css
urmoms.c

index 5dc4a535c4616e9e720fcda3c9d0e0372270a784..2481dec67b8f045279e9e0d4e80e9402919858cb 100644 (file)
--- a/style.css
+++ b/style.css
@@ -48,6 +48,10 @@ pre {
        font-family: monospace;
 }
 
+pre span.h {
+       color: blue;
+}
+
 pre span.i {
        color: green;
 }
index 757bb386a6c48d0abe447556b7e853fa988ba75e..e467fe5b187566e8712119ae18e8ee8658f26131 100644 (file)
--- a/urmoms.c
+++ b/urmoms.c
@@ -165,15 +165,15 @@ printcommit(FILE *fp, git_commit *commit)
 
        /* TODO: show tag when commit has it */
        git_oid_tostr(buf, sizeof(buf), git_commit_id(commit));
-       fprintf(fp, "commit <a href=\"%scommit/%s.html\">%s</a>\n",
+       fprintf(fp, "<b>commit</b> <a href=\"%scommit/%s.html\">%s</a>\n",
                relpath, buf, buf);
 
        if (git_oid_tostr(buf, sizeof(buf), git_commit_parent_id(commit, 0)))
-               fprintf(fp, "parent <a href=\"%scommit/%s.html\">%s</a>\n",
+               fprintf(fp, "<b>parent</b> <a href=\"%scommit/%s.html\">%s</a>\n",
                        relpath, buf, buf);
 
        if ((count = (int)git_commit_parentcount(commit)) > 1) {
-               fprintf(fp, "Merge:");
+               fprintf(fp, "<b>Merge:</b>");
                for (i = 0; i < count; ++i) {
                        git_oid_tostr(buf, 8, git_commit_parent_id(commit, i));
                        fprintf(fp, " <a href=\"%scommit/%s.html\">%s</a>",
@@ -182,13 +182,13 @@ printcommit(FILE *fp, git_commit *commit)
                fputc('\n', fp);
        }
        if ((sig = git_commit_author(commit)) != NULL) {
-               fprintf(fp, "Author: ");
+               fprintf(fp, "<b>Author:</b> ");
                xmlencode(fp, sig->name, strlen(sig->name));
                fprintf(fp, " &lt;<a href=\"mailto:");
                xmlencode(fp, sig->email, strlen(sig->email));
                fputs("\">", fp);
                xmlencode(fp, sig->email, strlen(sig->email));
-               fputs("</a>&gt;\nDate:   ", fp);
+               fputs("</a>&gt;\n<b>Date:</b>   ", fp);
                printtime(fp, &sig->when);
                fputc('\n', fp);
        }
@@ -238,7 +238,7 @@ printshowfile(git_commit *commit)
        if (!git_diff_get_stats(&diffstats, diff)) {
                if (!git_diff_stats_to_buf(&diffstatsbuf, diffstats,
                    GIT_DIFF_STATS_FULL | GIT_DIFF_STATS_SHORT, 80)) {
-                       fprintf(fp, "Diffstat:\n");
+                       fprintf(fp, "<b>Diffstat:</b>\n");
                        fputs(diffstatsbuf.ptr, fp);
                }
                git_diff_stats_free(diffstats);
@@ -253,10 +253,12 @@ printshowfile(git_commit *commit)
                }
 
                delta = git_patch_get_delta(patch);
-               fprintf(fp, "diff --git a/<a href=\"%sfile/%s\">%s</a> b/<a href=\"%sfile/%s\">%s</a>\n",
+               fprintf(fp, "<b>diff --git a/<a href=\"%sfile/%s\">%s</a> b/<a href=\"%sfile/%s\">%s</a></b>\n",
                        relpath, delta->old_file.path, delta->old_file.path,
                        relpath, delta->new_file.path, delta->new_file.path);
 
+               /* TODO: add --- and +++ lines */
+
 #if 0
                switch (delta->flags) {
                case GIT_DIFF_FLAG_BINARY:
@@ -273,7 +275,7 @@ printshowfile(git_commit *commit)
                        if (git_patch_get_hunk(&hunk, &nhunklines, patch, j))
                                break; /* TODO: handle error ? */
 
-                       fprintf(fp, "%s\n", hunk->header);
+                       fprintf(fp, "<span class=\"h\">%s</span>\n", hunk->header);
 
                        for (k = 0; ; k++) {
                                if (git_patch_get_line_in_hunk(&line, patch, j, k))