Extension:RandomArea

From Linux Web Expert

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
MediaWiki extensions manual
RandomArea
Release status: beta
Implementation Tag
Description Inserting random elements in a page
Author(s) Thomas Stock
Latest version 2.0.0 (2018-03-29)
MediaWiki 1.29+
Database changes No
License Creative Commons Attribution NonCommercial Share Alike 2.5
Download
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Translate the RandomArea extension if it is available at translatewiki.net

The RandomArea extension allows for displaying or including a selected number of random elements from a list on a page.

Note: I was inspired by the RandomText extension to write this, thanks to Martin Rohrbach.

Installation

  • <translate> [[<tvar name=2>Special:ExtensionDistributor/RandomArea</tvar>|Download]] and move the extracted <tvar name=name>RandomArea</tvar> folder to your <tvar name=ext>extensions/</tvar> directory.</translate>
    <translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/RandomArea
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'RandomArea' );
    
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

Usage

Insert the lines you want to be randomized and enclosed in <randomArea>...</randomArea> tags; for example:

<randomArea >
Klaus
Mark
Otto
</randomArea>

Only displays one of the following names: {Klaus, Mark, Otto}

You can use this to include patterns or pages.

<randomArea >
{{Template:Aaa}}
{{:Patterns:Aab}}
</randomArea>

You can alternatively add some attributes to the element to save and view letters.

<randomArea include="1" nsPrefix="MyRandPrefix:" count="2" >
Klaus
Mark
Otto
</randomArea>

This chooses two of the elements and includes them from the given namespace. It is equivalent to:

<randomArea count="2" >
{{:MyRandPrefix:Klaus}}
{{:MyRandPrefix:Mark}}
{{:MyRandPrefix:Otto}}
</randomArea>