0

Is there any way (like an undocumented magic word perhaps) to get the current query string (or full URL including query string) from within a Mediawiki template or Scribunto (Lua) module?

Brett Zamir
  • 14,034
  • 6
  • 54
  • 77
  • Typically all what determines generated content is page title. I can't imagine any use case for checking query string. Could you describe from user's point of view what would you like to achieve? Possibly you took wrong approach. – skalee Dec 23 '13 at 01:42
  • I want to allow users to submit forms via GET method (for which I think I need to build an extension as the current form extensions did not appear to fit the bill) so that they can specify a subset range of paragraphs to display (using the Labeled Section Transclusion section) and then share/bookmark the result. I like the idea of keeping resolution logic accessible from templates. – Brett Zamir Dec 23 '13 at 01:47
  • The Semantic Forms extension appears to support a similar approach, but only for POST requests, and it seems a bit heftier than what I need. – Brett Zamir Dec 23 '13 at 01:53

1 Answers1

1

If this is an option, consider obtaining HTML content with API. This should be simpler than writing an extension. Of course this won't be a regular page, rather something composed client-side on blank article or server-side on non-wiki site. With Labeled Section Transclusion extension you mentioned this should work.

Alternatively, consider some server-side post processing on generated HTML. It should perform quite well as MediaWiki caches a lot.

AFAIK there is no magic word for checking query string and, IMO, this would be a very bad thing. Article source is like a model in MVC pattern — you shouldn't put presentation stuff there.

skalee
  • 12,331
  • 6
  • 55
  • 57
  • I still think it would be quite convenient to have a way that people could simply add iframes to grab portions of a wiki text without additional server-side code (e.g., for excerpting literature from Wikisource). Also, I think you mean "shouldn't put controller stuff there", no? I really think the already dynamic nature of templates ought to be usable from outside the site via REST. – Brett Zamir Dec 26 '13 at 14:08
  • It's a pity the `action=render` (from http://www.mediawiki.org/wiki/Manual:Parameters_to_index.php#Actions ) doesn't work with a "text" argument instead of "title" (as in the API)--it shouldn't be any XSS risk as it would still be parsed. – Brett Zamir Dec 26 '13 at 14:08
  • I've submitted https://bugzilla.wikimedia.org/show_bug.cgi?id=58971 toward this end. – Brett Zamir Dec 26 '13 at 15:22