From: Conrad Irwin
Date: Mon, 21 Jun 2010 20:33:07 +0000 (+0000)
Subject: (bug 19910) Preprocess headings of the form "===+\s+" in the same way as Parser:...
X-Git-Tag: 1.31.0-rc.0~36422
X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27votes%27%2C%20votes=%27waiting%27%29%20%7D%7D?a=commitdiff_plain;h=91f6526cfd9620d58d76c9b352c0d4633b2fdd87;p=lhc%2Fweb%2Fwiklou.git
(bug 19910) Preprocess headings of the form "===+\s+" in the same way as Parser::doHeadings()
---
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index b8de16db5c..79db694b22 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -236,6 +236,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
* (bug 24009) Include implicit groups in action=query&list=users&usprop=groups
* (bug 24016) API: Handle parameters specified in simple string syntax
( 'paramname' => 'defaultval' ) correctly when outputting help
+* (bug 19910) Headings of the form ===+\s+ are now displayed as valid headings
=== Languages updated in 1.17 ===
diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php
index 1dc1a173f7..60f975df85 100644
--- a/includes/parser/Preprocessor_DOM.php
+++ b/includes/parser/Preprocessor_DOM.php
@@ -467,7 +467,7 @@ class Preprocessor_DOM implements Preprocessor {
$count = $piece->count;
$equalsLength = strspn( $revText, '=', strlen( $text ) - $searchStart );
if ( $equalsLength > 0 ) {
- if ( $i - $equalsLength == $piece->startPos ) {
+ if ( $searchStart - $equalsLength == $piece->startPos ) {
// This is just a single string of equals signs on its own line
// Replicate the doHeadings behaviour /={count}(.+)={count}/
// First find out how many equals signs there really are (don't stop at 6)
diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php
index f029e9c687..3fd06c125f 100644
--- a/includes/parser/Preprocessor_Hash.php
+++ b/includes/parser/Preprocessor_Hash.php
@@ -428,7 +428,7 @@ class Preprocessor_Hash implements Preprocessor {
$count = $piece->count;
$equalsLength = strspn( $revText, '=', strlen( $text ) - $searchStart );
if ( $equalsLength > 0 ) {
- if ( $i - $equalsLength == $piece->startPos ) {
+ if ( $searchStart - $equalsLength == $piece->startPos ) {
// This is just a single string of equals signs on its own line
// Replicate the doHeadings behaviour /={count}(.+)={count}/
// First find out how many equals signs there really are (don't stop at 6)
diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt
index 89a9587f94..49ceba293c 100644
--- a/maintenance/parserTests.txt
+++ b/maintenance/parserTests.txt
@@ -3902,6 +3902,23 @@ http://example.com [[Image:foobar.jpg]]
!!end
+!! test
+Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
+!! input
+===
+The line above must have a trailing space!
+===
+But just in case it doesn't...
+!! result
+
+The line above must have a trailing space!
+
+
+But just in case it doesn't...
+
+!! end
+
!! test
BUG 1219 URL next to image (broken)
!! input
@@ -5849,6 +5866,22 @@ section=1
==marked==
!!end
+# Test behaviour of bug 19910
+!! test
+Sectiion with all-equals
+!! options
+section=2
+!! input
+===
+The line above must have a trailing space
+===
+But just in case it doesn't...
+!! result
+===
+But just in case it doesn't...
+!! end
!! test
Section replacement test (section 0)