Page MenuHomePhabricator

Add a action=render "text" parameter
Closed, DeclinedPublic

Description

Hi,

I would really like to see a way for external sites to include a subset of content from wiki pages (such as a Wikisource book) without the need for API scripting (e.g., via iframe inclusion) and without the need to first create a page on the wiki to make the exact request (everything would be sent through the URL).

action=render does a fine job (esp. if bug 19415 can be fixed), but it doesn't support grabbing individual sections, including those of the Labeled Section Transclusion extension variety.

Despite what is said for Bug 9711, there are plenty of cases where one does not wish to break up a file into segments when one does not wish the hassle of doing so and wishes to allow users within the site or external to it to have full control of the amount they wish to see at once, whether small or large in size.

My particular use case is allowing people to include paragraph ranges of Baha'i Scriptures from a site I work with (which will be using Flagged Revisions to ensure the content is more reliable on a moment-to-moment basis) without the external sites needing to first create a page which to do the desired (possibly one-off) section transclusion.

My initial thought for an approach was to allow templates to have access to a Magic Word which could grab the query string (so that templates could parse this, say with Scribunto/Lua, into parameter values which could be used in place of {{{1}}} or {{{named|}}} template arguments), but then I realized an even more powerful and general purpose utility (which worked for including templates or external sites) would be to let action=render be made to work with a "text" parameter in a similar to the action=parse "text" parameter.

One could simply build one's own template in the URL, supplying the desired parameters to a template or just directly execute a parser function like the Labeled Section Transclusion extension's calling for section inclusion.

I think it would be wonderful to expose the dynamic power of wikitext as seen in templates and parser functions to external sites, especially since XSS risks or such ought not be an issue here given that any arbitrary text is still getting parsed as though it were any other saved page.


Version: 1.23.0
Severity: enhancement

Details

Reference
bz58971

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 2:27 AM
bzimport set Reference to bz58971.
bzimport added a subscriber: Unknown Object (MLST).

Oh, and though I know this would probably need a separate bug, I think it ought to make it feasible for http://www.mediawiki.org/wiki/Extension:InputBox to be correspondingly updated to include a new useful type which could provide one input box for a page title (or specification of a hard-coded one), two input boxes for specifying a range of sections, and an input box to specify an anchor within the section range. (The form action could I suppose then simply be dynamically updated in JavaScript to lead to ?action=render&text={{#lsth:pageName|rangeBegin|rangeEnd}}#pageAnchor or into some parameters which would be interpreted equivalently.)

Not an API bug. "action=render" is referring to the index.php parameter.[1]

The sort of thing being requested here is already easily possible with the API's action=parse, but the request here is specifically not wanting to use the API.

[1]: https://www.mediawiki.org/wiki/Manual:Parameters_to_index.php

I might just mention that maybe the bug should be expanded to mention adding the "text" parameter for "view" and "raw" actions as well given the prior interest by others.

brion claimed this task.
brion subscribed.

I'm going to close this out; you can already do arbitrary wikitext->HTML rendering via the API.