Author: Chris Mayo <aklhfex@gmail.com>
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>
ui-ssdiff.c | 10 ++++++----
diff --git a/ui-ssdiff.c b/ui-ssdiff.c
index c4560330a9c265a67bc2e65a28d4617b5de74a07..b6dc5b0578ba68589a4eba8b38d47c27b5012db4 100644
--- a/ui-ssdiff.c
+++ b/ui-ssdiff.c
@@ -207,11 +207,13 @@ htmlf("", class);
}
} else if (line[i] == lcs[j]) {
same = 1;
- htmlf("</span>");
+ html("</span>");
j += 1;
}
html_txt(c);
}
+ if (!same)
+ html("</span>");
}
static void print_ssdiff_line(char *class,
@@ -236,7 +238,7 @@ char *id_str = fmt("id=%s#%s", is_null_oid(&old_file->oid)?"HEAD":oid_to_hex(old_rev_oid), lineno_str);
char *fileurl = cgit_fileurl(ctx.repo->url, "tree", old_file->path, id_str);
html("<td class='lineno'><a href='");
html(fileurl);
- htmlf("' id='%s'>%s</a>", lineno_str, lineno_str + 1);
+ htmlf("'>%s</a>", lineno_str + 1);
html("</td>");
htmlf("<td class='%s'>", class);
free(fileurl);
@@ -259,7 +261,7 @@ char *id_str = fmt("id=%s#%s", is_null_oid(&new_file->oid)?"HEAD":oid_to_hex(new_rev_oid), lineno_str);
char *fileurl = cgit_fileurl(ctx.repo->url, "tree", new_file->path, id_str);
html("<td class='lineno'><a href='");
html(fileurl);
- htmlf("' id='%s'>%s</a>", lineno_str, lineno_str + 1);
+ htmlf("'>%s</a>", lineno_str + 1);
html("</td>");
htmlf("<td class='%s'>", class);
free(fileurl);
@@ -405,7 +407,7 @@ }
void cgit_ssdiff_header_end(void)
{
- html("</td><tr>");
+ html("</td></tr>");
}
void cgit_ssdiff_footer(void)