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

Change subject: [WIP] Linker: Render selflinks as classed <a>s, not <strong>s
......................................................................

[WIP] Linker: Render selflinks as classed <a>s, not <strong>s

Self-links are still semantically links, and representing them as <strong>s
is inelegant and more important a real pain to work with, especially in
contexts where they may change state (like inside an editor).

Instead, render them as <a> but with a class to style them as before,
named 'mw-selflink' to go with 'mw-redirect'. This allows much easier
adjustment later.

Bug: T160480
Change-Id: If058843924c3b30c116df2520aef93a004d98a5d
---
M includes/Linker.php
M resources/src/mediawiki.legacy/shared.css
2 files changed, 16 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/04/343204/1

diff --git a/includes/Linker.php b/includes/Linker.php
index 0c8d1c6..82735cc 100644
--- a/includes/Linker.php
+++ b/includes/Linker.php
@@ -164,10 +164,10 @@
        }
 
        /**
-        * Make appropriate markup for a link to the current article. This is
-        * currently rendered as the bold link text. The calling sequence is the
-        * same as the other make*LinkObj static functions, despite $query not
-        * being used.
+        * Make appropriate markup for a link to the current article. This is 
since
+        * MediaWiki 1.29.0 rendered as an a tag with a class showing the link 
text.
+        * The calling sequence is the same as the other make*LinkObj static
+        * functions, but $query is not used.
         *
         * @since 1.16.3
         * @param Title $nt
@@ -179,7 +179,7 @@
         * @return string
         */
        public static function makeSelfLinkObj( $nt, $html = '', $query = '', 
$trail = '', $prefix = '' ) {
-               $ret = "<strong 
class=\"selflink\">{$prefix}{$html}</strong>{$trail}";
+               $ret = "<a class=\"mw-selflink\">{$prefix}{$html}</a>{$trail}";
                if ( !Hooks::run( 'SelfLinkBegin', [ $nt, &$html, &$trail, 
&$prefix, &$ret ] ) ) {
                        return $ret;
                }
@@ -188,7 +188,7 @@
                        $html = htmlspecialchars( $nt->getPrefixedText() );
                }
                list( $inside, $trail ) = self::splitTrail( $trail );
-               return "<strong 
class=\"selflink\">{$prefix}{$html}{$inside}</strong>{$trail}";
+               return "<a 
class=\"mw-selflink\">{$prefix}{$html}{$inside}</a>{$trail}";
        }
 
        /**
diff --git a/resources/src/mediawiki.legacy/shared.css 
b/resources/src/mediawiki.legacy/shared.css
index ff0c0e3..239746c 100644
--- a/resources/src/mediawiki.legacy/shared.css
+++ b/resources/src/mediawiki.legacy/shared.css
@@ -322,6 +322,16 @@
        color: #ba0000;
 }
 
+/* self links */
+a.mw-selflink {
+       color: inherit;
+       font-weight: bold;
+}
+a.mw-selflink:hover {
+       cursor: inherit;
+       text-decoration: inherit;
+}
+
 /* Plainlinks - this can be used to switch
  * off special external link styling */
 .plainlinks a.external {

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

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

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

Reply via email to