summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.css6
-rw-r--r--html.c2
-rwxr-xr-xtests/t0104-tree.sh10
-rwxr-xr-xtests/t0105-commit.sh2
-rw-r--r--ui-commit.c6
-rw-r--r--ui-diff.c2
-rw-r--r--ui-log.c2
-rw-r--r--ui-repolist.c2
-rw-r--r--ui-shared.c24
-rw-r--r--ui-summary.c2
-rw-r--r--ui-tree.c6
11 files changed, 37 insertions, 27 deletions
diff --git a/cgit.css b/cgit.css
index f1003b4..565427f 100644
--- a/cgit.css
+++ b/cgit.css
@@ -102,25 +102,29 @@ div#sidebar div.infobox {
102 padding: 0.5em; 102 padding: 0.5em;
103 text-align: left; 103 text-align: left;
104 background-color: #ccc; 104 background-color: #ccc;
105 border-top: solid 1px #eee; 105 border-top: solid 1px #eee;
106 border-left: solid 1px #eee; 106 border-left: solid 1px #eee;
107 border-right: solid 1px #aaa; 107 border-right: solid 1px #aaa;
108 border-bottom: solid 1px #aaa; 108 border-bottom: solid 1px #aaa;
109} 109}
110 110
111div#sidebar div.infobox h1 { 111div#sidebar div.infobox h1 {
112 font-size: 10pt; 112 font-size: 10pt;
113 font-weight: bold; 113 font-weight: bold;
114 margin: 0px; 114 margin: 8px 0px 0px 0px;
115}
116
117div#sidebar div.infobox h1.first {
118 margin-top: 0px;
115} 119}
116 120
117div#sidebar div.infobox a.menu { 121div#sidebar div.infobox a.menu {
118 display: block; 122 display: block;
119 background-color: #ccc; 123 background-color: #ccc;
120 padding: 0.1em 0.5em; 124 padding: 0.1em 0.5em;
121 text-decoration: none; 125 text-decoration: none;
122} 126}
123 127
124div#sidebar div.infobox a.menu:hover { 128div#sidebar div.infobox a.menu:hover {
125 background-color: #bbb; 129 background-color: #bbb;
126 text-decoration: none; 130 text-decoration: none;
diff --git a/html.c b/html.c
index 6c9cc8b..eb163d9 100644
--- a/html.c
+++ b/html.c
@@ -123,25 +123,25 @@ void html_hidden(char *name, char *value)
123 html_attr(name); 123 html_attr(name);
124 html("' value='"); 124 html("' value='");
125 html_attr(value); 125 html_attr(value);
126 html("'/>"); 126 html("'/>");
127} 127}
128 128
129void html_option(char *value, char *text, char *selected_value) 129void html_option(char *value, char *text, char *selected_value)
130{ 130{
131 html("<option value='"); 131 html("<option value='");
132 html_attr(value); 132 html_attr(value);
133 html("'"); 133 html("'");
134 if (selected_value && !strcmp(selected_value, value)) 134 if (selected_value && !strcmp(selected_value, value))
135 html(" selected"); 135 html(" selected='selected'");
136 html(">"); 136 html(">");
137 html_txt(text); 137 html_txt(text);
138 html("</option>\n"); 138 html("</option>\n");
139} 139}
140 140
141void html_link_open(char *url, char *title, char *class) 141void html_link_open(char *url, char *title, char *class)
142{ 142{
143 html("<a href='"); 143 html("<a href='");
144 html_attr(url); 144 html_attr(url);
145 if (title) { 145 if (title) {
146 html("' title='"); 146 html("' title='");
147 html_attr(title); 147 html_attr(title);
diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh
index 9c362ca..2516c72 100755
--- a/tests/t0104-tree.sh
+++ b/tests/t0104-tree.sh
@@ -1,15 +1,21 @@
1#!/bin/sh 1#!/bin/sh
2 2
3. ./setup.sh 3. ./setup.sh
4 4
5prepare_tests "Check content on tree page" 5prepare_tests "Check content on tree page"
6 6
7run_test 'generate bar/tree' 'cgit_url "bar/tree" >trash/tmp' 7run_test 'generate bar/tree' 'cgit_url "bar/tree" >trash/tmp'
8run_test 'find file-1' 'grep -e "file-1" trash/tmp' 8run_test 'find file-1' 'grep -e "file-1" trash/tmp'
9run_test 'find file-50' 'grep -e "file-50" trash/tmp' 9run_test 'find file-50' 'grep -e "file-50" trash/tmp'
10 10
11run_test 'generate bar/tree/file-50' 'cgit_url "bar/tree/file-50" >trash/tmp' 11run_test 'generate bar/tree/file-50' 'cgit_url "bar/tree/file-50" >trash/tmp'
12run_test 'find line 1' 'grep -e "<a name=.1.>1</a>" trash/tmp' 12
13run_test 'no line 2' 'grep -ve "<a name=.2.>2</a>" trash/tmp' 13run_test 'find line 1' '
14 grep -e "<a id=.n1. name=.n1. href=.#n1.>1</a>" trash/tmp
15'
16
17run_test 'no line 2' '
18 grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp
19'
14 20
15tests_done 21tests_done
diff --git a/tests/t0105-commit.sh b/tests/t0105-commit.sh
index 7137751..aa2bf33 100755
--- a/tests/t0105-commit.sh
+++ b/tests/t0105-commit.sh
@@ -4,19 +4,19 @@
4 4
5prepare_tests "Check content on commit page" 5prepare_tests "Check content on commit page"
6 6
7run_test 'generate foo/commit' 'cgit_url "foo/commit" >trash/tmp' 7run_test 'generate foo/commit' 'cgit_url "foo/commit" >trash/tmp'
8run_test 'find tree link' 'grep -e "<a href=./foo/tree/.>" trash/tmp' 8run_test 'find tree link' 'grep -e "<a href=./foo/tree/.>" trash/tmp'
9run_test 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" trash/tmp' 9run_test 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" trash/tmp'
10 10
11run_test 'find commit subject' ' 11run_test 'find commit subject' '
12 grep -e "<div class=.commit-subject.>commit 5</div>" trash/tmp 12 grep -e "<div class=.commit-subject.>commit 5</div>" trash/tmp
13' 13'
14 14
15run_test 'find commit msg' 'grep -e "<div class=.commit-msg.></div>" trash/tmp' 15run_test 'find commit msg' 'grep -e "<div class=.commit-msg.></div>" trash/tmp'
16run_test 'find diffstat' 'grep -e "<table class=.diffstat.>" trash/tmp' 16run_test 'find diffstat' 'grep -e "<table summary=.diffstat. class=.diffstat.>" trash/tmp'
17 17
18run_test 'find diff summary' ' 18run_test 'find diff summary' '
19 grep -e "1 files changed, 1 insertions, 0 deletions" trash/tmp 19 grep -e "1 files changed, 1 insertions, 0 deletions" trash/tmp
20' 20'
21 21
22tests_done 22tests_done
diff --git a/ui-commit.c b/ui-commit.c
index 4ac8955..bd55a33 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -75,25 +75,25 @@ void print_fileinfo(struct fileinfo *info)
75 html("]</span>"); 75 html("]</span>");
76 } 76 }
77 htmlf("</td><td class='%s'>", class); 77 htmlf("</td><td class='%s'>", class);
78 cgit_diff_link(info->new_path, NULL, NULL, cgit_query_head, curr_rev, 78 cgit_diff_link(info->new_path, NULL, NULL, cgit_query_head, curr_rev,
79 NULL, info->new_path); 79 NULL, info->new_path);
80 if (info->status == DIFF_STATUS_COPIED || info->status == DIFF_STATUS_RENAMED) 80 if (info->status == DIFF_STATUS_COPIED || info->status == DIFF_STATUS_RENAMED)
81 htmlf(" (%s from %s)", 81 htmlf(" (%s from %s)",
82 info->status == DIFF_STATUS_COPIED ? "copied" : "renamed", 82 info->status == DIFF_STATUS_COPIED ? "copied" : "renamed",
83 info->old_path); 83 info->old_path);
84 html("</td><td class='right'>"); 84 html("</td><td class='right'>");
85 htmlf("%d", info->added + info->removed); 85 htmlf("%d", info->added + info->removed);
86 html("</td><td class='graph'>"); 86 html("</td><td class='graph'>");
87 htmlf("<table width='%d%%'><tr>", (max_changes > 100 ? 100 : max_changes)); 87 htmlf("<table summary='file diffstat' width='%d%%'><tr>", (max_changes > 100 ? 100 : max_changes));
88 htmlf("<td class='add' style='width: %.1f%%;'/>", 88 htmlf("<td class='add' style='width: %.1f%%;'/>",
89 info->added * 100.0 / max_changes); 89 info->added * 100.0 / max_changes);
90 htmlf("<td class='rem' style='width: %.1f%%;'/>", 90 htmlf("<td class='rem' style='width: %.1f%%;'/>",
91 info->removed * 100.0 / max_changes); 91 info->removed * 100.0 / max_changes);
92 htmlf("<td class='none' style='width: %.1f%%;'/>", 92 htmlf("<td class='none' style='width: %.1f%%;'/>",
93 (max_changes - info->removed - info->added) * 100.0 / max_changes); 93 (max_changes - info->removed - info->added) * 100.0 / max_changes);
94 html("</tr></table></td></tr>\n"); 94 html("</tr></table></td></tr>\n");
95} 95}
96 96
97void cgit_count_diff_lines(char *line, int len) 97void cgit_count_diff_lines(char *line, int len)
98{ 98{
99 if (line && (len > 0)) { 99 if (line && (len > 0)) {
@@ -148,25 +148,25 @@ void cgit_print_commit(char *hex)
148 148
149 if (get_sha1(hex, sha1)) { 149 if (get_sha1(hex, sha1)) {
150 cgit_print_error(fmt("Bad object id: %s", hex)); 150 cgit_print_error(fmt("Bad object id: %s", hex));
151 return; 151 return;
152 } 152 }
153 commit = lookup_commit_reference(sha1); 153 commit = lookup_commit_reference(sha1);
154 if (!commit) { 154 if (!commit) {
155 cgit_print_error(fmt("Bad commit reference: %s", hex)); 155 cgit_print_error(fmt("Bad commit reference: %s", hex));
156 return; 156 return;
157 } 157 }
158 info = cgit_parse_commit(commit); 158 info = cgit_parse_commit(commit);
159 159
160 html("<table class='commit-info'>\n"); 160 html("<table summary='commit info' class='commit-info'>\n");
161 html("<tr><th>author</th><td>"); 161 html("<tr><th>author</th><td>");
162 html_txt(info->author); 162 html_txt(info->author);
163 html(" "); 163 html(" ");
164 html_txt(info->author_email); 164 html_txt(info->author_email);
165 html("</td><td class='right'>"); 165 html("</td><td class='right'>");
166 cgit_print_date(info->author_date, FMT_LONGDATE); 166 cgit_print_date(info->author_date, FMT_LONGDATE);
167 html("</td></tr>\n"); 167 html("</td></tr>\n");
168 html("<tr><th>committer</th><td>"); 168 html("<tr><th>committer</th><td>");
169 html_txt(info->committer); 169 html_txt(info->committer);
170 html(" "); 170 html(" ");
171 html_txt(info->committer_email); 171 html_txt(info->committer_email);
172 html("</td><td class='right'>"); 172 html("</td><td class='right'>");
@@ -200,25 +200,25 @@ void cgit_print_commit(char *hex)
200 hex, cgit_repo->snapshots); 200 hex, cgit_repo->snapshots);
201 html("</td></tr>"); 201 html("</td></tr>");
202 } 202 }
203 html("</table>\n"); 203 html("</table>\n");
204 html("<div class='commit-subject'>"); 204 html("<div class='commit-subject'>");
205 html_txt(info->subject); 205 html_txt(info->subject);
206 html("</div>"); 206 html("</div>");
207 html("<div class='commit-msg'>"); 207 html("<div class='commit-msg'>");
208 html_txt(info->msg); 208 html_txt(info->msg);
209 html("</div>"); 209 html("</div>");
210 if (!(commit->parents && commit->parents->next && commit->parents->next->next)) { 210 if (!(commit->parents && commit->parents->next && commit->parents->next->next)) {
211 html("<div class='diffstat-header'>Diffstat</div>"); 211 html("<div class='diffstat-header'>Diffstat</div>");
212 html("<table class='diffstat'>"); 212 html("<table summary='diffstat' class='diffstat'>");
213 max_changes = 0; 213 max_changes = 0;
214 cgit_diff_commit(commit, inspect_filepair); 214 cgit_diff_commit(commit, inspect_filepair);
215 for(i = 0; i<files; i++) 215 for(i = 0; i<files; i++)
216 print_fileinfo(&items[i]); 216 print_fileinfo(&items[i]);
217 html("</table>"); 217 html("</table>");
218 html("<div class='diffstat-summary'>"); 218 html("<div class='diffstat-summary'>");
219 htmlf("%d files changed, %d insertions, %d deletions (", 219 htmlf("%d files changed, %d insertions, %d deletions (",
220 files, total_adds, total_rems); 220 files, total_adds, total_rems);
221 cgit_diff_link("show diff", NULL, NULL, cgit_query_head, hex, 221 cgit_diff_link("show diff", NULL, NULL, cgit_query_head, hex,
222 NULL, NULL); 222 NULL, NULL);
223 html(")</div>"); 223 html(")</div>");
224 } 224 }
diff --git a/ui-diff.c b/ui-diff.c
index ac9a3fa..4fcf852 100644
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -132,18 +132,18 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefi
132 hashclr(old_rev_sha1); 132 hashclr(old_rev_sha1);
133 133
134 if (!is_null_sha1(old_rev_sha1)) { 134 if (!is_null_sha1(old_rev_sha1)) {
135 type = sha1_object_info(old_rev_sha1, &size); 135 type = sha1_object_info(old_rev_sha1, &size);
136 if (type == OBJ_BAD) { 136 if (type == OBJ_BAD) {
137 cgit_print_error(fmt("Bad object name: %s", sha1_to_hex(old_rev_sha1))); 137 cgit_print_error(fmt("Bad object name: %s", sha1_to_hex(old_rev_sha1)));
138 return; 138 return;
139 } 139 }
140 commit2 = lookup_commit_reference(old_rev_sha1); 140 commit2 = lookup_commit_reference(old_rev_sha1);
141 if (!commit2 || parse_commit(commit2)) 141 if (!commit2 || parse_commit(commit2))
142 cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(old_rev_sha1))); 142 cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(old_rev_sha1)));
143 } 143 }
144 html("<table class='diff'>"); 144 html("<table summary='diff' class='diff'>");
145 html("<tr><td>"); 145 html("<tr><td>");
146 cgit_diff_tree(old_rev_sha1, new_rev_sha1, filepair_cb, prefix); 146 cgit_diff_tree(old_rev_sha1, new_rev_sha1, filepair_cb, prefix);
147 html("</td></tr>"); 147 html("</td></tr>");
148 html("</table>"); 148 html("</table>");
149} 149}
diff --git a/ui-log.c b/ui-log.c
index e5f3c57..a41d2b2 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -81,25 +81,25 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
81 init_revisions(&rev, NULL); 81 init_revisions(&rev, NULL);
82 rev.abbrev = DEFAULT_ABBREV; 82 rev.abbrev = DEFAULT_ABBREV;
83 rev.commit_format = CMIT_FMT_DEFAULT; 83 rev.commit_format = CMIT_FMT_DEFAULT;
84 rev.verbose_header = 1; 84 rev.verbose_header = 1;
85 rev.show_root_diff = 0; 85 rev.show_root_diff = 0;
86 setup_revisions(argc, argv, &rev, NULL); 86 setup_revisions(argc, argv, &rev, NULL);
87 if (rev.grep_filter) { 87 if (rev.grep_filter) {
88 rev.grep_filter->regflags |= REG_ICASE; 88 rev.grep_filter->regflags |= REG_ICASE;
89 compile_grep_patterns(rev.grep_filter); 89 compile_grep_patterns(rev.grep_filter);
90 } 90 }
91 prepare_revision_walk(&rev); 91 prepare_revision_walk(&rev);
92 92
93 html("<table class='list nowrap'>"); 93 html("<table summary='log' class='list nowrap'>");
94 html("<tr class='nohover'><th class='left'>Age</th>" 94 html("<tr class='nohover'><th class='left'>Age</th>"
95 "<th class='left'>Message</th>"); 95 "<th class='left'>Message</th>");
96 96
97 if (cgit_repo->enable_log_filecount) { 97 if (cgit_repo->enable_log_filecount) {
98 html("<th class='right'>Files</th>"); 98 html("<th class='right'>Files</th>");
99 if (cgit_repo->enable_log_linecount) 99 if (cgit_repo->enable_log_linecount)
100 html("<th class='right'>Lines</th>"); 100 html("<th class='right'>Lines</th>");
101 } 101 }
102 html("<th class='left'>Author</th></tr>\n"); 102 html("<th class='left'>Author</th></tr>\n");
103 103
104 if (ofs<0) 104 if (ofs<0)
105 ofs = 0; 105 ofs = 0;
diff --git a/ui-repolist.c b/ui-repolist.c
index 9aa5c1e..3e97ca9 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -44,25 +44,25 @@ static void print_modtime(struct repoinfo *repo)
44 44
45void cgit_print_repolist(struct cacheitem *item) 45void cgit_print_repolist(struct cacheitem *item)
46{ 46{
47 int i, columns = 4; 47 int i, columns = 4;
48 char *last_group = NULL; 48 char *last_group = NULL;
49 49
50 if (cgit_enable_index_links) 50 if (cgit_enable_index_links)
51 columns++; 51 columns++;
52 52
53 cgit_print_docstart(cgit_root_title, item); 53 cgit_print_docstart(cgit_root_title, item);
54 cgit_print_pageheader(cgit_root_title, 0); 54 cgit_print_pageheader(cgit_root_title, 0);
55 55
56 html("<table class='list nowrap'>"); 56 html("<table summary='repository list' class='list nowrap'>");
57 if (cgit_index_header) { 57 if (cgit_index_header) {
58 htmlf("<tr class='nohover'><td colspan='%d' class='include-block'>", 58 htmlf("<tr class='nohover'><td colspan='%d' class='include-block'>",
59 columns); 59 columns);
60 html_include(cgit_index_header); 60 html_include(cgit_index_header);
61 html("</td></tr>"); 61 html("</td></tr>");
62 } 62 }
63 html("<tr class='nohover'>" 63 html("<tr class='nohover'>"
64 "<th class='left'>Name</th>" 64 "<th class='left'>Name</th>"
65 "<th class='left'>Description</th>" 65 "<th class='left'>Description</th>"
66 "<th class='left'>Owner</th>" 66 "<th class='left'>Owner</th>"
67 "<th class='left'>Idle</th>"); 67 "<th class='left'>Idle</th>");
68 if (cgit_enable_index_links) 68 if (cgit_enable_index_links)
diff --git a/ui-shared.c b/ui-shared.c
index 7c69f60..9ec646b 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -349,40 +349,40 @@ void cgit_print_age(time_t t, time_t max_relative, char *format)
349 htmlf("<span class='age-years'>%.0f years</span>", 349 htmlf("<span class='age-years'>%.0f years</span>",
350 secs * 1.0 / TM_YEAR); 350 secs * 1.0 / TM_YEAR);
351} 351}
352 352
353void cgit_print_docstart(char *title, struct cacheitem *item) 353void cgit_print_docstart(char *title, struct cacheitem *item)
354{ 354{
355 html("Content-Type: text/html; charset=" PAGE_ENCODING "\n"); 355 html("Content-Type: text/html; charset=" PAGE_ENCODING "\n");
356 htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime)); 356 htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime));
357 htmlf("Expires: %s\n", http_date(item->st.st_mtime + 357 htmlf("Expires: %s\n", http_date(item->st.st_mtime +
358 ttl_seconds(item->ttl))); 358 ttl_seconds(item->ttl)));
359 html("\n"); 359 html("\n");
360 html(cgit_doctype); 360 html(cgit_doctype);
361 html("<html>\n"); 361 html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n");
362 html("<head>\n"); 362 html("<head>\n");
363 html("<title>"); 363 html("<title>");
364 html_txt(title); 364 html_txt(title);
365 html("</title>\n"); 365 html("</title>\n");
366 htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); 366 htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version);
367 html("<link rel='stylesheet' type='text/css' href='"); 367 html("<link rel='stylesheet' type='text/css' href='");
368 html_attr(cgit_css); 368 html_attr(cgit_css);
369 html("'/>\n"); 369 html("'/>\n");
370 html("</head>\n"); 370 html("</head>\n");
371 html("<body>\n"); 371 html("<body>\n");
372} 372}
373 373
374void cgit_print_docend() 374void cgit_print_docend()
375{ 375{
376 html("</td>\n</tr>\n<table>\n</body>\n</html>\n"); 376 html("</td>\n</tr>\n</table>\n</body>\n</html>\n");
377} 377}
378 378
379int print_branch_option(const char *refname, const unsigned char *sha1, 379int print_branch_option(const char *refname, const unsigned char *sha1,
380 int flags, void *cb_data) 380 int flags, void *cb_data)
381{ 381{
382 char *name = (char *)refname; 382 char *name = (char *)refname;
383 html_option(name, name, cgit_query_head); 383 html_option(name, name, cgit_query_head);
384 return 0; 384 return 0;
385} 385}
386 386
387int print_archive_ref(const char *refname, const unsigned char *sha1, 387int print_archive_ref(const char *refname, const unsigned char *sha1,
388 int flags, void *cb_data) 388 int flags, void *cb_data)
@@ -447,88 +447,88 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page)
447 html_hidden("qt", cgit_query_grep); 447 html_hidden("qt", cgit_query_grep);
448 if (cgit_query_search) 448 if (cgit_query_search)
449 html_hidden("q", cgit_query_search); 449 html_hidden("q", cgit_query_search);
450 } 450 }
451} 451}
452 452
453void cgit_print_pageheader(char *title, int show_search) 453void cgit_print_pageheader(char *title, int show_search)
454{ 454{
455 static const char *default_info = "This is cgit, a fast webinterface for git repositories"; 455 static const char *default_info = "This is cgit, a fast webinterface for git repositories";
456 int header = 0; 456 int header = 0;
457 457
458 html("<div id='sidebar'>\n"); 458 html("<div id='sidebar'>\n");
459 html("<a href='"); 459 html("<div id='logo'><a href='");
460 html_attr(cgit_rooturl()); 460 html_attr(cgit_rooturl());
461 htmlf("'><div id='logo'><img src='%s' alt='cgit'/></div></a>\n", 461 htmlf("'><img src='%s' alt='cgit'/></a></div>\n",
462 cgit_logo); 462 cgit_logo);
463 html("<div class='infobox'>"); 463 html("<div class='infobox'>");
464 if (cgit_query_repo) { 464 if (cgit_query_repo) {
465 html("<h1>"); 465 html("<h1 class='first'>");
466 html_txt(strrpart(cgit_repo->name, 20)); 466 html_txt(strrpart(cgit_repo->name, 20));
467 html("</h1>\n"); 467 html("</h1>\n");
468 html_txt(cgit_repo->desc); 468 html_txt(cgit_repo->desc);
469 if (cgit_repo->owner) { 469 if (cgit_repo->owner) {
470 html("<p>\n<h1>owner</h1>\n"); 470 html("<h1>owner</h1>\n");
471 html_txt(cgit_repo->owner); 471 html_txt(cgit_repo->owner);
472 } 472 }
473 html("<p>\n<h1>navigate</h1>\n"); 473 html("<h1>navigate</h1>\n");
474 reporevlink(NULL, "summary", NULL, "menu", cgit_query_head, 474 reporevlink(NULL, "summary", NULL, "menu", cgit_query_head,
475 NULL, NULL); 475 NULL, NULL);
476 cgit_log_link("log", NULL, "menu", cgit_query_head, NULL, NULL, 476 cgit_log_link("log", NULL, "menu", cgit_query_head, NULL, NULL,
477 0, NULL, NULL); 477 0, NULL, NULL);
478 cgit_tree_link("tree", NULL, "menu", cgit_query_head, 478 cgit_tree_link("tree", NULL, "menu", cgit_query_head,
479 cgit_query_sha1, NULL); 479 cgit_query_sha1, NULL);
480 cgit_commit_link("commit", NULL, "menu", cgit_query_head, 480 cgit_commit_link("commit", NULL, "menu", cgit_query_head,
481 cgit_query_sha1); 481 cgit_query_sha1);
482 cgit_diff_link("diff", NULL, "menu", cgit_query_head, 482 cgit_diff_link("diff", NULL, "menu", cgit_query_head,
483 cgit_query_sha1, cgit_query_sha2, NULL); 483 cgit_query_sha1, cgit_query_sha2, NULL);
484 484
485 for_each_ref(print_archive_ref, &header); 485 for_each_ref(print_archive_ref, &header);
486 486
487 html("<p>\n<h1>branch</h1>\n"); 487 html("<h1>branch</h1>\n");
488 html("<form method='get' action=''>\n"); 488 html("<form method='get' action=''>\n");
489 add_hidden_formfields(0, 1, cgit_query_page); 489 add_hidden_formfields(0, 1, cgit_query_page);
490 html("<table class='grid'><tr><td id='branch-dropdown-cell'>"); 490 html("<table summary='branch selector' class='grid'><tr><td id='branch-dropdown-cell'>");
491 html("<select name='h' onchange='this.form.submit();'>\n"); 491 html("<select name='h' onchange='this.form.submit();'>\n");
492 for_each_branch_ref(print_branch_option, cgit_query_head); 492 for_each_branch_ref(print_branch_option, cgit_query_head);
493 html("</select>\n"); 493 html("</select>\n");
494 html("</td><td>"); 494 html("</td><td>");
495 html("<noscript><input type='submit' id='switch-btn' value='..'></noscript>\n"); 495 html("<noscript><input type='submit' id='switch-btn' value='..'/></noscript>\n");
496 html("</td></tr></table>"); 496 html("</td></tr></table>");
497 html("</form>\n"); 497 html("</form>\n");
498 498
499 html("<p>\n<h1>search</h1>\n"); 499 html("<h1>search</h1>\n");
500 html("<form method='get' action='"); 500 html("<form method='get' action='");
501 if (cgit_virtual_root) 501 if (cgit_virtual_root)
502 html_attr(cgit_fileurl(cgit_query_repo, "log", 502 html_attr(cgit_fileurl(cgit_query_repo, "log",
503 cgit_query_path, NULL)); 503 cgit_query_path, NULL));
504 html("'>\n"); 504 html("'>\n");
505 add_hidden_formfields(1, 0, "log"); 505 add_hidden_formfields(1, 0, "log");
506 html("<select name='qt'>\n"); 506 html("<select name='qt'>\n");
507 html_option("grep", "log msg", cgit_query_grep); 507 html_option("grep", "log msg", cgit_query_grep);
508 html_option("author", "author", cgit_query_grep); 508 html_option("author", "author", cgit_query_grep);
509 html_option("committer", "committer", cgit_query_grep); 509 html_option("committer", "committer", cgit_query_grep);
510 html("</select>\n"); 510 html("</select>\n");
511 html("<input class='txt' type='text' name='q' value='"); 511 html("<input class='txt' type='text' name='q' value='");
512 html_attr(cgit_query_search); 512 html_attr(cgit_query_search);
513 html("'/>\n"); 513 html("'/>\n");
514 html("</form>\n"); 514 html("</form>\n");
515 } else { 515 } else {
516 if (!cgit_index_info || html_include(cgit_index_info)) 516 if (!cgit_index_info || html_include(cgit_index_info))
517 html(default_info); 517 html(default_info);
518 } 518 }
519 519
520 html("</div>\n"); 520 html("</div>\n");
521 521
522 html("</div>\n<table class='grid'><tr><td id='content'>\n"); 522 html("</div>\n<table summary='page content' class='grid'><tr><td id='content'>\n");
523} 523}
524 524
525 525
526void cgit_print_snapshot_start(const char *mimetype, const char *filename, 526void cgit_print_snapshot_start(const char *mimetype, const char *filename,
527 struct cacheitem *item) 527 struct cacheitem *item)
528{ 528{
529 htmlf("Content-Type: %s\n", mimetype); 529 htmlf("Content-Type: %s\n", mimetype);
530 htmlf("Content-Disposition: inline; filename=\"%s\"\n", filename); 530 htmlf("Content-Disposition: inline; filename=\"%s\"\n", filename);
531 htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime)); 531 htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime));
532 htmlf("Expires: %s\n", http_date(item->st.st_mtime + 532 htmlf("Expires: %s\n", http_date(item->st.st_mtime +
533 ttl_seconds(item->ttl))); 533 ttl_seconds(item->ttl)));
534 html("\n"); 534 html("\n");
diff --git a/ui-summary.c b/ui-summary.c
index c856793..b96414e 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -181,20 +181,20 @@ void cgit_print_tags(int maxcount)
181} 181}
182 182
183void cgit_print_summary() 183void cgit_print_summary()
184{ 184{
185 if (cgit_repo->readme) { 185 if (cgit_repo->readme) {
186 html("<div id='summary'>"); 186 html("<div id='summary'>");
187 html_include(cgit_repo->readme); 187 html_include(cgit_repo->readme);
188 html("</div>"); 188 html("</div>");
189 } 189 }
190 if (cgit_summary_log > 0) 190 if (cgit_summary_log > 0)
191 cgit_print_log(cgit_query_head, 0, cgit_summary_log, NULL, 191 cgit_print_log(cgit_query_head, 0, cgit_summary_log, NULL,
192 NULL, NULL, 0); 192 NULL, NULL, 0);
193 html("<table class='list nowrap'>"); 193 html("<table summary='repository info' class='list nowrap'>");
194 if (cgit_summary_log > 0) 194 if (cgit_summary_log > 0)
195 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); 195 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
196 cgit_print_branches(cgit_summary_branches); 196 cgit_print_branches(cgit_summary_branches);
197 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); 197 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
198 cgit_print_tags(cgit_summary_tags); 198 cgit_print_tags(cgit_summary_tags);
199 html("</table>"); 199 html("</table>");
200} 200}
diff --git a/ui-tree.c b/ui-tree.c
index c22e30b..c138877 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -8,45 +8,45 @@
8 8
9#include "cgit.h" 9#include "cgit.h"
10 10
11char *curr_rev; 11char *curr_rev;
12char *match_path; 12char *match_path;
13int header = 0; 13int header = 0;
14 14
15static void print_object(const unsigned char *sha1, char *path) 15static void print_object(const unsigned char *sha1, char *path)
16{ 16{
17 enum object_type type; 17 enum object_type type;
18 char *buf; 18 char *buf;
19 unsigned long size, lineno, start, idx; 19 unsigned long size, lineno, start, idx;
20 const char *linefmt = "<tr><td class='no'><a name='%1$d'>%1$d</a></td><td class='txt'>"; 20 const char *linefmt = "<tr><td class='no'><a id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a></td><td class='txt'>";
21 21
22 type = sha1_object_info(sha1, &size); 22 type = sha1_object_info(sha1, &size);
23 if (type == OBJ_BAD) { 23 if (type == OBJ_BAD) {
24 cgit_print_error(fmt("Bad object name: %s", 24 cgit_print_error(fmt("Bad object name: %s",
25 sha1_to_hex(sha1))); 25 sha1_to_hex(sha1)));
26 return; 26 return;
27 } 27 }
28 28
29 buf = read_sha1_file(sha1, &type, &size); 29 buf = read_sha1_file(sha1, &type, &size);
30 if (!buf) { 30 if (!buf) {
31 cgit_print_error(fmt("Error reading object %s", 31 cgit_print_error(fmt("Error reading object %s",
32 sha1_to_hex(sha1))); 32 sha1_to_hex(sha1)));
33 return; 33 return;
34 } 34 }
35 35
36 html(" blob: <a href='"); 36 html(" blob: <a href='");
37 html_attr(cgit_pageurl(cgit_query_repo, "blob", fmt("id=%s", sha1_to_hex(sha1)))); 37 html_attr(cgit_pageurl(cgit_query_repo, "blob", fmt("id=%s", sha1_to_hex(sha1))));
38 htmlf("'>%s</a>",sha1_to_hex(sha1)); 38 htmlf("'>%s</a>",sha1_to_hex(sha1));
39 39
40 html("<table class='blob'>\n"); 40 html("<table summary='blob content' class='blob'>\n");
41 idx = 0; 41 idx = 0;
42 start = 0; 42 start = 0;
43 lineno = 0; 43 lineno = 0;
44 while(idx < size) { 44 while(idx < size) {
45 if (buf[idx] == '\n') { 45 if (buf[idx] == '\n') {
46 buf[idx] = '\0'; 46 buf[idx] = '\0';
47 htmlf(linefmt, ++lineno); 47 htmlf(linefmt, ++lineno);
48 html_txt(buf + start); 48 html_txt(buf + start);
49 html("</td></tr>\n"); 49 html("</td></tr>\n");
50 start = idx + 1; 50 start = idx + 1;
51 } 51 }
52 idx++; 52 idx++;
@@ -99,25 +99,25 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
99 htmlf("</td><td class='ls-size'>%li</td>", size); 99 htmlf("</td><td class='ls-size'>%li</td>", size);
100 100
101 html("<td>"); 101 html("<td>");
102 cgit_log_link("log", NULL, "button", cgit_query_head, curr_rev, 102 cgit_log_link("log", NULL, "button", cgit_query_head, curr_rev,
103 fullpath, 0, NULL, NULL); 103 fullpath, 0, NULL, NULL);
104 html("</td></tr>\n"); 104 html("</td></tr>\n");
105 free(name); 105 free(name);
106 return 0; 106 return 0;
107} 107}
108 108
109static void ls_head() 109static void ls_head()
110{ 110{
111 html("<table class='list'>\n"); 111 html("<table summary='tree listing' class='list'>\n");
112 html("<tr class='nohover'>"); 112 html("<tr class='nohover'>");
113 html("<th class='left'>Mode</th>"); 113 html("<th class='left'>Mode</th>");
114 html("<th class='left'>Name</th>"); 114 html("<th class='left'>Name</th>");
115 html("<th class='right'>Size</th>"); 115 html("<th class='right'>Size</th>");
116 html("<th/>"); 116 html("<th/>");
117 html("</tr>\n"); 117 html("</tr>\n");
118 header = 1; 118 header = 1;
119} 119}
120 120
121static void ls_tail() 121static void ls_tail()
122{ 122{
123 if (!header) 123 if (!header)