Kji has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370688 )

Change subject: Modified self-links to determine display text identically to 
non-self-links.
......................................................................

Modified self-links to determine display text identically to non-self-links.

Change-Id: I0b02457931e907450360d982d9b117288c23a807
---
M DisplayTitleHooks.php
M extension.json
2 files changed, 14 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DisplayTitle 
refs/changes/88/370688/1

diff --git a/DisplayTitleHooks.php b/DisplayTitleHooks.php
index e3bb63a..e21a39e 100644
--- a/DisplayTitleHooks.php
+++ b/DisplayTitleHooks.php
@@ -104,7 +104,19 @@
         */
        public static function onSelfLinkBegin( Title $nt, &$html, &$trail,
                &$prefix, &$ret ) {
-               self::getDisplayTitle( $nt, $html );
+               //self::getDisplayTitle( $nt, $html );
+               //return true;
+               if ( isset( $html ) && is_string( $html ) ) {
+                       $title = Title::newFromText( $html );
+                       if ( !is_null( $title ) &&
+                               $title->getText() === $nt->getText() &&
+                               ( $title->getSubjectNsText() === 
$nt->getSubjectNsText() ||
+                               $title->getSubjectNsText() === '' ) ) {
+                               self::getDisplayTitle( $nt, $html );
+                       }
+               } else {
+                       self::getDisplayTitle( $nt, $html );
+               }
                return true;
        }
 
diff --git a/extension.json b/extension.json
index a4dd8df..1d85b6e 100644
--- a/extension.json
+++ b/extension.json
@@ -1,6 +1,6 @@
 {
        "name": "DisplayTitle",
-       "version": "1.2",
+       "version": "1.3",
        "author": [
                "[https://www.mediawiki.org/wiki/User:Cindy.cicalese Cindy 
Cicalese]",
                "[https://www.semantic-mediawiki.org/wiki/User:Oetterer Tobias 
Oetterer]"

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0b02457931e907450360d982d9b117288c23a807
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DisplayTitle
Gerrit-Branch: master
Gerrit-Owner: Kji <k...@mitre.org>

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

Reply via email to