Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -1567,7 +1567,7 @@ |
1568 | 1568 | public function headElement( Skin $sk, $includeStyle = true ) { |
1569 | 1569 | global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType; |
1570 | 1570 | global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version; |
1571 | | - global $wgContLang, $wgUseTrackbacks, $wgStyleVersion, $wgHtml5; |
| 1571 | + global $wgContLang, $wgUseTrackbacks, $wgStyleVersion, $wgHtml5, $wgWellFormedXml; |
1572 | 1572 | |
1573 | 1573 | $this->addMeta( "http:Content-Type", "$wgMimeType; charset={$wgOutputEncoding}" ); |
1574 | 1574 | if ( $sk->commonPrintStylesheet() ) { |
— | — | @@ -1588,9 +1588,21 @@ |
1589 | 1589 | $dir = $wgContLang->getDir(); |
1590 | 1590 | |
1591 | 1591 | if ( $wgHtml5 ) { |
1592 | | - $ret .= "<!DOCTYPE html>\n"; |
| 1592 | + if ( $wgWellFormedXml ) { |
| 1593 | + # Unknown elements and attributes are okay in XML, but unknown |
| 1594 | + # named entities are well-formedness errors and will break XML |
| 1595 | + # parsers. Thus we need a doctype that gives us appropriate |
| 1596 | + # entity definitions. The HTML5 spec permits four legacy |
| 1597 | + # doctypes as obsolete but conforming, so let's pick one of |
| 1598 | + # those, although it makes our pages look like XHTML1 Strict. |
| 1599 | + # Isn't compatibility great? |
| 1600 | + $ret .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; |
| 1601 | + } else { |
| 1602 | + # Much saner. |
| 1603 | + $ret .= "<!doctype html>\n"; |
| 1604 | + } |
1593 | 1605 | $ret .= "<html lang=\"$wgContLanguageCode\" dir=\"$dir\" "; |
1594 | | - if ($wgHtml5Version) $ret .= " version=\"$wgHtml5Version\" "; |
| 1606 | + if ( $wgHtml5Version ) $ret .= " version=\"$wgHtml5Version\" "; |
1595 | 1607 | $ret .= ">\n"; |
1596 | 1608 | } else { |
1597 | 1609 | $ret .= "<!DOCTYPE html PUBLIC \"$wgDocType\" \"$wgDTD\">\n"; |