diff options
Diffstat (limited to 'ui-tree.c')
| -rw-r--r-- | ui-tree.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -18,12 +18,11 @@ struct walk_tree_context { int state; }; -static void print_text_buffer(const char *name, char *buf, unsigned long size) +static void print_text_buffer(const char *name, char *buf, unsigned long size, bool is_markdown) { unsigned long lineno, idx; const char *numberfmt = "<a id='n%1$d' href='#n%1$d'>%1$d</a>\n"; - bool is_markdown = (strncmp(".md", &name[strlen(name)-3], 3) == 0); if (is_markdown) { html("<div class=\"tab-folder\"><div id=\"code\" class=\"tab-content\">"); } @@ -122,10 +121,14 @@ static void print_object(const struct object_id *oid, const char *path, const ch cgit_set_title_from_path(path); + bool is_markdown = (strncmp(".md", &basename[strlen(basename)-3], 3) == 0); + cgit_print_layout_start(); htmlf("blob: %s (", oid_to_hex(oid)); - html("<a href=\"#preview\">preview</a>) ("); - html("<a href=\"#code\">code</a>) ("); + if (is_markdown) { + html("<a href=\"#preview\">preview</a>) ("); + html("<a href=\"#code\">code</a>) ("); + } cgit_plain_link("plain", NULL, NULL, ctx.qry.head, rev, path); if (ctx.repo->enable_blame) { @@ -144,7 +147,7 @@ static void print_object(const struct object_id *oid, const char *path, const ch if (buffer_is_binary(buf, size)) print_binary_buffer(buf, size); else - print_text_buffer(basename, buf, size); + print_text_buffer(basename, buf, size, is_markdown); free(buf); } |
