r59033 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59032‎ | r59033 | r59034 >
Date:21:58, 13 November 2009
Author:daniel
Status:ok
Tags:
Comment:
add a version attribute to the <html> tag if RDFa is used with HTML5
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Setup.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Setup.php
@@ -230,6 +230,13 @@
231231 $wgHiddenPrefs[] = 'skin';
232232 }
233233
 234+if ( !$wgHtml5Version && $wgHtml5 && $wgAllowRdfaAttributes ) {
 235+ # see http://www.w3.org/TR/rdfa-in-html/#document-conformance
 236+ if ( $wgMimeType == 'application/xhtml+xml' ) $wgHtml5Version = 'XHTML+RDFa 1.0';
 237+ else $wgHtml5Version = 'HTML+RDFa 1.0';
 238+}
 239+
 240+
234241 wfProfileOut( $fname.'-misc1' );
235242 wfProfileIn( $fname.'-memcached' );
236243
Index: trunk/phase3/includes/OutputPage.php
@@ -1769,7 +1769,7 @@
17701770 */
17711771 public function headElement( Skin $sk, $includeStyle = true ) {
17721772 global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
1773 - global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
 1773+ global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
17741774 global $wgContLang, $wgUseTrackbacks, $wgStyleVersion, $wgEnableScriptLoader, $wgHtml5;
17751775
17761776 $this->addMeta( "http:Content-Type", "$wgMimeType; charset={$wgOutputEncoding}" );
@@ -1792,7 +1792,9 @@
17931793
17941794 if ( $wgHtml5 ) {
17951795 $ret .= "<!DOCTYPE html>\n";
1796 - $ret .= "<html lang=\"$wgContLanguageCode\" dir=\"$dir\">\n";
 1796+ $ret .= "<html lang=\"$wgContLanguageCode\" dir=\"$dir\" ";
 1797+ if ($wgHtml5Version) $ret .= " version=\"$wgHtml5Version\" ";
 1798+ $ret .= ">\n";
17971799 } else {
17981800 $ret .= "<!DOCTYPE html PUBLIC \"$wgDocType\" \"$wgDTD\">\n";
17991801 $ret .= "<html xmlns=\"{$wgXhtmlDefaultNamespace}\" ";
Index: trunk/phase3/includes/SkinTemplate.php
@@ -129,7 +129,7 @@
130130 global $wgArticle, $wgUser, $wgLang, $wgContLang;
131131 global $wgScript, $wgStylePath, $wgContLanguageCode;
132132 global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
133 - global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
 133+ global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
134134 global $wgDisableCounters, $wgLogo, $wgHideInterlanguageLinks;
135135 global $wgMaxCredits, $wgShowCreditsIfMax;
136136 global $wgPageShowWatchingUsers;
@@ -208,6 +208,7 @@
209209
210210 $tpl->setRef( 'xhtmldefaultnamespace', $wgXhtmlDefaultNamespace );
211211 $tpl->set( 'xhtmlnamespaces', $wgXhtmlNamespaces );
 212+ $tpl->set( 'html5version', $wgHtml5Version );
212213 $tpl->set( 'headlinks', $out->getHeadLinks() );
213214 $tpl->set( 'csslinks', $out->buildCssLinks() );
214215
Index: trunk/phase3/includes/DefaultSettings.php
@@ -915,6 +915,12 @@
916916 $wgHtml5 = true;
917917
918918 /**
 919+ * Defines the value of the version attribute in the &lt;html&gt; tag, if any.
 920+ * Will be initialized later if not set explicitly.
 921+ */
 922+$wgHtml5Version = null;
 923+
 924+/**
919925 * Enabled RDFa attributes for use in wikitext.
920926 */
921927 $wgAllowRdfaAttributes = true;

Status & tagging log