use vars qw(@RcDays @HtmlPairs @HtmlSingle ... $SubSlashText ... );
add a new variable to the config:
$SubSlashText= 0; # 1 = allow \Sub 0 = only display Sub
and add an extra line to GetPageLinkText:
sub GetPageLinkText { my ($id, $name) = @_;
$id =~ s|^/|$MainPage/|; if ($FreeLinks) { $id = &FreeToNormal($id); $name =~ s/_/ /g; } $name =~ s?^/??g if (!$SubSlashText); return &ScriptLink($id, $name); }
I prefer a different delimiter (s? ??g instead of s/ //g) and have changed your code accordingly. It looks a lot tidier when there is a / inside the expression. It's easy to forget that Perl allows a huge choice of delimiters
--RiVer
$name =~ s|^/|-> |g if (!$SubSlashText);
which would render "BatMan" as "-> BatMan"
sub GetPageLinkText { my ($id, $name) = @_; my $SubSlashText = $SubSlashText;
if ($name eq "|") { $name = $id; $SubSlashText = 1; }
$id =~ s|^/|$MainPage/|;<nowiki> if <nowiki>($FreeLinks) { $id = &FreeToNormal($id); $name =~ s/_/ /g; } $name =~ s?^.*/??g if (!$SubSlashText); return &ScriptLinkClass($id, $name, 'wikipagelink'); }
"[[Page/Subpage]]" is now rendered as "Subpage". And [[Page/Subpage||]] is rendered as "Page/Subpage?".
This made the recent changes hard to read; thus:
sub DoRc { $SubSlashText = 1; # we always want to have the whole path in recents
my (<nowik>i$rcType</nowiki>) = @_; # 0 = RSS, 1 = HTML my ($fileData, $rcline, $i, $daysago, $lastTs, $ts, $idOnly);
...will retain the full Page/Subpage link in the recent changes page.