Revision [16650]

This is an old revision of AcronymFormatter made by ZzdE5p on 2007-05-31 10:29:07.

 

Acronym (or Abbreviation) Formatter


This is the development page for the Acronym (or Abbreviation) Formatter.
 

This modification allows Wikka to automatically parse known acronyms and render them as <acronym> elements with titles, for example:

CSS - FAQ - HTML

The list of acronyms can be set by the WikiAdmin in a configuration file: each time an acronym is found in the page source matching one of the entries of this file, it is automatically rendered with the appropriate markup and expanded description.

Features

Current version: 0.3 (improved regex pattern)


To do



The code

Here's the list of files that you will have to create or modify (backup the original files before making any modification)

1. Modify ./formatters/wakka.php

original:
  1. // we're cutting the last <br />
  2. $text = preg_replace("/<br \/>$/","", $text);
  3.  
  4. echo ($text);
  5. wakka2callback('closetags');


modified:
  1. // we're cutting the last <br />
  2. $text = preg_replace("/<br \/>$/","", $text);
  3.  
  4. //render acronyms
  5. $text = $this->RenderAcronyms($text);
  6.  
  7. echo ($text);
  8. wakka2callback('closetags');


2. Modify wikka.php

Add the following function in the engine, for instance immediately before the VARIABLES section:

original:
  1.     // VARIABLES


modified:
%%(php;341)
function RenderAcronyms($text){
if (($this->GetConfigValue('enable_acronyms')
1)
There are 9 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki