summaryrefslogtreecommitdiffabout
path: root/ui-tree.c
Side-by-side diff
Diffstat (limited to 'ui-tree.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-tree.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ui-tree.c b/ui-tree.c
index caf6a9e..c608754 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -110,12 +110,13 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
static int ls_item(const unsigned char *sha1, const char *base, int baselen,
const char *pathname, unsigned int mode, int stage,
void *cbdata)
{
char *name;
char *fullpath;
+ char *class;
enum object_type type;
unsigned long size = 0;
name = xstrdup(pathname);
fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "",
ctx.qry.path ? "/" : "", name);
@@ -142,13 +143,18 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
html_txt(name);
html("</a>");
} else if (S_ISDIR(mode)) {
cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head,
curr_rev, fullpath);
} else {
- cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head,
+ class = strrchr(name, '.');
+ if (class != NULL) {
+ class = fmt("ls-blob %s", class + 1);
+ } else
+ class = "ls-blob";
+ cgit_tree_link(name, NULL, class, ctx.qry.head,
curr_rev, fullpath);
}
htmlf("</td><td class='ls-size'>%li</td>", size);
html("<td>");
cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev,