From: Antoine Musso Date: Sun, 7 Jan 2007 22:31:07 +0000 (+0000) Subject: Implements #7667 : allow XHTML namespaces customization. Patch by Evan Miller X-Git-Tag: 1.31.0-rc.0~54592 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=f5020768d20550878b6654dc71674bb2edead9ad;p=lhc%2Fweb%2Fwiklou.git Implements #7667 : allow XHTML namespaces customization. Patch by Evan Miller --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ce60388219..564c39c846 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -478,6 +478,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 3706) Allow users to be exempted from IP blocks. The ipblock-exempt permission key has been added to enable this behaviour, by default assigned to sysops. * (bug 7948) importDump.php now warn that Recentchanges need to be rebuild. +* (bug 7667) allow XHTML namespaces customization == Languages updated == diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 00a375b88f..c2aa24adf0 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -687,6 +687,15 @@ $wgMimeType = 'text/html'; $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 +# 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 */ diff --git a/includes/OutputPage.php b/includes/OutputPage.php index d83e1e1634..4ca9e88a48 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1043,6 +1043,7 @@ class OutputPage { */ public 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' ) { @@ -1058,7 +1059,11 @@ class OutputPage { } $rtl = $wgContLang->isRTL() ? " dir='RTL'" : ''; - $ret .= "\n"; + $ret .= " $ns) { + $ret .= "xmlns:{$tag}=\"{$ns}\" "; + } + $ret .= "xml:lang=\"$wgContLanguageCode\" lang=\"$wgContLanguageCode\" $rtl>\n"; $ret .= "\n" . htmlspecialchars( $this->getHTMLTitle() ) . "\n"; array_push( $this->mMetatags, array( "http:Content-type", "$wgMimeType; charset={$wgOutputEncoding}" ) ); diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index ac020b7365..ff095477f7 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -135,6 +135,7 @@ class SkinTemplate extends Skin { 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; @@ -246,6 +247,8 @@ class SkinTemplate extends Skin { $tpl->set( 'trackbackhtml', null ); } + $tpl->setRef( 'xhtmldefaultnamespace', $wgXhtmlDefaultNamespace ); + $tpl->set( 'xhtmlnamespaces', $wgXhtmlNamespaces ); $tpl->setRef( 'mimetype', $wgMimeType ); $tpl->setRef( 'jsmimetype', $wgJsMimeType ); $tpl->setRef( 'charset', $wgOutputEncoding ); diff --git a/skins/MonoBook.php b/skins/MonoBook.php index 390a0c13e9..b4904183bf 100644 --- a/skins/MonoBook.php +++ b/skins/MonoBook.php @@ -51,7 +51,10 @@ class MonoBookTemplate extends QuickTemplate { wfSuppressWarnings(); ?> - +data['xhtmlnamespaces'] as $tag => $ns) { + ?>xmlns:xml:lang="text('lang') ?>" lang="text('lang') ?>" dir="text('dir') ?>"> html('headlinks') ?>