aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Mayo2019-02-21 19:56:05 +0000
committerJason A. Donenfeld2019-02-23 00:08:50 +0100
commit5bd7e9bc1b6749bbb5220d6c3a990469a7b839ae (patch)
tree9c06149f4d462af1bdc2cce63c64eec9a3518726
parent7d87cd3a215976a480b3c71b017a191597e5cb44 (diff)
downloadcgit-5bd7e9bc1b6749bbb5220d6c3a990469a7b839ae.tar.gz
cgit-5bd7e9bc1b6749bbb5220d6c3a990469a7b839ae.tar.bz2
cgit-5bd7e9bc1b6749bbb5220d6c3a990469a7b839ae.zip
ui-ssdiff: resolve HTML5 validation errors
- Remove ids from anchor elements. They were unusable because they were duplicated between files and versions of files. - Always close span, with html(). - Fix missing / on closing tr element in cgit_ssdiff_header_end(). Signed-off-by: Chris Mayo <aklhfex@gmail.com>
-rw-r--r--ui-ssdiff.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ui-ssdiff.c b/ui-ssdiff.c
index c456033..b6dc5b0 100644
--- a/ui-ssdiff.c
+++ b/ui-ssdiff.c
@@ -207,11 +207,13 @@ static void print_part_with_lcs(char *class, char *line, char *lcs)
207 } 207 }
208 } else if (line[i] == lcs[j]) { 208 } else if (line[i] == lcs[j]) {
209 same = 1; 209 same = 1;
210 htmlf("</span>"); 210 html("</span>");
211 j += 1; 211 j += 1;
212 } 212 }
213 html_txt(c); 213 html_txt(c);
214 } 214 }
215 if (!same)
216 html("</span>");
215} 217}
216 218
217static void print_ssdiff_line(char *class, 219static void print_ssdiff_line(char *class,
@@ -236,7 +238,7 @@ static void print_ssdiff_line(char *class,
236 char *fileurl = cgit_fileurl(ctx.repo->url, "tree", old_file->path, id_str); 238 char *fileurl = cgit_fileurl(ctx.repo->url, "tree", old_file->path, id_str);
237 html("<td class='lineno'><a href='"); 239 html("<td class='lineno'><a href='");
238 html(fileurl); 240 html(fileurl);
239 htmlf("' id='%s'>%s</a>", lineno_str, lineno_str + 1); 241 htmlf("'>%s</a>", lineno_str + 1);
240 html("</td>"); 242 html("</td>");
241 htmlf("<td class='%s'>", class); 243 htmlf("<td class='%s'>", class);
242 free(fileurl); 244 free(fileurl);
@@ -259,7 +261,7 @@ static void print_ssdiff_line(char *class,
259 char *fileurl = cgit_fileurl(ctx.repo->url, "tree", new_file->path, id_str); 261 char *fileurl = cgit_fileurl(ctx.repo->url, "tree", new_file->path, id_str);
260 html("<td class='lineno'><a href='"); 262 html("<td class='lineno'><a href='");
261 html(fileurl); 263 html(fileurl);
262 htmlf("' id='%s'>%s</a>", lineno_str, lineno_str + 1); 264 htmlf("'>%s</a>", lineno_str + 1);
263 html("</td>"); 265 html("</td>");
264 htmlf("<td class='%s'>", class); 266 htmlf("<td class='%s'>", class);
265 free(fileurl); 267 free(fileurl);
@@ -405,7 +407,7 @@ void cgit_ssdiff_header_begin(void)
405 407
406void cgit_ssdiff_header_end(void) 408void cgit_ssdiff_header_end(void)
407{ 409{
408 html("</td><tr>"); 410 html("</td></tr>");
409} 411}
410 412
411void cgit_ssdiff_footer(void) 413void cgit_ssdiff_footer(void)