[Pkg-mediawiki-commits] r366 - in mediawiki/experimental/debian: . patches

Thorsten Glaser tg at alioth.debian.org
Fri Aug 3 15:23:30 UTC 2012


Author: tg
Date: 2012-08-03 15:23:30 +0000 (Fri, 03 Aug 2012)
New Revision: 366

Modified:
   mediawiki/experimental/debian/changelog
   mediawiki/experimental/debian/patches/fix_invalid_xhtml.patch
Log:
next round of fixes?\226?\128?\166 should be last


Modified: mediawiki/experimental/debian/changelog
===================================================================
--- mediawiki/experimental/debian/changelog	2012-08-03 12:10:57 UTC (rev 365)
+++ mediawiki/experimental/debian/changelog	2012-08-03 15:23:30 UTC (rev 366)
@@ -1,3 +1,11 @@
+mediawiki (1:1.19.1-2~exp3) experimental; urgency=low
+
+  * prevent <table></table> without any <tr /> inside, globally
+  * fix more cases of not checking $wgHtml5
+  * MW’s ID (XML) sanitiser is there for a reason, use it!
+
+ -- Thorsten Glaser <tg at mirbsd.de>  Fri, 03 Aug 2012 17:22:02 +0200
+
 mediawiki (1:1.19.1-2~exp2) experimental; urgency=low
 
   * session_start is another function that needs an explicit ‘@’,

Modified: mediawiki/experimental/debian/patches/fix_invalid_xhtml.patch
===================================================================
--- mediawiki/experimental/debian/patches/fix_invalid_xhtml.patch	2012-08-03 12:10:57 UTC (rev 365)
+++ mediawiki/experimental/debian/patches/fix_invalid_xhtml.patch	2012-08-03 15:23:30 UTC (rev 366)
@@ -1,14 +1,26 @@
 $Id$
 
 Fix invalid XHTML:
+• prevent <table></table> without any <tr /> inside
 • someone forgot to check whether HTML5 was enabled before toying around
+• sanitise XML IDs (a space is *not* allowed, and "Main Page" contains one)
 • let makeLink and all its callers remove HTML5-only attributes from
   hyperlinks if someone else was not careful (rather, several someones)
 • prevent <ul></ul> without any <li /> inside
 
 --- a/includes/HTMLForm.php
 +++ b/includes/HTMLForm.php
-@@ -1206,6 +1206,8 @@ class HTMLTextField extends HTMLFormFiel
+@@ -803,6 +803,9 @@ class HTMLForm extends ContextSource {
+ 			$attribs['id'] = Sanitizer::escapeId( "mw-htmlform-$sectionName" );
+ 		}
+ 
++		if (!$tableHtml)
++			$tableHtml = '<tr><td><!-- empty to prevent invalid XHTML --></td></tr>';
++
+ 		$tableHtml = Html::rawElement( 'table', $attribs,
+ 			Html::rawElement( 'tbody', array(), "\n$tableHtml\n" ) ) . "\n";
+ 
+@@ -1206,6 +1209,8 @@ class HTMLTextField extends HTMLFormFiel
  	}
  
  	function getInputHTML( $value ) {
@@ -17,7 +29,7 @@
  		$attribs = array(
  			'id' => $this->mID,
  			'name' => $this->mName,
-@@ -1229,6 +1231,8 @@ class HTMLTextField extends HTMLFormFiel
+@@ -1229,6 +1234,8 @@ class HTMLTextField extends HTMLFormFiel
  		# well
  		foreach ( array( 'min', 'max', 'pattern', 'title', 'step',
  		'placeholder' ) as $param ) {
@@ -26,6 +38,23 @@
  			if ( isset( $this->mParams[$param] ) ) {
  				$attribs[$param] = $this->mParams[$param];
  			}
+@@ -1625,13 +1632,14 @@ class HTMLMultiSelectField extends HTMLF
+ 				$html .= Html::rawElement( 'h1', array(), $label ) . "\n";
+ 				$html .= $this->formatOptions( $info, $value );
+ 			} else {
+-				$thisAttribs = array( 'id' => "{$this->mID}-$info", 'value' => $info );
++				$info_id = Sanitizer::escapeId($this->mID . '-' . $info);
++				$thisAttribs = array( 'id' => $info_id, 'value' => $info );
+ 
+ 				$checkbox = Xml::check(
+ 					$this->mName . '[]',
+ 					in_array( $info, $value, true ),
+ 					$attribs + $thisAttribs );
+-				$checkbox .= ' ' . Html::rawElement( 'label', array( 'for' => "{$this->mID}-$info" ), $label );
++				$checkbox .= ' ' . Html::rawElement( 'label', array( 'for' => $info_id ), $label );
+ 
+ 				$html .= ' ' . Html::rawElement( 'div', array( 'class' => 'mw-htmlform-flatlist-item' ), $checkbox );
+ 			}
 --- a/includes/SkinTemplate.php
 +++ b/includes/SkinTemplate.php
 @@ -1613,6 +1613,8 @@ abstract class BaseTemplate extends Quic
@@ -96,3 +125,45 @@
  		</div>
  	</div>
  	<div class="portlet" id="p-logo">
+--- a/includes/Linker.php
++++ b/includes/Linker.php
+@@ -1148,7 +1148,7 @@ class Linker {
+ 	 * @return string
+ 	 */
+ 	private static function formatAutocommentsCallback( $match ) {
+-		global $wgLang;
++		global $wgLang, $wgHtml5;
+ 		$title = self::$autocommentTitle;
+ 		$local = self::$autocommentLocal;
+ 
+@@ -1189,7 +1189,9 @@ class Linker {
+ 			$auto .= wfMsgExt( 'colon-separator', array( 'escapenoentities', 'content' ) );
+ 		}
+ 		$auto = '<span class="autocomment">' . $auto . '</span>';
+-		$comment = $pre . $link . $wgLang->getDirMark() . '<span dir="auto">' . $auto . $post . '</span>';
++		$comment = $pre . $link . $wgLang->getDirMark() .
++		    '<span' . ($wgHtml5 ? ' dir="auto"' : '') . '>' . $auto .
++		    $post . '</span>';
+ 		return $comment;
+ 	}
+ 
+@@ -1381,6 +1383,8 @@ class Linker {
+ 	 * @return string
+ 	 */
+ 	public static function commentBlock( $comment, $title = null, $local = false ) {
++		global $wgHtml5;
++
+ 		// '*' used to be the comment inserted by the software way back
+ 		// in antiquity in case none was provided, here for backwards
+ 		// compatability, acc. to brion -ævar
+@@ -1388,7 +1392,9 @@ class Linker {
+ 			return '';
+ 		} else {
+ 			$formatted = self::formatComment( $comment, $title, $local );
+-			return " <span class=\"comment\" dir=\"auto\">($formatted)</span>";
++			return " <span class=\"comment\"" .
++			    ($wgHtml5 ? " dir=\"auto\"" : "") .
++			    ">($formatted)</span>";
+ 		}
+ 	}
+ 




More information about the Pkg-mediawiki-commits mailing list