JargonExtension

Insert JargonFile definitions on wiki pages.

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.

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 but 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

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

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

}

?> 