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)


 * -I would also like this kind of feature --193.167.195.60 11:47, 8 November 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:

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)

Can't make it work with 1.10.1
This extension is really usefull, and the last adding to make it more "readable" great, but I can't make it work on the current version of MediaWiki which is 1.10.1, does anyone have a solution ?

Knowing that the extension it is based on (emoticons) works perfectly. Did you mean this error... Warning: preg_replace [function.preg-replace]: Compilation failed: nothing to repeat at offset 5 in ....extensions\Glossary\Glossary.php on line 91

Just made it work with 1.10.1
just made it work with mw version 1.10.1. --Jperl 17:16, 5 August 2007 (UTC)


 * You going to tell everyone how you did that? Will make life a whole lot easier for those who encounter the same issue ;) --Dr DBW 08:04, 21 August 2007 (UTC)


 * Well I simply used the above code. But now the problem I have is that on permanent link pages, not the glossary is read, but the page itself. And so there a preg replace error occurs, because of the mediawiki links Jperl 08:12, 23 August 2007 (UTC)

Bug in MediaWiki or simply wrong use of a function?
the following lines should read the glossary page. and the simply do.

but if an oldid isset, they aren't reading the glossary, but the text of the actual article. and if there a wikilink Link:Text isset, this is producing a preg_replace error (since i exploded with : (see above code)).

is this a normal behaviour of mediawiki? can anyone tell my why this happens?

for all of those having the same problem (glossary works for normal articles but not with permanent links), I have made an ugly bugfix (glossary will unfortunately not work with permanent links).

simply put this line below the above three lines. this will cause the function stop if there a [ is in the glossary (or article whatever is read).

it might be, that also other syntaxes cause problems. so then simply include another strpos or make a preg_match out of it.

but I'd like to come to the root of this problem. so please tell me wheter getting the content of an article was already made wrong.

--Jperl 08:45, 23 August 2007 (UTC)

I changed the explode code to ":-" so that it won't explode errant colons or double slashes and still get the benefit of the ;Word:Definition formatting. I also added right before for obvious reasons (it was crashing my page). However, right now, (I'm on 1.6, php4) it's not adding the tooltip to the page, which it was doing before I used the modified code on this page, hmm --Benjo4u 23:28, 7 September 2007 (UTC)

code should be revised
the code of this extension should be revised.

Johannes Perl wrote: > I've some sort of problem with the glossary extension. > The following lines should read the glossary page and they simply do in a > normal case. > > $title = Title::makeTitle( null, 'Glossary' ); > $emoticonListArticle = new Article( $title ); > $content = $emoticonListArticle->getContent; > > But if an oldid is set (permanent link on article), they aren't reading the > glossary, but the text of the actual article. > Is this a normal behaviour of mediawiki? Can anyone tell my why this > happens?

Because Article::getContent is horrible and should never be used by anybody outside of internal code that does article views. :)

For clean behavior, use the Revision class:

$rev = Revision::newFromTitle( $rev ); if( $rev ) { $content = $rev->getText; } else { // Maybe do a nice error message here? $content = ''; }

- -- brion vibber (brion @ wikimedia.org) --Jperl 16:24, 9 September 2007 (UTC)

Example Sites?
Any sites using this that we can have a look at? Thanks --Dr DBW 05:26, 10 September 2007 (UTC)

working code
hi,

i revised the code, since the I don't think the author will do it.

This is my working code using the one already edited by wvanbusk. So the glossary should be entered in the way


 * HTTP:Hypertext Transfer Protocol
 * FTP:File Transfer Protocol

It also shouldn't destroy links, as it is the case (for me) with the other code. And since I used the Revision class it also works with permanent links.

--Jperl 12:50, 10 September 2007 (UTC)

I've added  at the end to make it work with MW 1.11.0.

--Flavien 09:26, 20 September 2007 (UTC)

Problem with using glossary words for explanation in other glossary entries
I'm using the original extension code with entries seperated by // If I do an explanation for one entry and use another entry-word in this explanation the extension doesn't work, because of recursive use of the -tags. Example: LAN// LocalAreaNetwork WAN// WideAreaNetwork,connection between different LAN s.

This doesn't work. Has anybody a suggestion how to solve this problem? --Luna2504 09:58, 12 September 2007 (UTC)


 * Well in this case you should extend the regulary expression so that it doesn't replace it within already existing tags. --Jperl 12:56, 13 September 2007 (UTC)


 * And how can I do this? I'm a newbie in php :( I actually changed my version of the extension to the last version publicated here. Where do I have to add/change something in the code? Thanks for every helping advice. --Luna2504 10:33, 17 September 2007 (UTC)

Category problem
If i use a term that has been defined in the glossary as a category name, the category is not beeing recognized. Instead the text is shown:

anybody experiencing the same problem?

Problem with links and glossary phrases containing same words
Revised code brokes links when glossary term is part of link. It does not break links when the whole glossary term is used as link: TERM works just fine some text TERM breaks This only breaks when name of the link contains some text before TERM and some text and TERM is separated with space. Links does not break if some text is added after TERM.

I am also having problems with terms containing part of other terms: TERM1 = Some term TERM2 = TERM1 + some text In this case TERM1 works ok, but in TERM2 only the TERM1 part is rendered and rest is treated as normal text

Any ideas?

Thanks --193.167.195.60 11:45, 8 November 2007 (UTC)