JargonExtension

About
This is a Mediawiki extension that inserts JargonFile definitions on wiki pages.

Usage
The simplest way to do so is to insert   in a page, that will use the current page title as lookup term.

Alternatively you can use  something .

Pages using it are also automatically included in Category:Jargon.

ToDo
You can help here by going to a page that already uses it (--> Category:Jargon), clicking the red "Next" or "Prev" links and then simply inserting (and nothing else) into the new page.

[ ] Include all JargonFile terms as wiki pages (All)

Install
To install copy into ./extensions/JargonExtension.php and then include("extensions/JargonExtension.php"); in LocalSettings.php as usual with Mediawiki extensions.

The extension uses the Debian package jargon. apt-get install jargon. (Also see vh).

  'JargonFile extension',        'author' => 'mutante',        'version' => '10/2007',        'url' => 'http://s23.org/wiki/JargonExtension',        'description' => 'displays the JargonFile entry for a term on a wiki page.' );

$wgExtensionFunctions[] = "wfJargonExtension";

function wfJargonExtension { global $wgParser; $wgParser->setHook( "jargon", "getJargon" ); }

function getJargon( $input, $args, &$parser ) { global $wgParser; global $wgTitle;


 * 1) Get the definition of a term from the JargonFile

if ($input=="") { $mytitle=$wgTitle->mTextform; $term=$mytitle; } else { $term = escapeshellarg($input); }
 * 1) if no input term is set get the current page title and use that
 * 1) if there is input use that

$term = escapeshellarg($term);
 * 1) avoid evil stuff from user

$jargon=`jargon 2>/dev/null $term`;
 * 1) execute, we dont want the info messages from errout

$next=explode("Next: ",$jargon); $next=explode(",",$next[1]); $next=$next[0]; $prev=explode("Prev: ",$jargon); $prev=explode(",",$prev[1]); $prev=$prev[0];
 * 1) Get next link
 * 1) Get previous link

$jargon=explode("=",$jargon); $jargon=$jargon[2];
 * 1) remove header line

$jargon=str_replace("{","",$jargon); $jargon=str_replace("}","",$jargon);
 * 1) add wiki links

$jargon=str_replace("'","''",$jargon); $jargon=str_replace("`","''",$jargon);
 * 1) remove ` and stuff

$output=" \n''";
 * 1) build output

$output=trim($output); $parsed_output = $parser->recursiveTagParse( $output ); return $parsed_output;
 * 1) trim,parse and return it

}

?> 