How have I managed to neglect until now to put all the subdirectory
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 3 Feb 2009 19:41:37 +0000 (19:41 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 3 Feb 2009 19:41:37 +0000 (19:41 +0000)
names in the HTML reports inside <code> tags? Good grief. Now done so.

git-svn-id: svn://svn.tartarus.org/sgt/agedu@8442 cda61777-01e9-0310-a592-d414129be87e

html.c

diff --git a/html.c b/html.c
index d6d6ad1..4390668 100644 (file)
--- a/html.c
+++ b/html.c
@@ -237,6 +237,7 @@ static void end_colour_bar(struct html *ctx)
 struct vector {
     int want_href;
     char *name;
+    int literal; /* should the name be formatted in fixed-pitch? */
     unsigned long index;
     unsigned long long sizes[MAXCOLOUR+1];
 };
@@ -264,7 +265,7 @@ int vec_compare(const void *av, const void *bv)
 }
 
 static struct vector *make_vector(struct html *ctx, char *path,
-                                 int want_href, char *name)
+                                 int want_href, char *name, int literal)
 {
     unsigned long xi1, xi2;
     struct vector *vec = snew(struct vector);
@@ -272,6 +273,7 @@ static struct vector *make_vector(struct html *ctx, char *path,
 
     vec->want_href = want_href;
     vec->name = name ? dupstr(name) : NULL;
+    vec->literal = literal;
 
     get_indices(ctx->t, path, &xi1, &xi2);
 
@@ -360,7 +362,11 @@ static void write_report_line(struct html *ctx, struct vector *vec)
            htprintf(ctx, "<a href=\"%s\">", ctx->href);
            doing_href = 1;
        }
+       if (vec->literal)
+           htprintf(ctx, "<code>");
        htescape(ctx, vec->name, strlen(vec->name), 1);
+       if (vec->literal)
+           htprintf(ctx, "</code>");
        if (doing_href)
            htprintf(ctx, "</a>");
     }
@@ -536,7 +542,7 @@ char *html_query(const void *t, unsigned long index,
     vecsize = 64;
     vecs = snewn(vecsize, struct vector *);
     nvecs = 1;
-    vecs[0] = make_vector(ctx, path, 0, NULL);
+    vecs[0] = make_vector(ctx, path, 0, NULL, 0);
     print_heading(ctx, "Overall");
     write_report_line(ctx, vecs[0]);
 
@@ -564,7 +570,7 @@ char *html_query(const void *t, unsigned long index,
            vecs = sresize(vecs, vecsize, struct vector *);
        }
        assert(strlen(path2) > pathlen);
-       vecs[nvecs] = make_vector(ctx, path2, 1, path2 + subdirpos);
+       vecs[nvecs] = make_vector(ctx, path2, 1, path2 + subdirpos, 1);
        for (i = 0; i <= MAXCOLOUR; i++)
            vecs[0]->sizes[i] -= vecs[nvecs]->sizes[i];
        nvecs++;