1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#include "cgit.h"
#include "filter.h"
#include "html.h"
#include "shared.h"
#include "ui-blob.h"
#include "ui-log.h"
#include "ui-refs.h"
#include "ui-shared.h"
#include "ui-summary.h"
#define LOG_BASE_COLUMNS 3
static int clone_urls_printed;
static int log_columns(void)
{
int columns = LOG_BASE_COLUMNS;
if (ctx.repo->enable_log_filecount)
columns++;
if (ctx.repo->enable_log_linecount)
columns++;
return columns;
}
static void print_clone_url(const char *url)
{
int columns = log_columns();
if (clone_urls_printed++ == 0) {
html("<tbody class='clone'>\n");
htmlf("<tr class='nohover'><th colspan='%d' class='left' scope='col'>Clone</th></tr>\n",
columns);
}
cgit_print_clone_row(url, columns);
}
void cgit_print_summary(void)
{
cgit_print_layout_start();
html("<table class='list summary' aria-label='Summary'>\n");
cgit_print_branches(ctx.cfg.summary_branches);
cgit_print_tags(ctx.cfg.summary_tags);
if (ctx.cfg.summary_log > 0)
cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, NULL, NULL, 0, 0, 0);
clone_urls_printed = 0;
cgit_add_clone_urls(print_clone_url);
if (clone_urls_printed)
html("</tbody>\n");
html("</table>\n");
cgit_print_layout_end();
}
void cgit_print_repo_readme(void)
{
char *filename, *ref;
cgit_print_layout_start();
filename = ctx.repo->readme.items[0].string;
ref = ctx.repo->readme.items[0].util;
html("<div id='about'>");
if (!ctx.repo->about_filter) {
html("<pre class='plaintext'>");
if (ref) {
cgit_print_file(filename, ref, 1, 1);
} else {
struct strbuf sb = STRBUF_INIT;
if (strbuf_read_file(&sb, filename, 0) >= 0)
html_txt(sb.buf);
strbuf_release(&sb);
}
html("</pre>");
} else {
cgit_open_filter(ctx.repo->about_filter, filename);
if (ref)
cgit_print_file(filename, ref, 1, 0);
else
html_include(filename);
cgit_close_filter(ctx.repo->about_filter);
}
html("</div>");
cgit_print_layout_end();
}
|