Matmarex has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/52451


Change subject: (bug 23393) (bug 45803) Parser: fix whitespace handling within 
headings
......................................................................

(bug 23393) (bug 45803) Parser: fix whitespace handling within headings

* HTML <hN> headings containing line breaks are now handled correctly
  (bug 23393).

* Whitespace within == Headline == syntax and within <hN> headings is
  now non-significant and not preserved in the HTML output (bug
  45803).

Change-Id: I0f2d81dd0b2f7742c5cdb6b7d2cc58a15d3f1029
---
M RELEASE-NOTES-1.21
M includes/parser/Parser.php
2 files changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/51/52451/1

diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21
index 3471dbe..6112d5b 100644
--- a/RELEASE-NOTES-1.21
+++ b/RELEASE-NOTES-1.21
@@ -111,6 +111,10 @@
   gl, hr, hsb, hu, is, it, kk, kl, ku, ky, la, lb, lt, lv, mk, mo, mt, nl, no,
   oc, pl, pt, rm, ro, ru, rup, sco, sk, sl, smn, sq, sr, sv, tk, tl, tr, tt, 
uk,
   uz, vi.
+* (bug 23393) HTML <hN> headings containing line breaks are now handled
+  correctly.
+* (bug 45803) Whitespace within == Headline == syntax and within <hN> headings
+  is now non-significant and not preserved in the HTML output.
 
 === Bug fixes in 1.21 ===
 * (bug 40353) SpecialDoubleRedirect should support interwiki redirects.
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index ed5071e..dddd6d9 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -4046,7 +4046,7 @@
                # Get all headlines for numbering them and adding funky stuff 
like [edit]
                # links - this is for later, but we need the number of 
headlines right now
                $matches = array();
-               $numMatches = preg_match_all( 
'/<H(?P<level>[1-6])(?P<attrib>.*?'.'>)(?P<header>.*?)<\/H[1-6] *>/i', $text, 
$matches );
+               $numMatches = preg_match_all( 
'/<H(?P<level>[1-6])(?P<attrib>.*?'.'>)\s*(?P<header>[\s\S]*?)\s*<\/H[1-6] 
*>/i', $text, $matches );
 
                # if there are fewer than 4 headlines in the article, do not 
show TOC
                # unless it's been explicitly enabled.
@@ -4108,7 +4108,7 @@
                                $serial = $markerMatches[1];
                                list( $titleText, $sectionIndex ) = 
$this->mHeadings[$serial];
                                $isTemplate = ( $titleText != $baseTitleText );
-                               $headline = preg_replace( "/^$markerRegex/", 
"", $headline );
+                               $headline = preg_replace( '/^$markerRegex\s*/', 
"", $headline );
                        }
 
                        if ( $toclevel ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/52451
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f2d81dd0b2f7742c5cdb6b7d2cc58a15d3f1029
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matmarex <matma....@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to