Rob A's (Im)personal Blog.
Rob A's (Im)personal Blog :: Glossary Plugin
Version 1.3 of the Glossary Plugin is now ready! v1.3: Added support for appending a superscripted [?] versus highlighting, added support for markup of only the first instance of the term, removed the "no decoration" flag from the default css, made consistent with new probe for language include
Thanks to the Highlight Search Queries plugin[?] by Tom Sommer, for some happy pattern matching for this glossary plugin.
It does regexp[?] pattern matching for each of the glossary words in the (optionally) entry bodies, extended bodies, and HTML areas on every page. I would recommend only using it in the extended body, so the glossary plugin won't have to do work on the summary blog views (assuming that your blog is setup that way...) but performance will depend on your server, as always.
Additionally there are radio buttons to select which blog sections the markup should apply to, the Entry body, the Extended body, and HTML area elements.
The plugin uses a class, serendipity_glossaryMarkup to determine how the text and pointer icon will be rendered. A default class is created if one doesn't exist (thanks again, Tom), that is a brownish-red, with a help cursor pointer. There is now an option to either highlight the term or just append it with a superscripted "[?]".
The plugin parses through the entry text and replaces either each occurrence or the first occurrence of each term with a span having a title set to the glossary definition. There is some effort to avoid changing html[?] code (for example, one of the terms I defined in my testing is "span", which it ignores if in an html node <>. Also, the search terms must be alphanumeric[?], with no spaces or symbols. If you don't like that, "use the source, Luke"
I am running this plugin now that the cache is implemented, and even on my antique p400 it still seems fairly responsive. In the meantime, the screen grab on the right should give you an appreciation of the function.
A zip of the plugin (version 1.3) can be found in the download section here: serendipity_event_glossary.zip
One additional enhancement I am working on is a configuration parameter that will only match and highlight the first occurrence of the keyword in each section.