r68803 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68802‎ | r68803 | r68804 >
Date:23:08, 30 June 2010
Author:simetrical
Status:ok
Tags:
Comment:
Use <!DOCTYPE html> unconditionally

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:&quot; + 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.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Html.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Html.php
@@ -598,19 +598,7 @@
599599 global $wgHtml5, $wgHtml5Version, $wgWellFormedXml, $wgDocType, $wgDTD;
600600 global $wgXhtmlNamespaces, $wgXhtmlDefaultNamespace;
601601 if ( $wgHtml5 ) {
602 - if ( $wgWellFormedXml ) {
603 - # Unknown elements and attributes are okay in XML, but unknown
604 - # named entities are well-formedness errors and will break XML
605 - # parsers. Thus we need a doctype that gives us appropriate
606 - # entity definitions. The HTML5 spec permits four legacy
607 - # doctypes as obsolete but conforming, so let's pick one of
608 - # those, although it makes our pages look like XHTML1 Strict.
609 - # Isn't compatibility great?
610 - $ret .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
611 - } else {
612 - # Much saner.
613 - $ret .= "<!doctype html>\n";
614 - }
 602+ $ret .= "<!DOCTYPE html>\n";
615603 if ( $wgHtml5Version ) {
616604 $attribs['version'] = $wgHtml5Version;
617605 }
Index: trunk/phase3/RELEASE-NOTES
@@ -95,6 +95,8 @@
9696 * texvc is now run via ulimit4.sh, to limit execution time.
9797 * SQLite now supports $wgSharedDB.
9898 * (bug 8507) Group file links by namespace:title on image pages
 99+* Stop emitting named entities, so we can use <!DOCTYPE html> while still being
 100+ well-formed XML
99101
100102 === Bug fixes in 1.17 ===
101103 * (bug 17560) Half-broken deletion moved image files to deletion archive

Follow-up revisions

RevisionCommit summaryAuthorDate
r82413Remove named entities again...simetrical18:56, 18 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r67090Remove most named character references from output...simetrical17:33, 30 May 2010

Status & tagging log