* (bug 3837) Leave <center> as is instead of doing an unsafe text replacement
to <div class="center">. <center> is perfectly valid in the target doctype (XHTML 1.0 Transitional), while the replacement didn't catch all cases and could even result in invalid output from valid input.
This commit is contained in:
parent
ec377a67c4
commit
02ff859a87
3 changed files with 7 additions and 4 deletions
|
|
@ -446,6 +446,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
|
|||
* (bug 3202) Attributes now allowed on <pre> tags
|
||||
* Sanitizer::validateTagAttributes now available to discard illegal/unsafe
|
||||
attribute values from an array.
|
||||
* (bug 3837) Leave <center> as is instead of doing an unsafe text replacement
|
||||
to <div class="center">. <center> is perfectly valid in the target doctype
|
||||
(XHTML 1.0 Transitional), while the replacement didn't catch all cases and
|
||||
could even result in invalid output from valid input.
|
||||
|
||||
|
||||
== Compatibility ==
|
||||
|
|
|
|||
|
|
@ -248,7 +248,6 @@ class Parser
|
|||
'/(.) (?=\\?|:|;|!|\\302\\273)/' => '\\1 \\2',
|
||||
# french spaces, Guillemet-right
|
||||
'/(\\302\\253) /' => '\\1 ',
|
||||
'/<center *>(.*)<\\/center *>/i' => '<div class="center">\\1</div>',
|
||||
);
|
||||
$text = preg_replace( array_keys($fixtags), array_values($fixtags), $text );
|
||||
|
||||
|
|
@ -1891,10 +1890,10 @@ class Parser
|
|||
wfProfileIn( "$fname-paragraph" );
|
||||
# No prefix (not in list)--go to paragraph mode
|
||||
// XXX: use a stack for nestable elements like span, table and div
|
||||
$openmatch = preg_match('/(<table|<blockquote|<h1|<h2|<h3|<h4|<h5|<h6|<pre|<tr|<p|<ul|<ol|<li|<\\/tr|<\\/td|<\\/th)/iS', $t );
|
||||
$openmatch = preg_match('/(<table|<blockquote|<h1|<h2|<h3|<h4|<h5|<h6|<pre|<tr|<p|<ul|<ol|<li|<center|<\\/tr|<\\/td|<\\/th)/iS', $t );
|
||||
$closematch = preg_match(
|
||||
'/(<\\/table|<\\/blockquote|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|'.
|
||||
'<td|<th|<div|<\\/div|<hr|<\\/pre|<\\/p|'.$this->mUniqPrefix.'-pre|<\\/li|<\\/ul|<\\/ol)/iS', $t );
|
||||
'<td|<th|<div|<\\/div|<hr|<\\/pre|<\\/p|'.$this->mUniqPrefix.'-pre|<\\/li|<\\/ul|<\\/ol|<\\/center)/iS', $t );
|
||||
if ( $openmatch or $closematch ) {
|
||||
$paragraphStack = false;
|
||||
# TODO bug 5718: paragraph closed
|
||||
|
|
|
|||
|
|
@ -3957,7 +3957,7 @@ Self closed html pairs (bug 5487)
|
|||
<center><font id="bug" />Centered text</center>
|
||||
<div><font id="bug2" />In div text</div>
|
||||
!! result
|
||||
<div class="center"><font id="bug" />Centered text</div>
|
||||
<center><font id="bug" />Centered text</center>
|
||||
<div><font id="bug2" />In div text</div>
|
||||
|
||||
!! end
|
||||
|
|
|
|||
Loading…
Reference in a new issue