mirror of
https://git.zx2c4.com/cgit
synced 2024-11-22 08:28:42 +00:00
Add 'linenumbers' config option
Signed-off-by: Florian Pritz <bluewind@xssn.at> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
parent
03389d6e67
commit
d67cc7f9d5
2
cgit.c
2
cgit.c
@ -66,6 +66,8 @@ void config_cb(const char *name, const char *value)
|
|||||||
ctx.cfg.index_info = xstrdup(value);
|
ctx.cfg.index_info = xstrdup(value);
|
||||||
else if (!strcmp(name, "logo-link"))
|
else if (!strcmp(name, "logo-link"))
|
||||||
ctx.cfg.logo_link = xstrdup(value);
|
ctx.cfg.logo_link = xstrdup(value);
|
||||||
|
else if (!strcmp(name, "linenumbers"))
|
||||||
|
ctx.cfg.linenumbers = atoi(value);
|
||||||
else if (!strcmp(name, "module-link"))
|
else if (!strcmp(name, "module-link"))
|
||||||
ctx.cfg.module_link = xstrdup(value);
|
ctx.cfg.module_link = xstrdup(value);
|
||||||
else if (!strcmp(name, "virtual-root")) {
|
else if (!strcmp(name, "virtual-root")) {
|
||||||
|
1
cgit.h
1
cgit.h
@ -174,6 +174,7 @@ struct cgit_config {
|
|||||||
int enable_log_filecount;
|
int enable_log_filecount;
|
||||||
int enable_log_linecount;
|
int enable_log_linecount;
|
||||||
int local_time;
|
int local_time;
|
||||||
|
int linenumbers;
|
||||||
int max_repo_count;
|
int max_repo_count;
|
||||||
int max_commit_count;
|
int max_commit_count;
|
||||||
int max_lock_attempts;
|
int max_lock_attempts;
|
||||||
|
@ -146,6 +146,10 @@ logo-link::
|
|||||||
calculated url of the repository index page will be used. Default
|
calculated url of the repository index page will be used. Default
|
||||||
value: none.
|
value: none.
|
||||||
|
|
||||||
|
linenumbers::
|
||||||
|
If set to "1" lines in tree view will have numbers.
|
||||||
|
Default value: "0".
|
||||||
|
|
||||||
max-commit-count::
|
max-commit-count::
|
||||||
Specifies the number of entries to list per page in "log" view. Default
|
Specifies the number of entries to list per page in "log" view. Default
|
||||||
value: "50".
|
value: "50".
|
||||||
|
27
ui-tree.c
27
ui-tree.c
@ -23,19 +23,24 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
|
|||||||
|
|
||||||
html("<table summary='blob content' class='blob'>\n");
|
html("<table summary='blob content' class='blob'>\n");
|
||||||
|
|
||||||
html("<tr><td class='linenumbers'><pre>");
|
if (ctx.cfg.linenumbers) {
|
||||||
idx = 0;
|
html("<tr><td class='linenumbers'><pre>");
|
||||||
lineno = 0;
|
idx = 0;
|
||||||
|
lineno = 0;
|
||||||
if (size) {
|
|
||||||
htmlf(numberfmt, ++lineno);
|
if (size) {
|
||||||
while(idx < size - 1) { // skip absolute last newline
|
htmlf(numberfmt, ++lineno);
|
||||||
if (buf[idx] == '\n')
|
while(idx < size - 1) { // skip absolute last newline
|
||||||
htmlf(numberfmt, ++lineno);
|
if (buf[idx] == '\n')
|
||||||
idx++;
|
htmlf(numberfmt, ++lineno);
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
html("</pre></td>\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
html("<tr>\n");
|
||||||
}
|
}
|
||||||
html("</pre></td>\n");
|
|
||||||
|
|
||||||
if (ctx.repo->source_filter) {
|
if (ctx.repo->source_filter) {
|
||||||
html("<td class='lines'><pre><code>");
|
html("<td class='lines'><pre><code>");
|
||||||
|
Loading…
Reference in New Issue
Block a user