Page MenuHomePhabricator

Allow includable special pages to be parameterized using wiki syntax.
Closed, ResolvedPublic

Description

Allow includable special pages to be parameterized using wiki syntax resembling named temlate parameters like this:
{{Special:Allpages|namespace=2|from=Alfonso Louise|to=Mattias Pasta}}

Parameter names should be identical to those already used on the command line.

All that the wiki syntax parser needs to do is, process the parameter string into a parameter block format that is identical to that which the special page expects anyways, and call the special page giving indication that a parameter block is acutally present.

Note, that this is already working: {{Special:PrefixIndex/User:Alfonso_Louis}} - so we can pass one parameter at times, when a special page allows this type of call, but not more than this.


Version: 1.14.x
Severity: enhancement

Details

Reference
bz15558

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:18 PM
bzimport set Reference to bz15558.

Note: many special pages do their own parsing of the input and some of them allow multiple parameters. Would be nice to standardize the syntax. Not sure how to do it in bc way though.

  • Bug 23150 has been marked as a duplicate of this bug. ***

happy.melon.wiki wrote:

The issue is that most special pages take most of their parameters from the URL GET request using $wgRequest->getVal(). One parameter is extracted from the subpage of the page title, so that's easy to achieve in transclusion, but the problem with the other parameters is that you have not only to pass them through, but also to make the execute() method actually *use* them.

(Edit conflict :))
I'm assigning this bug to myself. Fixing it consists of two parts:

  1. Making the parser pass on an array of already-parsed arguments
  2. Make every single includable special page accept and use those parameters (beside $wgRequest)

Okay, problem 1. is solved (just want to make sure no one else wastes hours on that :))

Parser passes on an associative array which contains the parameters.

Okay, fixed it. Thanks to Happy-melon, he figured out how to turn the DOM tree into an associative array. The rest is also fairly simple and short, even though it's not the nicest thing to fake $wgRequest (but then again, the code is only as bad as the surrounding code).
I'll commit it after some more tests and in case no one complains here.

attachment patch ignored as obsolete

Small fix

removed some debugging code.

Comment from some devs at !wmcon: Nasty way of doing this, but there doesn't seem to be an easy & nice sollution.

Attached:

reachouttothetruth wrote:

*** Bug 2447 has been marked as a duplicate of this bug. ***