Acronyms

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


Goal

Acronyms will be turned into abbr tags that make the mouse cursor show a hand symbol and create a (title-like) popup with the acronyms full text.

Solution

Attach:acronyms2.php - PHP code, allows to define acronyms in a Wiki page

Discussion

Acronyms and abbrevations are a way to put in both the acronym and the full text for this acronym. Of course you could set up pages for all acronyms and link to there, but do your really want to do this for HTML or CSS? This little extension handles those situations where a full page isn't the right solution but leaving out the full text would irritate people, too.

The extension turns defined acronyms into full <abbr title="....">...</abbr> tags.

Installation

Fetch the Attach:acronyms.php file ( Attach:acronyms2.php if you want to define further acronyms by a Wiki page ) into your pmwiki local/ directory. Then add the line

   include_once("local/acronyms.php");

to your local/local.php file. Additionally you need to make this following change to your pub/css/local.css file:

   abbr {
       cursor: help;
   }

Contributors

  • Georg Bauer
  • Thomas Pahl - extended the idea using a Wiki page

Comments, Bugs

Yes, I used the Smileys.php as a starting base for both the PHP script and this page. Sorry if that shows up somewhere ;-)

I have provided an extended version which allows to define acronyms by a Wiki page. You can define default acronyms (by the script) and easily add further acronyms using a Wiki page. See the script source for a detailed description. Tested with pmwiki-1.0.11 --Tpahl

Note that under version 2.0, this functionality can be found in the MarkupExtensions recipe. pmwiki-2.2.120 -- Last modified by {{Anno}}

from IP: 85.171.160.186 ip should be disabled by default for security reasons