Extension talk:Glossary

the code you said to find in the in glossary.php, is not there ,i.e. begins with $title.

see the bit here

// Get the list of emoticons from the "MediaWiki:Glossary" article. $title = Title::makeTitle( null, 'Glossary' ); $emoticonListArticle = new Article( $title ); $emoticonListArticle->getContent;

Tarlachmoorhouse 10:13, 13 June 2007 (UTC)

It Stops links working
The tool tip is great but I'd like to take it a bit further (but don't know enough about how to do it), I want to be able to make the entries automatic links to pages that would contain more information on the TLA.

I tried putting wikilinks around the TLA e.g. do it manually FTP or even List of FTP Clients but it just displays the brackets rather than making it a link.

I know that the system already does a tool tip with wiki links, this would saving having to create a link such as FTP to get the tooltip to display the full name

FTP//File Transfer Protocol


 * 1) this would display as:- FTP (but in blue)
 * 2) it would show a tool tip of:- File Transfer Protocol
 * 3) would be a link to:- File Transfer Protocol (FTP) e.g. File Transfer Protocol (FTP)

I could then create a page on FTP with more details, also possibly putting the page into a category 'Glossary' etc.

Tarlachmoorhouse 08:35, 13 June 2007 (UTC)

Make the Glossary page readable
The following simple adjustments make the glossary a readable page.

lines 63-69 // If the content successfully loaded, do the replacement if( $emoticonListArticle->mContentLoaded ) {                       $emoticonList = explode( "\n;", $emoticonListArticle->mContent ); foreach( $emoticonList as $index => $emoticon ) {                               $currEmoticon = explode( ":", $emoticon, 2 );

then you can do your glossary as a list using the ;Item:explanation wiki markup, so that it looks like this:


 * Item:Explanation
 * Item:Explanation.

also - this needs to be updated to work w/ firefox and to ignore template calls, and work inside headings and items that land in the TOC. I think in order to work w/ Firefox AND to allow for the ability to link mentioned above, It'll have to be modified to create a floating DIV that will pop up on mouseover...It'd take some JavaScript, i think, but probably could be Inline and not require anything in the heading...

Made the Glossary page readable
I made a few changes to get this to work more effectively. I changed the target glossary word color to green so it is more obvious that it is special and I implemented the above suggestion to make the glossary more readable (explode on : and take out leading ;). Working in 1.10.1 and with Firefox. Cheers, Wade.

Here is the revised php extension file: <?php


 * 1) Glossary MediaWiki Extention
 * 2) Created by Benjamin Kahn (xkahn@zoned.net) edited by wvanbusk 20070717.
 * 3) Based on the Emoticon MediaWiki Extension written by Alex Wollangk (alex@wollangk.com)
 * 1) Based on the Emoticon MediaWiki Extension written by Alex Wollangk (alex@wollangk.com)

if ( !defined( 'MEDIAWIKI' ) ) { die( 'This file is a MediaWiki extension, it is not a valid entry point' ); }

global $wgHooks; global $wgExtensionCredits;

$wgExtensionFunctions[] = "wfTooltip";

$wgExtensionCredits['parserhook'][] = array(       'name' => 'Glossary',        'status' => 'stable',        'type' => 'hook',        'author' => 'Benjamin Kahn (xkahn@zoned.net) based on code by Alex Wollangk (alex@wollangk.com)',        'version' => '1.0',        'update' => '6-05-2007',        'description' => 'Enable a Glossary within MediaWiki using tooltips.', );

function wfTooltip { global $wgParser; $wgParser->setHook( "tooltip", "tooltip" ); }

$wgHooks['ParserBeforeStrip'][] = 'fnTooltips';

function tooltip ( $input ) { $input = preg_replace ('/XQX/', '', $input); $split = explode("|", $input, 2); return "". $split[0]. " "; }

// The callback function for replacing acronyms with tooltip tags function fnTooltips( &$parser, &$text, &$strip_state ) { global $action; // Access the global "action" variable // Only do the replacement if the action is not edit or history

if(               $action !== 'edit'                && $action !== 'history'                && $action !== 'delete'                && $action !== 'watch'                && $parser->mTitle->getNamespace != NS_SPECIAL                && $parser->mTitle->mNamespace !== 8        ) {

$acro = array ; $repl = array ;

// Get the list of emoticons from the "MediaWiki:Glossary" article. $title = Title::makeTitle( null, 'Glossary' ); $emoticonListArticle = new Article( $title ); $emoticonListArticle->getContent;

// If the content successfully loaded, do the replacement if( $emoticonListArticle->mContentLoaded ) {                       $emoticonList = explode( "\n", $emoticonListArticle->mContent ); foreach( $emoticonList as $index => $emoticon ) {                               $currEmoticon = explode( ":", $emoticon, 2 ); if( count($currEmoticon) == 2 ) {                                       // start by trimming the search value $currEmoticon[ 0 ] = trim( $currEmoticon[ 0 ] ); // if the string begins with ; lop it off if( substr( $currEmoticon[ 0 ], 0, 1 ) == ';' ) {                                               $currEmoticon[ 0 ] = trim( substr( $currEmoticon[ 0 ], 1 ) ); }                                       // trim the replacement value $currEmoticon[ 1 ] = trim( $currEmoticon[ 1 ] );

array_push ($acro, '/(\b)' . $currEmoticon[ 0 ] . '(\b)/'); array_push ($repl, ' XQX' . $currEmoticon[ 0 ] . "XQX|XQX" . $currEmoticon[ 1 ] . 'XQX '); }                       }

// and finally perform the replacement $text = preg_replace ($acro, $repl, $text); }		$text = preg_replace ($acro, $repl, $text); } }

?>

Does the extension work with MediaWiki version 1.10.1?

I didn't manage to make it work.

--Jperl 09:30, 3 August 2007 (UTC)