Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

GlossaryPlus

Summary: Glossary Plus
Version: 2008-01-03
Prerequisites: pmWiki-2.2.x and domTT
Status: Alpha! Use at your own risk!
Maintainer: Kaptain Kory

Questions answered by this recipe

How can I create an integrated glossary for my site?

Description

This script creates a cross-linked glossary. Like the DomTT recipe, this one also uses the DomTT Javascript widget for creating tooltips, but terms and definitions are stored on a single page and applied site wide allowing for easier maintenance and greater functionality.

Installation

Step 1

Download the latest version of DomTT. This Javascript widget is used for creating the tooltips necessary for this recipe to work. Save the DomTT library to your web server where it is accessible by PmWiki. The default location within the wiki directory is "pub/domTT".

Step 2

Download glossaryplus.phpΔ and save it to your cookbook folder.

Step 3

Open glossaryplus.php in a text editor and review the default variables. Customize to suit your needs.

Step 4

Add the following line to your config.php file:

include_once("$FarmD/cookbook/glossaryplus.php");

Step 5

Add the following code to your CSS file:

a.glossary-link, a:visited.glossary-link, a:hover.glossary-link {
  cursor: help;
  color: black;
  text-decoration: none;
  border-bottom: 1px dashed #708090;
}
div.glossary-popup {
  border: 1px solid #333333;
  background-color: #333333;
}
div.glossary-popup .caption {
  font-family: serif;
  font-size: 12px;
  font-weight: bold;
  padding: 1px 2px;
  color: #FFFFFF;
}
div.glossary-popup .contents {
  font-size: 12px;
  font-family: sans-serif;
  padding: 3px 2px;
  background-color: #F1F1FF;
}
#wikitext dt {
  font-weight: bold;
  border-top: 1px solid #333333;
}
#wikitext dd {
  margin: 0px;
}

Step 6

Create a wiki page for your glossary. The default is Main.Glossary. Use definition list formatting for your items (:term:defintion).

Step 7

Glossary terms that now appear in other wiki pages will show a tooltip with a definition for that term and clicking the term will link back to the glossary.

Tips and Tricks

  • Include an invisible division block on your glossary page for terms you want to show a tooltip, but don't want to show on the glossary page. This is handy for dealing with plural forms, -ing endings, etc.
  • Use prevent formatting (i.e. [=someterm=]) to avoid creating a tooltip. This is handy for preserving formatting when glossary terms are used in headers, etc.

Bugs / Known Issues

  • If a tag, such as a div, includes the same term as a glossary term (i.e. >>someterm<<), it will render incorrectly.
  • The processing for named anchors is not sophisticated and can produce invalid anchor id's and name's. Care should be taken with special characters used in glossary terms if this is a concern.

Demo

The script is currently active at Snakes of Arkansas.

Release Notes

  • 2008-01-03: Corrected bug causing strange behavior with AuthUser
  • 2006-02-07: Minor bug fixes and enhancements
  • 2006-02-04: Minor bug fix to link back to glossary correctly.
  • 2006-02-03: Initial release.

Comments


I could not get this script to work at all with the monobook skin. It parses the html tags and renders random comments for each. Anybody got it working with monobook?

Farhad(approve links) | Aug 08,2008

It should work with monobook skin - I have it working here: www.secretscotland.org.uk where we have quite a few acronyms on many pages (see the RAF Leuchars page for example). Unfortunately, we have done quite a bit of customising to get it working the way we want, so I can't really help with your problem as our installation is not standard any more.
However, I remember we had problems back as the start (see my note about use in a Farm below), and it was essential to follow all the installation instructions exactly as given above, and then check that any customisations were made correctly. I think it was ok after that. Sorry I can't be more help, but at least I can confirm that it will work with monobook. Des August 09, 2008, at 02:58 PM

For use in a Farm, as per the include given in Step 4, the path to the DomTT javascript libraries must be changed from the local $PubDirUrl variable given in the current recipe, to the Farm $FarmPubDirUrl variable:

SDV($DomTTPubDir, "$PubDirUrl/domTT"); Should be changed to:

SDV($DomTTPubDir, "$FarmPubDirUrl/domTT");

Des June 22, 2007, at 04:02 PM


Bug report - Spurious acronym detection within page html

Probably just an extension of the first Bug/Issue mentioned above. I found an instance where the recipe picked up internal css page styling, and killed it by adding the glossary formatting around it.

The generated page html included this section prior to the activation of GlossaryPlus:

<div id='map'></div>
<div class='vspace'></div><div style="
    border: 1px solid #aaa;
    background-color: #f9f9f9;

After activating GlossaryPlus, it detected the border colour of #aaa; and replaced it with the domTT activation code for :AAA:Anti-Aircraft Artillery, breaking the styling and making it visible on the page as follows:

<div id='map'></div>
<div class='vspace'></div><div style="
    border: 1px solid #<a class='glossary-link' href='http://www.secretscotland.org.uk/index.php/Main/Glossary#aaa'
      onmouseover="domTT_activate(this, event, 'content', '&lt;p&gt;Anti-Aircraft Artillery &lt;/p&gt;', 'trail', true, 'styleClass', 
      'glossary-popup');">aaa</a>;
    background-color: #f9f9f9;

In this particular case, the 'fix' was very simple - just replacing the shortcut colour code of #aaa; with the full #aaaaaa; restored the page style, however the potential for similar random matches with acronym letter combinations still exists (and my knowledge of PHP is way below doing anything about it). Des June 24, 2007, at 06:04 AM

See Also

Also see DomTT and AutomaticLinks.

Contributors

Edit - History - Print - Recent Changes - Search
Page last modified on August 09, 2008, at 02:58 PM