diff options
| author | 2007-11-11 21:04:28 (JST) | |
|---|---|---|
| committer | 2007-11-11 21:04:28 (JST) | |
| commit | 2915483ef6c9c29ac1493e6945688bb62f7825b4 (patch) | |
| tree | 3ee4afec27ec8cb0ad5e10008f3bd8c994747c39 | |
| parent | b4649fc90597910c89c3f37a6aec9af54d9f416b (diff) | |
| download | cgit-2915483ef6c9c29ac1493e6945688bb62f7825b4.zip cgit-2915483ef6c9c29ac1493e6945688bb62f7825b4.tar.gz | |
Fix html error detected by test-suite
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
| -rw-r--r-- | cgit.css | 6 | ||||
| -rw-r--r-- | html.c | 2 | ||||
| -rwxr-xr-x | tests/t0104-tree.sh | 10 | ||||
| -rwxr-xr-x | tests/t0105-commit.sh | 2 | ||||
| -rw-r--r-- | ui-commit.c | 6 | ||||
| -rw-r--r-- | ui-diff.c | 2 | ||||
| -rw-r--r-- | ui-log.c | 2 | ||||
| -rw-r--r-- | ui-repolist.c | 2 | ||||
| -rw-r--r-- | ui-shared.c | 24 | ||||
| -rw-r--r-- | ui-summary.c | 2 | ||||
| -rw-r--r-- | ui-tree.c | 6 |
11 files changed, 37 insertions, 27 deletions
| @@ -111,7 +111,11 @@ div#sidebar div.infobox { | |||
| 111 | div#sidebar div.infobox h1 { | 111 | div#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 | |||
| 117 | div#sidebar div.infobox h1.first { | ||
| 118 | margin-top: 0px; | ||
| 115 | } | 119 | } |
| 116 | 120 | ||
| 117 | div#sidebar div.infobox a.menu { | 121 | div#sidebar div.infobox a.menu { |
| @@ -132,7 +132,7 @@ void html_option(char *value, char *text, char *selected_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"); |
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 | |||
| @@ -9,7 +9,13 @@ run_test 'find file-1' 'grep -e "file-1" trash/tmp' | |||
| 9 | run_test 'find file-50' 'grep -e "file-50" trash/tmp' | 9 | run_test 'find file-50' 'grep -e "file-50" trash/tmp' |
| 10 | 10 | ||
| 11 | run_test 'generate bar/tree/file-50' 'cgit_url "bar/tree/file-50" >trash/tmp' | 11 | run_test 'generate bar/tree/file-50' 'cgit_url "bar/tree/file-50" >trash/tmp' |
| 12 | run_test 'find line 1' 'grep -e "<a name=.1.>1</a>" trash/tmp' | 12 | |
| 13 | run_test 'no line 2' 'grep -ve "<a name=.2.>2</a>" trash/tmp' | 13 | run_test 'find line 1' ' |
| 14 | grep -e "<a id=.n1. name=.n1. href=.#n1.>1</a>" trash/tmp | ||
| 15 | ' | ||
| 16 | |||
| 17 | run_test 'no line 2' ' | ||
| 18 | grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp | ||
| 19 | ' | ||
| 14 | 20 | ||
| 15 | tests_done | 21 | tests_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 | |||
| @@ -13,7 +13,7 @@ run_test 'find commit subject' ' | |||
| 13 | ' | 13 | ' |
| 14 | 14 | ||
| 15 | run_test 'find commit msg' 'grep -e "<div class=.commit-msg.></div>" trash/tmp' | 15 | run_test 'find commit msg' 'grep -e "<div class=.commit-msg.></div>" trash/tmp' |
| 16 | run_test 'find diffstat' 'grep -e "<table class=.diffstat.>" trash/tmp' | 16 | run_test 'find diffstat' 'grep -e "<table summary=.diffstat. class=.diffstat.>" trash/tmp' |
| 17 | 17 | ||
| 18 | run_test 'find diff summary' ' | 18 | run_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 |
diff --git a/ui-commit.c b/ui-commit.c index 4ac8955..bd55a33 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
| @@ -84,7 +84,7 @@ void print_fileinfo(struct fileinfo *info) | |||
| 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%%;'/>", |
| @@ -157,7 +157,7 @@ void cgit_print_commit(char *hex) | |||
| 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(" "); |
| @@ -209,7 +209,7 @@ void cgit_print_commit(char *hex) | |||
| 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++) |
| @@ -141,7 +141,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefi | |||
| 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>"); |
| @@ -90,7 +90,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
| 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 | ||
diff --git a/ui-repolist.c b/ui-repolist.c index 9aa5c1e..3e97ca9 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
| @@ -53,7 +53,7 @@ void cgit_print_repolist(struct cacheitem *item) | |||
| 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); |
diff --git a/ui-shared.c b/ui-shared.c index 7c69f60..9ec646b 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
| @@ -358,7 +358,7 @@ void cgit_print_docstart(char *title, struct cacheitem *item) | |||
| 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); |
| @@ -373,7 +373,7 @@ void cgit_print_docstart(char *title, struct cacheitem *item) | |||
| 373 | 373 | ||
| 374 | void cgit_print_docend() | 374 | void 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 | ||
| 379 | int print_branch_option(const char *refname, const unsigned char *sha1, | 379 | int print_branch_option(const char *refname, const unsigned char *sha1, |
| @@ -456,21 +456,21 @@ void cgit_print_pageheader(char *title, int show_search) | |||
| 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, |
| @@ -484,19 +484,19 @@ void cgit_print_pageheader(char *title, int show_search) | |||
| 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", |
| @@ -519,7 +519,7 @@ void cgit_print_pageheader(char *title, int show_search) | |||
| 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 | ||
diff --git a/ui-summary.c b/ui-summary.c index c856793..b96414e 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
| @@ -190,7 +190,7 @@ void cgit_print_summary() | |||
| 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'> </td></tr>"); | 195 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); |
| 196 | cgit_print_branches(cgit_summary_branches); | 196 | cgit_print_branches(cgit_summary_branches); |
| @@ -17,7 +17,7 @@ static void print_object(const unsigned char *sha1, char *path) | |||
| 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) { |
| @@ -37,7 +37,7 @@ static void print_object(const unsigned char *sha1, char *path) | |||
| 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; |
| @@ -108,7 +108,7 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, | |||
| 108 | 108 | ||
| 109 | static void ls_head() | 109 | static 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>"); |
