highlight/make bold some fields - stagit-gopher - A git gopher frontend. (mirror)
 (HTM) git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 673122b0d53c12a35b744d3891bc1b22cf398a1f
 (DIR) parent a20e271f931b37091f26bf1fff5f48060cda519c
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Mon,  7 Dec 2015 19:46:07 +0100
       
       highlight/make bold some fields
       
       Diffstat:
         M style.css                           |       4 ++++
         M urmoms.c                            |      18 ++++++++++--------
       
       2 files changed, 14 insertions(+), 8 deletions(-)
       ---
 (DIR) diff --git a/style.css b/style.css
       @@ -48,6 +48,10 @@ pre {
                font-family: monospace;
        }
        
       +pre span.h {
       +        color: blue;
       +}
       +
        pre span.i {
                color: green;
        }
 (DIR) diff --git 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))