author | Lars Hjemli <hjemli@gmail.com> | 2009-08-09 11:22:00 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-08-09 11:22:00 (UTC) |
commit | e976df27952ca1e450c1c3d420532ac9f5e3036b (patch) (unidiff) | |
tree | 2634538f3144c935d1579315d4de289e6c890f19 /ui-tree.c | |
parent | f35db1cd2b75aac6952aa07713e44ca01fd89727 (diff) | |
download | cgit-e976df27952ca1e450c1c3d420532ac9f5e3036b.zip cgit-e976df27952ca1e450c1c3d420532ac9f5e3036b.tar.gz cgit-e976df27952ca1e450c1c3d420532ac9f5e3036b.tar.bz2 |
Add support for repo.commit-filter and repo.source-filter
These options can be used to override the default commit- and source-
filter settings per repository.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-tree.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,62 +1,62 @@ | |||
1 | /* ui-tree.c: functions for tree output | 1 | /* ui-tree.c: functions for tree output |
2 | * | 2 | * |
3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
4 | * | 4 | * |
5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <ctype.h> | 9 | #include <ctype.h> |
10 | #include "cgit.h" | 10 | #include "cgit.h" |
11 | #include "html.h" | 11 | #include "html.h" |
12 | #include "ui-shared.h" | 12 | #include "ui-shared.h" |
13 | 13 | ||
14 | char *curr_rev; | 14 | 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(const char *name, 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.cfg.source_filter) { | 25 | if (ctx.repo->source_filter) { |
26 | html("<tr><td class='lines'><pre><code>"); | 26 | html("<tr><td class='lines'><pre><code>"); |
27 | ctx.cfg.source_filter->argv[1] = xstrdup(name); | 27 | ctx.repo->source_filter->argv[1] = xstrdup(name); |
28 | cgit_open_filter(ctx.cfg.source_filter); | 28 | cgit_open_filter(ctx.repo->source_filter); |
29 | write(STDOUT_FILENO, buf, size); | 29 | write(STDOUT_FILENO, buf, size); |
30 | cgit_close_filter(ctx.cfg.source_filter); | 30 | cgit_close_filter(ctx.repo->source_filter); |
31 | html("</code></pre></td></tr></table>\n"); | 31 | html("</code></pre></td></tr></table>\n"); |
32 | return; | 32 | return; |
33 | } | 33 | } |
34 | 34 | ||
35 | html("<tr><td class='linenumbers'><pre>"); | 35 | html("<tr><td class='linenumbers'><pre>"); |
36 | idx = 0; | 36 | idx = 0; |
37 | lineno = 0; | 37 | lineno = 0; |
38 | 38 | ||
39 | if (size) { | 39 | if (size) { |
40 | htmlf(numberfmt, ++lineno); | 40 | htmlf(numberfmt, ++lineno); |
41 | while(idx < size - 1) { // skip absolute last newline | 41 | while(idx < size - 1) { // skip absolute last newline |
42 | if (buf[idx] == '\n') | 42 | if (buf[idx] == '\n') |
43 | htmlf(numberfmt, ++lineno); | 43 | htmlf(numberfmt, ++lineno); |
44 | idx++; | 44 | idx++; |
45 | } | 45 | } |
46 | } | 46 | } |
47 | html("</pre></td>\n"); | 47 | html("</pre></td>\n"); |
48 | html("<td class='lines'><pre><code>"); | 48 | html("<td class='lines'><pre><code>"); |
49 | html_txt(buf); | 49 | html_txt(buf); |
50 | html("</code></pre></td></tr></table>\n"); | 50 | html("</code></pre></td></tr></table>\n"); |
51 | } | 51 | } |
52 | 52 | ||
53 | #define ROWLEN 32 | 53 | #define ROWLEN 32 |
54 | 54 | ||
55 | static void print_binary_buffer(char *buf, unsigned long size) | 55 | static void print_binary_buffer(char *buf, unsigned long size) |
56 | { | 56 | { |
57 | unsigned long ofs, idx; | 57 | unsigned long ofs, idx; |
58 | static char ascii[ROWLEN + 1]; | 58 | static char ascii[ROWLEN + 1]; |
59 | 59 | ||
60 | html("<table summary='blob content' class='bin-blob'>\n"); | 60 | html("<table summary='blob content' class='bin-blob'>\n"); |
61 | html("<tr><th>ofs</th><th>hex dump</th><th>ascii</th></tr>"); | 61 | html("<tr><th>ofs</th><th>hex dump</th><th>ascii</th></tr>"); |
62 | for (ofs = 0; ofs < size; ofs += ROWLEN, buf += ROWLEN) { | 62 | for (ofs = 0; ofs < size; ofs += ROWLEN, buf += ROWLEN) { |