git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] gitweb: switch to a modern DOCTYPE

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jun 2, 2022, 00:41 UTC
Message-ID
<YpgHUm93840oBtib@camp.crustytoothpaste.net>
In-Reply-To
<20220601012647.1439480-1-jason@jasonyundt.email>
On 2022-06-01 at 01:26:47, Jason Yundt wrote:
Show 26 quoted lines
> 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. The DTD that browsers are supposed to use with that
>    DOCTYPE has nothing to do with XHTML 1.0 and isn’t available at the URL
>    that is given [2].

While the WHATWG may claim that, an XML parser is absolutely within its rights to refer to and use that DTD, and in fact should do so unless its catalog directs it elsewhere. It may be that some browsers use an internal catalog that refers to a different DTD, however.

Show 13 quoted lines
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 606b50104c..1835487ab2 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -4219,7 +4219,10 @@ sub git_header_html {
>  	my $mod_perl_version = $ENV{'MOD_PERL'} ? " $ENV{'MOD_PERL'}" : '';
>  	print <<EOF;
>  <?xml version="1.0" encoding="utf-8"?>
> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> +<!DOCTYPE html [
> +	<!ENTITY nbsp "&#xA0;">
> +	<!ENTITY sdot "&#x22C5;">
> +]>

I think this should be fine. It defines the entities we need and appears to be valid XML. I don't think there should be any problem upgrading to XHTML 5 here.

-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Previous: Jason YundtNext: Junio C Hamano
Message 2 of 9 in “gitweb: switch to a modern DOCTYPE”
  1. gitweb: switch to a modern DOCTYPEJason Yundt, Jun 1, 2022
  2. brian m. carlsonJun 2, 2022
  3. Junio C HamanoJun 2, 2022
  4. Bagas SanjayaJun 2, 2022
  5. gitweb: switch to an XHTML5 DOCTYPEJason Yundt, Jun 2, 2022
  6. Junio C HamanoJun 2, 2022
  7. Jason YundtJun 2, 2022
  8. brian m. carlsonJun 2, 2022
  9. Junio C HamanoJun 2, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.