-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc.5.txt | 4 | ||||
-rw-r--r-- | ui-tree.c | 27 |
4 files changed, 23 insertions, 11 deletions
@@ -61,16 +61,18 @@ void config_cb(const char *name, const char *value) | |||
61 | else if (!strcmp(name, "logo")) | 61 | else if (!strcmp(name, "logo")) |
62 | ctx.cfg.logo = xstrdup(value); | 62 | ctx.cfg.logo = xstrdup(value); |
63 | else if (!strcmp(name, "index-header")) | 63 | else if (!strcmp(name, "index-header")) |
64 | ctx.cfg.index_header = xstrdup(value); | 64 | ctx.cfg.index_header = xstrdup(value); |
65 | else if (!strcmp(name, "index-info")) | 65 | else if (!strcmp(name, "index-info")) |
66 | ctx.cfg.index_info = xstrdup(value); | 66 | ctx.cfg.index_info = xstrdup(value); |
67 | else if (!strcmp(name, "logo-link")) | 67 | else if (!strcmp(name, "logo-link")) |
68 | ctx.cfg.logo_link = xstrdup(value); | 68 | ctx.cfg.logo_link = xstrdup(value); |
69 | else if (!strcmp(name, "linenumbers")) | ||
70 | ctx.cfg.linenumbers = atoi(value); | ||
69 | else if (!strcmp(name, "module-link")) | 71 | else if (!strcmp(name, "module-link")) |
70 | ctx.cfg.module_link = xstrdup(value); | 72 | ctx.cfg.module_link = xstrdup(value); |
71 | else if (!strcmp(name, "virtual-root")) { | 73 | else if (!strcmp(name, "virtual-root")) { |
72 | ctx.cfg.virtual_root = trim_end(value, '/'); | 74 | ctx.cfg.virtual_root = trim_end(value, '/'); |
73 | if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) | 75 | if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) |
74 | ctx.cfg.virtual_root = ""; | 76 | ctx.cfg.virtual_root = ""; |
75 | } else if (!strcmp(name, "nocache")) | 77 | } else if (!strcmp(name, "nocache")) |
76 | ctx.cfg.nocache = atoi(value); | 78 | ctx.cfg.nocache = atoi(value); |
@@ -169,16 +169,17 @@ struct cgit_config { | |||
169 | int cache_repo_ttl; | 169 | int cache_repo_ttl; |
170 | int cache_root_ttl; | 170 | int cache_root_ttl; |
171 | int cache_static_ttl; | 171 | int cache_static_ttl; |
172 | int embedded; | 172 | int embedded; |
173 | int enable_index_links; | 173 | int enable_index_links; |
174 | int enable_log_filecount; | 174 | int enable_log_filecount; |
175 | int enable_log_linecount; | 175 | int enable_log_linecount; |
176 | int local_time; | 176 | int local_time; |
177 | int linenumbers; | ||
177 | int max_repo_count; | 178 | int max_repo_count; |
178 | int max_commit_count; | 179 | int max_commit_count; |
179 | int max_lock_attempts; | 180 | int max_lock_attempts; |
180 | int max_msg_len; | 181 | int max_msg_len; |
181 | int max_repodesc_len; | 182 | int max_repodesc_len; |
182 | int max_stats; | 183 | int max_stats; |
183 | int nocache; | 184 | int nocache; |
184 | int noplainemail; | 185 | int noplainemail; |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 3c35b02..a762ccc 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -141,16 +141,20 @@ logo:: | |||
141 | Url which specifies the source of an image which will be used as a logo | 141 | Url which specifies the source of an image which will be used as a logo |
142 | on all cgit pages. Default value: "/cgit.png". | 142 | on all cgit pages. Default value: "/cgit.png". |
143 | 143 | ||
144 | logo-link:: | 144 | logo-link:: |
145 | Url loaded when clicking on the cgit logo image. If unspecified the | 145 | Url loaded when clicking on the cgit logo image. If unspecified the |
146 | calculated url of the repository index page will be used. Default | 146 | calculated url of the repository index page will be used. Default |
147 | value: none. | 147 | value: none. |
148 | 148 | ||
149 | linenumbers:: | ||
150 | If set to "1" lines in tree view will have numbers. | ||
151 | Default value: "0". | ||
152 | |||
149 | max-commit-count:: | 153 | max-commit-count:: |
150 | Specifies the number of entries to list per page in "log" view. Default | 154 | Specifies the number of entries to list per page in "log" view. Default |
151 | value: "50". | 155 | value: "50". |
152 | 156 | ||
153 | max-message-length:: | 157 | max-message-length:: |
154 | Specifies the maximum number of commit message characters to display in | 158 | Specifies the maximum number of commit message characters to display in |
155 | "log" view. Default value: "80". | 159 | "log" view. Default value: "80". |
156 | 160 | ||
@@ -18,29 +18,34 @@ int header = 0; | |||
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 | 25 | ||
26 | html("<tr><td class='linenumbers'><pre>"); | 26 | if (ctx.cfg.linenumbers) { |
27 | idx = 0; | 27 | html("<tr><td class='linenumbers'><pre>"); |
28 | lineno = 0; | 28 | idx = 0; |
29 | 29 | lineno = 0; | |
30 | if (size) { | 30 | |
31 | htmlf(numberfmt, ++lineno); | 31 | if (size) { |
32 | while(idx < size - 1) { // skip absolute last newline | 32 | htmlf(numberfmt, ++lineno); |
33 | if (buf[idx] == '\n') | 33 | while(idx < size - 1) { // skip absolute last newline |
34 | htmlf(numberfmt, ++lineno); | 34 | if (buf[idx] == '\n') |
35 | idx++; | 35 | htmlf(numberfmt, ++lineno); |
36 | idx++; | ||
37 | } | ||
36 | } | 38 | } |
39 | html("</pre></td>\n"); | ||
40 | } | ||
41 | else { | ||
42 | html("<tr>\n"); | ||
37 | } | 43 | } |
38 | html("</pre></td>\n"); | ||
39 | 44 | ||
40 | if (ctx.repo->source_filter) { | 45 | if (ctx.repo->source_filter) { |
41 | html("<td class='lines'><pre><code>"); | 46 | html("<td class='lines'><pre><code>"); |
42 | ctx.repo->source_filter->argv[1] = xstrdup(name); | 47 | ctx.repo->source_filter->argv[1] = xstrdup(name); |
43 | cgit_open_filter(ctx.repo->source_filter); | 48 | cgit_open_filter(ctx.repo->source_filter); |
44 | write(STDOUT_FILENO, buf, size); | 49 | write(STDOUT_FILENO, buf, size); |
45 | cgit_close_filter(ctx.repo->source_filter); | 50 | cgit_close_filter(ctx.repo->source_filter); |
46 | html("</code></pre></td></tr></table>\n"); | 51 | html("</code></pre></td></tr></table>\n"); |