|
diff --git a/ui-tree.c b/ui-tree.c index 816e121..caf6a9e 100644 --- a/ ui-tree.c+++ b/ ui-tree.c |
|
@@ -1,54 +1,54 @@ |
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 | |
|