Le 01/09/2024 à 06:36, Mark A. Hershberger via Wikitech-l a écrit :
Hey MediaWiki devs!
TL;DR: When including a SpecialPage (e.g. Special:PrefixIndex), how can
the code access the Title of the page currently being rendered?
I'm sure I'm missing sometthing as I track down this issue, so maybe
this plea for help will result in my enlightenment.
For T373259[1], I thought it would be straight-forward to get the page
that is the the parser is currently including the results of a special
page into. Once I had that, I thought, it would be simple to address
the issue since that page could be compared to the links that are
included from PrefixIndex, but it looks like the context contains the
SpecialPage that is being included and not the page that its output is
being included into.
<snip>
When transcluding a special page, you can think about it as using an
iframe. The transclusion is merely including what the special page would
have output, with some tweak such as removing the submittable form.
So as much as Special:PrefixIndex does not have a TITLE context, it does
not have one either when it is being transcluded.
I think the primary use case for Special:PrefixIndex is to list subpages
and I don't think there is much point in listing the root page in the
listing when you are already on the root page. So that if you are on a
page *Book* and have subpages *Book/Chapter_1 *and *Main_Page/Chapter_2*
you would use:
{{Special:PrefixIndex/Book/|stripprefixindex=1}}
Which would exclude *Book* (since it does not match *Book/* ) and remove
the common prefix of *Book/* which yields:
Chapter_1 Chapter_2
That is most probably going to be used in an infobox template. That in
turns would probably be decorated with a link to *Book* which would not
be linked when showing up on the Book page thanks to the magic of the
MediaWiki parser.
See also https://gerrit.wikimedia.org/r/c/mediawiki/core/+/71911
So as much as I agree with the perceived consistency, I don't think that
one has to be resolved since it is unlikely to be of any use.
Antoine "hashar" Musso
_______________________________________________
Wikitech-l mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/