Use <!DOCTYPE html> unconditionally
authorAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 30 Jun 2010 23:08:49 +0000 (23:08 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 30 Jun 2010 23:08:49 +0000 (23:08 +0000)
See r67090 for context.  Everywhere that I've found this breaking
well-formedness is fixed.  Tested with the following Python:

import xml.sax
class Myhandler(xml.sax.ContentHandler):
    pass

h = Myhandler()
for page in ('BrokenRedirects', 'Deadendpages', 'DoubleRedirects', 'Longpages', 'Ancientpages', 'Lonelypages', 'Fewestrevisions', 'Withoutinterwiki', 'Protectedpages', 'Protectedtitles', 'Shortpages', 'Uncategorizedcategories', 'Uncategorizedimages', 'Uncategorizedpages', 'Uncategorizedtemplates', 'Unusedcategories', 'Unusedimages', 'Unusedtemplates', 'Unwatchedpages', 'Wantedcategories', 'Wantedfiles', 'Wantedpages', 'Wantedtemplates', 'Allpages', 'Prefixindex', 'Categories', 'Disambiguations', 'Listredirects', 'Userlogin', 'CreateAccount', 'Blockip', 'Ipblocklist', 'Unblock', 'Resetpass', 'DeletedContributions', 'Preferences', 'Contributions', 'Listgrouprights', 'Listusers', 'Activeusers', 'Userrights', 'Newimages', 'Log', 'Watchlist', 'Newpages', 'Recentchanges', 'Recentchangeslinked', 'Tags', 'Listfiles', 'Filepath', 'MIMEsearch', 'FileDuplicateSearch', 'Upload', 'Statistics', 'Allmessages', 'Version', 'Lockdb', 'Unlockdb', 'LinkSearch', 'Randompage', 'Randomredirect', 'Mostlinkedcategories', 'Mostimages', 'Mostlinked', 'Mostlinkedtemplates', 'Mostcategories', 'Mostrevisions', 'ComparePages', 'Export', 'Import', 'Undelete', 'Whatlinkshere', 'MergeHistory', 'Booksources', 'Blankpage', 'Blockme', 'Emailuser', 'Listadmins', 'Listbots', 'Movepage', 'Mycontributions', 'Mypage', 'Mytalk', 'Revisiondelete', 'RevisionMove', 'Specialpages', 'Userlogout'):
    xml.sax.parse("http://localhost/git-trunk/phase3/index.php?title=Special:" + page, h)

I had to manually skip some of these for unrelated reasons, but none of
them became malformed because of this commit.  Also tested the main page
and Special:Random a bunch of separate times.  There are probably other
well-formedness errors lurking, but they can be fixed as they're
reported.

RELEASE-NOTES
includes/Html.php

index 97fa093..ed7f06d 100644 (file)
@@ -95,6 +95,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * texvc is now run via ulimit4.sh, to limit execution time.
 * SQLite now supports $wgSharedDB.
 * (bug 8507) Group file links by namespace:title on image pages
+* Stop emitting named entities, so we can use <!DOCTYPE html> while still being
+  well-formed XML
 
 === Bug fixes in 1.17 ===
 * (bug 17560) Half-broken deletion moved image files to deletion archive
index 76abf38..fea5fb7 100644 (file)
@@ -598,19 +598,7 @@ class Html {
                global $wgHtml5, $wgHtml5Version, $wgWellFormedXml, $wgDocType, $wgDTD;
                global $wgXhtmlNamespaces, $wgXhtmlDefaultNamespace;
                if ( $wgHtml5 ) {
-                       if ( $wgWellFormedXml ) {
-                               # Unknown elements and attributes are okay in XML, but unknown
-                               # named entities are well-formedness errors and will break XML
-                               # parsers.  Thus we need a doctype that gives us appropriate
-                               # entity definitions.  The HTML5 spec permits four legacy
-                               # doctypes as obsolete but conforming, so let's pick one of
-                               # those, although it makes our pages look like XHTML1 Strict.
-                               # Isn't compatibility great?
-                               $ret .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
-                       } else {
-                               # Much saner.
-                               $ret .= "<!doctype html>\n";
-                       }
+                       $ret .= "<!DOCTYPE html>\n";
                        if ( $wgHtml5Version ) {
                                $attribs['version'] = $wgHtml5Version;
                        }