diff options
author | Jason Yundt <jason@jasonyundt.email> | 2022-06-02 07:43:05 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-06-02 11:51:15 -0700 |
commit | 0e1a85ca7558a9ec6f2e708dcc106c455a50776d (patch) | |
tree | 1aeab1769c791a88576c792f5a17b43284164f70 /t/t9502-gitweb-standalone-parse-output.sh | |
parent | 2668e3608e47494f2f10ef2b6e69f08a84816bcb (diff) | |
download | git-0e1a85ca7558a9ec6f2e708dcc106c455a50776d.tar.gz |
gitweb: switch to an XHTML5 DOCTYPE
According to the HTML Standard FAQ:
“What is the DOCTYPE for modern HTML documents?
In text/html documents:
<!DOCTYPE html>
In documents delivered with an XML media type: no DOCTYPE is required
and its use is generally unnecessary. However, you may use one if you
want (see the following question). Note that the above is well-formed
XML.”
Source: [1]
Gitweb uses an XHTML 1.0 DOCTYPE:
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
While that DOCTYPE is still valid [2], it has several disadvantages:
1. It’s misleading. If an XML parser uses the DTD at the given link,
then the entities and ⋅ won’t get declared. Instead, the
parser has to use a DTD from the HTML Standard that has nothing to do
with XHTML 1.0 [2].
2. It’s obsolete. XHTML 1.0 was last revised in 2002 and was superseded in
2018 [3].
3. It’s unreliable. Gitweb uses and ⋅ but lets an external file
define them. “[…U]using entity references for characters in XML documents
is unsafe if they are defined in an external file (except for <, >,
&, ", and ').” [4]
[1]: <https://github.com/whatwg/html/blob/main/FAQ.md#what-is-the-doctype-for-modern-html-documents>
[2]: <https://html.spec.whatwg.org/multipage/xhtml.html#parsing-xhtml-documents>
[3]: <https://www.w3.org/TR/xhtml1/#xhtml>
[4]: <https://html.spec.whatwg.org/multipage/xhtml.html#writing-xhtml-documents>
Signed-off-by: Jason Yundt <jason@jasonyundt.email>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9502-gitweb-standalone-parse-output.sh')
-rwxr-xr-x | t/t9502-gitweb-standalone-parse-output.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t9502-gitweb-standalone-parse-output.sh b/t/t9502-gitweb-standalone-parse-output.sh index 8cb582f0e6..81d5625557 100755 --- a/t/t9502-gitweb-standalone-parse-output.sh +++ b/t/t9502-gitweb-standalone-parse-output.sh @@ -220,4 +220,18 @@ test_expect_success 'no http-equiv="content-type" in XHTML' ' no_http_equiv_content_type "p=.git;a=tree" ' +proper_doctype() { + gitweb_run "$@" && + grep -F "<!DOCTYPE html [" gitweb.body && + grep "<!ENTITY nbsp" gitweb.body && + grep "<!ENTITY sdot" gitweb.body +} + +test_expect_success 'Proper DOCTYPE with entity declarations' ' + proper_doctype && + proper_doctype "p=.git" && + proper_doctype "p=.git;a=log" && + proper_doctype "p=.git;a=tree" +' + test_done |