×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    About[edit]

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

    Usage[edit]

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

    Alternatively you can use <jargon>something</jargon>.

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

    ToDo[edit]

    If you find a missing page, simply insert <jargon /> (and nothing else) into the new page and save it.

    Source[edit]

    Install[edit]

    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).

    <HighlightSyntax> <?php

    1. JargonFile terms on Mediawiki pages
    2. On inserting <jargon>something</jargon> in a wiki page,
    3. execute "jargon something" on the shell and return the formatted output
    4. mutante/s23 - 10/2007

    $wgExtensionCredits['other'][] = array(

           'name' => '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
    1. if no input term is set get the current page title and use that

    if ($input=="") { $mytitle=$wgTitle->mTextform; $term=$mytitle; } else {

    1. if there is input use that

    $term = $input; }

    1. avoid evil stuff from user and at the same time make terms with whitespace work

    $term = escapeshellarg($term);

    1. execute, we dont want the info messages from errout

    $jargon=`jargon 2>/dev/null $term`;

    1. Get next link

    $next=explode("Next: ",$jargon); $next=explode(",",$next[1]); $next=$next[0];

    1. Get previous link

    $prev=explode("Prev: ",$jargon); $prev=explode(",",$prev[1]); $prev=$prev[0];

    1. remove header line

    $jargon=explode("=",$jargon); $jargon=$jargon[2];

    1. add wiki links

    $jargon=str_replace("{","[[",$jargon); $jargon=str_replace("}","]]",$jargon);

    1. remove ` and stuff

    $jargon=str_replace("'","",$jargon); $jargon=str_replace("`","",$jargon);

    1. build output

    $output="

    "; $output.="
    "; $output.="This is the Jargon File entry for $term - Next: ".$next.", Prev: ".$prev."
    ".$jargon."
    * (text is auto-included via JargonExtension by mutante using jargon with VERSION 4.0.0, 24 JUL 1996 - JargonFile by Eric S. Raymond is in the public domain)

    \n";


    1. trim,parse and return it

    $output=trim($output); $parsed_output = $parser->recursiveTagParse( $output ); return $parsed_output;

    }

    ?> </HighlightSyntax>

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.