Gerrit Patch Uploader has uploaded a new change for review.

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

Change subject: CoreParserFunctions: Allow soft hyphens in DISPLAYTITLE
......................................................................

CoreParserFunctions: Allow soft hyphens in DISPLAYTITLE

This change allows to insert soft hyphens (U+00AD) in the displaytitle.
The soft hyphens can inserted as entity ­ or as Unicode character.
This is useful for very long words.

Bug: T66528
Change-Id: I7abd3f819d10310d50f2fa104459b234e9be0b30
---
M includes/parser/CoreParserFunctions.php
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/00/271000/1

diff --git a/includes/parser/CoreParserFunctions.php 
b/includes/parser/CoreParserFunctions.php
index 91b6080..135b1c1 100644
--- a/includes/parser/CoreParserFunctions.php
+++ b/includes/parser/CoreParserFunctions.php
@@ -426,6 +426,9 @@
                        $htmlTagsCallback = null;
                }
 
+               // Convert entity ­ to UTF-8 string
+               $text = str_replace( '­', "\xc2\xad", $text );
+
                // only requested titles that normalize to the actual title are 
allowed through
                // if $wgRestrictDisplayTitle is true (it is by default)
                // mimic the escaping process that occurs in 
OutputPage::setPageTitle
@@ -436,7 +439,11 @@
                        array(),
                        $bad
                ) );
-               $title = Title::newFromText( Sanitizer::stripAllTags( $text ) );
+
+               // Strip soft hyphen from text to allow soft hyphens at any 
place
+               $stripText = str_replace( "\xc2\xad", '', $text );
+               $stripText = Sanitizer::stripAllTags( $stripText );
+               $title = Title::newFromText( $stripText );
 
                if ( !$wgRestrictDisplayTitle ||
                        ( $title instanceof Title

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7abd3f819d10310d50f2fa104459b234e9be0b30
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to