Extension:Semantic Glossary

Description
Semantic Glossary is an extension for MediaWiki that lets you define terms and abbreviations together with a definition. Whenever a term or abbreviation is hovered over in an article its definition is displayed. The extension uses the markup algorithm from the Lingo extension, but instead of in a dedicated page it stores the data as property-values pairs in a Semantic MediaWiki store.

The advantage of that approach is that the glossary can be queried like any other semantic data. And if for editing the glossary you do not want to use the inbuilt Special Page, you can also set up your own system, e.g. using Semantic Forms.

Special:Glossary
This extension provides a Special:Glossary page to edit the glossary. It displays a table of three columns to define Terms, their definition an a link. The terms must be single worlds without punctuation characters. The definitions may be any plain text. Be aware that it will not be interpreted, i.e. do not use wikitext or html. The links must be internal links or interwiki links, i.e. you can put here anything that can also be used in the double brackets of wiki links. External links are not allowed to prevent security issues.

User right editglossary
A new user right (permission) editglossary is introduced to protect the Special:Glossary page. Defaults to user group user, i.e. everybody with a registered account. This does not prevent anybody from assigning the glossary properties directly!

Properties
The properties Glossary-Term, Glossary-Definition, Glossary-Link are used to hold the data of the glossary entries. It is entirely possible to use these to define new glossary entries without using the Special:Glossary page. This way you can easily build your own user interface to the glossary, e.g. using Semantic Forms. Some rules apply: First, there must only ever be one definition per wiki page. If you absolutely need to put more than one definition on one page use Semantic Internal Objects. Second, you can edit these entries using the Special:Glossary page. However, as soon as the original page is saved again, the definition there takes precedence again.

Internationalization
The extension is pretty well internationalized by now, thanks to the efforts of the volunteers on translatewiki.net. (If your language is not supported yet, get an account there and help yourself. It's easy!) To find out, what the names of the properties are for your language, go have a look at the SemanticGlossary.i18n.php file and find the messages semanticglossary-prop-glt (Glossary-Term), semanticglossary-prop-gld (Glossary-Definition) and semanticglossary-prop-gll (Glossary-Link). Or just use the default English property names, they should always work.

Download instructions
The extension is still in an experimental state, so there are no packaged releases yet. However, you can download the current development version via the MediaWiki Extension Distributor. Alternatively you can download it directly using Subversion:

svn export http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SemanticGlossary

Installation
Semantic Glossary depends on the following extensions:
 * Semantic MediaWiki 1.6 or higher
 * Lingo 0.2 or higher

To install the extension create a directory named  in the   directory of your MediaWiki installation and copy the extension's files into it. Then add the following line to your LocalSettings.php below the inclusion of the Semantic MediaWiki and the Lingo extension:

require_once('extensions/SemanticGlossary/SemanticGlossary.php');

The extension is tested with MediaWiki 1.16.5 and Semantic MediaWiki 1.6 on PHP 5.3.5. Other versions of MediaWiki and PHP will probably work, but are not yet tested.

Configuration parameters
The  right is by default given to the   usergroup. To change this e.g. to limit the editing of the glossary to Sysops you could insert the following code after the inclusion of Semantic Glossary in your LocalSettings.php:

unset ($wgGroupPermissions['user']['editglossary']); $wgGroupPermissions['sysop']['editglossary'] = true;

The variable  contains the characters considered as punctuation. These characters may not be part of a term or abbreviation. This variable defaults to. You may change it by inserting something like this, again after the inclusion of Semantic Glossary in your LocalSettings.php:

$sggSettings->punctuationCharacters = '\.,;:?!"';

Known Issues

 * not compatible with MW 1.17
 * CSS of the Glossary Browser is only tested in Firefox and looks somewhere between awkward and awful in other browsers

Not yet implemented
The extension should be able to
 * store a context (page, category, namespace, concept) for every term and only markup the term on wiki pages belonging to the context;
 * import/export CSV;
 * invalidate affected pages when a term is changed;
 * regulate the Glossary browser's chattiness with a config setting;
 * nicer, JS powered popups
 * provide a tag/parser function/magic word to switch off use of the glossary on a page
 * enable editing of the glossary directly from an article page (mark a term, press a button or link, a small form pops up)

Credits
The markup algorithm from Barry Coughlan's Lingo extension was used as a basis for this extension's algorithm.

Contact
Comments, questions and suggestions should be sent or posted to:
 * the Semantic Mediawiki User mailing list (preferred)
 * the Semantic Glossary discussion page
 * the author