Add 'linenumbers' config option

Signed-off-by: Florian Pritz <bluewind@xssn.at>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
这个提交包含在:
Florian Pritz
2009-08-09 20:42:45 +00:00
提交者 Lars Hjemli
父节点 03389d6e67
当前提交 d67cc7f9d5
共有 4 个文件被更改,包括 23 次插入11 次删除

查看文件

@ -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("<tr><td class='linenumbers'><pre>");
idx = 0;
lineno = 0;
if (size) {
htmlf(numberfmt, ++lineno);
while(idx < size - 1) { // skip absolute last newline
if (buf[idx] == '\n')
htmlf(numberfmt, ++lineno);
idx++;
if (ctx.cfg.linenumbers) {
html("<tr><td class='linenumbers'><pre>");
idx = 0;
lineno = 0;
if (size) {
htmlf(numberfmt, ++lineno);
while(idx < size - 1) { // skip absolute last newline
if (buf[idx] == '\n')
htmlf(numberfmt, ++lineno);
idx++;
}
}
html("</pre></td>\n");
}
else {
html("<tr>\n");
}
html("</pre></td>\n");
if (ctx.repo->source_filter) {
html("<td class='lines'><pre><code>");