diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/ui-plain.c | 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 9 insertions, 4 deletions
diff --git a/source/ui-plain.c b/source/ui-plain.c index 9ce25b3..ed1ab31 100644 --- a/source/ui-plain.c +++ b/source/ui-plain.c @@ -127,9 +127,14 @@ static void print_dir(const struct object_id *oid, const char *base, leading_slash = (fullpath[0] == '/' ? "" : "/"); ctx.page.etag = oid_to_hex(oid); cgit_print_http_headers(); - htmlf("<html><head><title>%s", leading_slash); + // The listing is a full document of its own, so it carries the same + // doctype and charset as the layout pages or the browser would parse + // it in quirks mode. + html("<!DOCTYPE html>\n<html lang='en'>\n<head>\n"); + html("<meta charset='utf-8'>\n"); + htmlf("<title>%s", leading_slash); html_txt(fullpath); - htmlf("</title></head>\n<body>\n<h2>%s", leading_slash); + htmlf("</title>\n</head>\n<body>\n<h2>%s", leading_slash); html_txt(fullpath); html("</h2>\n<ul>\n"); len = strlen(fullpath); @@ -162,7 +167,7 @@ static void print_dir_entry(const struct object_id *oid, const char *base, fullpath = build_path(base, baselen, path); if (!S_ISDIR(mode) && !S_ISGITLINK(mode)) fullpath[strlen(fullpath) - 1] = 0; - html(" <li>"); + html("<li>"); if (S_ISGITLINK(mode)) cgit_submodule_link(NULL, fullpath, oid_to_hex(oid)); else @@ -174,7 +179,7 @@ static void print_dir_entry(const struct object_id *oid, const char *base, static void print_dir_tail(void) { - html(" </ul>\n</body></html>\n"); + html("</ul>\n</body>\n</html>\n"); } /* |
