Page MenuHomePhabricator

xhtml_namespaces.patch

Authored By
bzimport
Nov 21 2014, 9:25 PM
Size
4 KB
Referenced Files
None
Subscribers
None

xhtml_namespaces.patch

Index: includes/OutputPage.php
===================================================================
--- includes/OutputPage.php (revision 17257)
+++ includes/OutputPage.php (working copy)
@@ -970,6 +970,7 @@
*/
function headElement() {
global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
+ global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
global $wgUser, $wgContLang, $wgUseTrackbacks, $wgTitle, $wgStyleVersion;
if( $wgMimeType == 'text/xml' || $wgMimeType == 'application/xhtml+xml' || $wgMimeType == 'application/xml' ) {
@@ -985,7 +986,11 @@
}
$rtl = $wgContLang->isRTL() ? " dir='RTL'" : '';
- $ret .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"$wgContLanguageCode\" lang=\"$wgContLanguageCode\" $rtl>\n";
+ $ret .= "<html xmlns=\"{$wgXhtmlDefaultNamespace}\" ";
+ foreach($wgXhtmlNamespaces as $tag => $ns) {
+ $ret .= "xmlns:{$tag}=\"{$ns}\" ";
+ }
+ $ret .= "xml:lang=\"$wgContLanguageCode\" lang=\"$wgContLanguageCode\" $rtl>\n";
$ret .= "<head>\n<title>" . htmlspecialchars( $this->getHTMLTitle() ) . "</title>\n";
array_push( $this->mMetatags, array( "http:Content-type", "$wgMimeType; charset={$wgOutputEncoding}" ) );
Index: includes/DefaultSettings.php
===================================================================
--- includes/DefaultSettings.php (revision 17257)
+++ includes/DefaultSettings.php (working copy)
@@ -657,7 +657,16 @@
$wgJsMimeType = 'text/javascript';
$wgDocType = '-//W3C//DTD XHTML 1.0 Transitional//EN';
$wgDTD = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd';
+$wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
+# Permit other namespaces in addition to the w3.org default.
+# Use the prefix for the key and the namespace for the value. For
+# example:
+# $wgXhtmlNamespaces['svg'] = 'http://www.w3.org/2000/svg';
+# Normally we wouldn't have to define this in the root <html>
+# element, but IE needs it there in some circumstances.
+$wgXhtmlNamespaces = array();
+
/** Enable to allow rewriting dates in page text.
* DOES NOT FORMAT CORRECTLY FOR MOST LANGUAGES */
$wgUseDynamicDates = false;
Index: includes/SkinTemplate.php
===================================================================
--- includes/SkinTemplate.php (revision 17257)
+++ includes/SkinTemplate.php (working copy)
@@ -134,6 +134,7 @@
global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang, $wgOut;
global $wgScript, $wgStylePath, $wgContLanguageCode;
global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
+ global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses, $wgHideInterlanguageLinks;
global $wgMaxCredits, $wgShowCreditsIfMax;
global $wgPageShowWatchingUsers;
@@ -238,6 +239,8 @@
if ($wgUseTrackbacks && $out->isArticleRelated())
$tpl->set( 'trackbackhtml', $wgTitle->trackbackRDF());
+ $tpl->setRef( 'xhtmldefaultnamespace', $wgXhtmlDefaultNamespace );
+ $tpl->set( 'xhtmlnamespaces', $wgXhtmlNamespaces );
$tpl->setRef( 'mimetype', $wgMimeType );
$tpl->setRef( 'jsmimetype', $wgJsMimeType );
$tpl->setRef( 'charset', $wgOutputEncoding );
Index: skins/MonoBook.php
===================================================================
--- skins/MonoBook.php (revision 17257)
+++ skins/MonoBook.php (working copy)
@@ -51,7 +51,10 @@
wfSuppressWarnings();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
+<html xmlns="<?php $this->text('xhtmldefaultnamespace') ?>" <?php
+ foreach($this->data['xhtmlnamespaces'] as $tag => $ns) {
+ ?>xmlns:<?php echo "{$tag}=\"{$ns}\" ";
+ } ?>xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
<head>
<meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
<?php $this->html('headlinks') ?>

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2834
Default Alt Text
xhtml_namespaces.patch (4 KB)

Event Timeline