TypingErrors

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


Goal

Correct typical typing errors in a Wiki page automatically.

I am pretty bad in synchronizing my left and right hand fingers, so are many others. Thus, a number of words would frequently be typed wrong, and it would be nice if there would be a way to automate corrections.

This is not a spell checker.

Solution

The extension implements an automatic replacement of strings (idea: typical typing errors) when a page is either saved or previewed.

Error corrections can either be defined in an array ($SpellWords), or by a Wiki page (SpellingCorrections), or both.

The array would be defined like:

        $SpellWords['worng']=>'wrong';
        $SpellWords['gloabl']=>'global';
        $SpellWords['Oracel']=>'Oracle';

To achieve the same by the Wiki page, simply add equivalences line by line. Blank lines and lines without a "=" are ignored (and can be used as comments). Example

        worng=wrong
        gloabl=global
        Oracel=Oracle

The values need not be complete words. Note that the script takes care NOT to apply the replacements to THIS page (it would be a short fun).

Discussion

The script intercepts the HandleEdit function, checks for save or preview and modifies the posted text by applying the substitutions defined in the $SpellWords array and read from the spelling correction page. Normal rendering is not touched, the correction page is not even read then.

Installation

Download the file Attach:spellcorrect.php and install it into your local/ directory. Include the script from local/config.php.

The Wiki page containing the replacements defaults to $Defaultgroup.SpellingCorrections. You may configure this by setting $SpellCorrectPagenameQQ either in config.php before including the script or in the script itself. Setting the pagename to blank (not null!) disables reading the page but keeps the feature (the $SpellWords@@ array is still effective).

Detailed instructions are contained in the script.

See Also

History

First version 2004-Sep-??. Tested and heavily used with pmwiki-1.0.11

Comments & Bugs

Since this is straight character string replacement, entries should be selected carefully.

Contributors

Copyright

Just the same as PmWiki, naturally.


pmwiki-2.3.32 -- Last modified by {{tpahl}}

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