Extension:Piwo

MediaWiki extensions manual
OOjs UI icon advanced.svg
Piwo
Release status: experimental
Implementation Parser function
Description Allows executing of Python scripts on pages
Author(s) Kenny2wikitalk
Latest version 0.0.0
MediaWiki 1.25+
License MIT License
Download
NS_GRAM
(NS_GRAM_TALK)
gram-edit
Check usage and version matrix.

The Piwo extension allows executing of Python scripts on MediaWiki (Python In, Wikitext Out).

Warning Warning: Do not use this extension on production wikis! This extension is still in development and no environment control exists yet besides the Gram namespace being protected by default.

InstallationEdit

  • Install Python
  • Download and place the file(s) in a directory called Piwo in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'Piwo' );
    $wgGroupPermissions['bureaucrat']['gram-edit'] = true;
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

UsageEdit

This extension defines a custom namespace, "Gram", that stores Python scripts. Editing the Gram namespace requires the gram-edit right. To invoke a script, use the following parser function:

{{#piwo:name of script, without "Gram:"|parameter1|parameter2|...}}

In the Python script, the parameters can be accessed through mw.argv (no import is needed); an extra function, mw.hsc is provided as an equivalent to PHP's htmlspecialchars.

Any and all of the Python standard library can be imported, as of January 2018.

See AlsoEdit