diff options
author | Lars Hjemli | 2009-08-09 13:46:01 +0200 |
---|---|---|
committer | Lars Hjemli | 2009-08-09 13:46:01 +0200 |
commit | db6303b58883c4417f5bcc0c1ee34fed6553dca3 (patch) | |
tree | ef7775ade9eef57c5a878f9588fe545a7da2c952 /ui-tree.c | |
parent | Merge branch 'lh/mimetypes' (diff) | |
parent | cgit.c: allow repo.*-filter options to unset the current default (diff) | |
download | cgit-db6303b58883c4417f5bcc0c1ee34fed6553dca3.tar.gz cgit-db6303b58883c4417f5bcc0c1ee34fed6553dca3.zip |
Merge branch 'lh/plugins'
Conflicts: cgit.c cgit.h
Diffstat (limited to 'ui-tree.c')
-rw-r--r-- | ui-tree.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/ui-tree.c b/ui-tree.c index 61fcf5a..c608754 100644 --- a/ui-tree.c +++ b/ui-tree.c | |||
@@ -15,13 +15,23 @@ char *curr_rev; | |||
15 | char *match_path; | 15 | char *match_path; |
16 | int header = 0; | 16 | int header = 0; |
17 | 17 | ||
18 | static void print_text_buffer(char *buf, unsigned long size) | 18 | static void print_text_buffer(const char *name, char *buf, unsigned long size) |
19 | { | 19 | { |
20 | unsigned long lineno, idx; | 20 | unsigned long lineno, idx; |
21 | const char *numberfmt = | 21 | const char *numberfmt = |
22 | "<a class='no' id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a>\n"; | 22 | "<a class='no' id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a>\n"; |
23 | 23 | ||
24 | html("<table summary='blob content' class='blob'>\n"); | 24 | html("<table summary='blob content' class='blob'>\n"); |
25 | if (ctx.repo->source_filter) { | ||
26 | html("<tr><td class='lines'><pre><code>"); | ||
27 | ctx.repo->source_filter->argv[1] = xstrdup(name); | ||
28 | cgit_open_filter(ctx.repo->source_filter); | ||
29 | write(STDOUT_FILENO, buf, size); | ||
30 | cgit_close_filter(ctx.repo->source_filter); | ||
31 | html("</code></pre></td></tr></table>\n"); | ||
32 | return; | ||
33 | } | ||
34 | |||
25 | html("<tr><td class='linenumbers'><pre>"); | 35 | html("<tr><td class='linenumbers'><pre>"); |
26 | idx = 0; | 36 | idx = 0; |
27 | lineno = 0; | 37 | lineno = 0; |
@@ -65,7 +75,7 @@ static void print_binary_buffer(char *buf, unsigned long size) | |||
65 | html("</table>\n"); | 75 | html("</table>\n"); |
66 | } | 76 | } |
67 | 77 | ||
68 | static void print_object(const unsigned char *sha1, char *path) | 78 | static void print_object(const unsigned char *sha1, char *path, const char *basename) |
69 | { | 79 | { |
70 | enum object_type type; | 80 | enum object_type type; |
71 | char *buf; | 81 | char *buf; |
@@ -93,7 +103,7 @@ static void print_object(const unsigned char *sha1, char *path) | |||
93 | if (buffer_is_binary(buf, size)) | 103 | if (buffer_is_binary(buf, size)) |
94 | print_binary_buffer(buf, size); | 104 | print_binary_buffer(buf, size); |
95 | else | 105 | else |
96 | print_text_buffer(buf, size); | 106 | print_text_buffer(basename, buf, size); |
97 | } | 107 | } |
98 | 108 | ||
99 | 109 | ||
@@ -219,7 +229,7 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen, | |||
219 | ls_head(); | 229 | ls_head(); |
220 | return READ_TREE_RECURSIVE; | 230 | return READ_TREE_RECURSIVE; |
221 | } else { | 231 | } else { |
222 | print_object(sha1, buffer); | 232 | print_object(sha1, buffer, pathname); |
223 | return 0; | 233 | return 0; |
224 | } | 234 | } |
225 | } | 235 | } |