https://bugzilla.wikimedia.org/show_bug.cgi?id=40162

       Web browser: ---
             Bug #: 40162
           Summary: [[|page]] style context link may forget to include
                    namespace name
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Parser
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified
   Mobile Platform: ---


Code says:

                # Context links: [[|name]] and [[name (context)|]]
                $tc = '[' . Title::legalChars() . ']';
                $nc = '[ _0-9A-Za-z\x80-\xff-]'; # Namespaces can use
non-ascii!

                # ... omitted ...

                $t = $this->mTitle->getText();
                $m = array();
                if ( preg_match( "/^($nc+:|)$tc+?( \\($tc+\\))$/", $t, $m ) ) {
                        $text = preg_replace( $p2, "[[$m[1]\\1$m[2]|\\1]]",
$text );
                } elseif ( preg_match( "/^($nc+:|)$tc+?(, $tc+|)$/", $t, $m )
&& "$m[1]$m[2]" != '' ) {
                        $text = preg_replace( $p2, "[[$m[1]\\1$m[2]|\\1]]",
$text );
                } else {
                        # if there's no context, don't bother duplicating the
title
                        $text = preg_replace( $p2, '[[\\1]]', $text );
                }

In 'if' and 'elseif' line, regexes begins with ($nc+:|) so I guess the original
author intended to include namespace name automatically, but $t =
$this->mTitle->getText(); should be written as $t =
$this->mTitle->getPrefixedText(); in this case.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to