create new tag
, view all tags

SpellerPagesPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on SpellerPagesPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please report bugs below

Feedback on SpellerPagesPlugin

Submitted plugin. As mentioned in the plugin homepage, it's basically a wrapper to spellerpages-0.5.1 from http://spellerpages.sourceforge.net/. Bits of it were pinched from GenPDFAddOn and DateFieldPlugin, so thanks to BrianSpinar, WadeTurland and CrawfordCurrie for writing them.


  • Get the AUTOSPELL preference working, so that spell checking can be forced on Save and Preview.
  • Read preference values from user's topic, overriding default if present -- so that AUTOSPELL only affects users who want it.
  • Deal with skins (such as nat) which do not name the edit form/template as main.text

Advice on implementing the above gratefully received. In particular, is there an API function for retrieving preference values from user's home topic? getPreferencesValue() and friends only look in WebPreferences and TwikiPreferences.

-- MagnusLewisSmith - 12 Oct 2005

It worked for me (I am using the nat skin, maybe that matters), when I change line 501 in lib/TWiki/Plugins/SpellerPagesPlugin.pm

#         var edittextarea = document.main.text;
#         var edittextarea = document.EditFormular.text;

-- WernerFuerst - 12 Oct 2005

Blimey that was quick. Right -- I need to add a bit of documentation I think...

Spellerpages (the sourceforge script, not this plugin) requires taht the source html page with the form+textarea must contain the following:

<!-- Source the JavaScript spellChecker object -->
<script language="javascript" type="text/javascript" src="spellChecker.js">

<!-- Call a function like this to handle the spell check command -->
<script language="javascript" type="text/javascript">
function openSpellChecker() {
   // get the textarea we're going to check 
        // -- here the form is 'myform' and the textarea is 'mytextarea'
   var txt = document.myform.mytextarea;
   // give the spellChecker object a reference to our textarea
   var speller = new spellChecker( txt );
   // kick it off

Web author must provide the openSpellChecker() function and call it from the appropriate place. spellChecker.js creates the spellcheck window and executes a perl script to interface with aspell.

spellerpages has spellChecker.js and the perl script containing hard coded paths to each other, and to the popup html stuff. The webserver administrator must therefore edit these files when installing the package.

SpellerPagesPlugin, however, does not have spellChecker.js as a separate file. Instead the plugin places the body of the script (and the openChecker() function) at the <!-- INCLUDEJSSPELLERPAGES --> point. We use the TWikiFuncModule API to expand bits and pieces and make the paths and popup stuff work on your system.

  • The plugin assumes that the form on the edit page is named main and the textarea is named text. This is true for edit.dragon.tmpl, edit.iejs.tmpl, edit.pattern.tmpl and edit.tmpl. I hadn't tested the nat skin. -- sorry Werner. The openSpellChecker function looks like
function openSpellChecker() {
        var edittextarea = document.main.text; // assume form='main', textarea='text'
        var speller = new spellChecker( edittextarea );

SpellerPagesPlugin also replaces the original's spellchecker.pl script with TWikified functions, again allowing us to expand settings based on the installation environment and retrieving some preferences from (TWiki)|(Web)Preferences. Not all of the API is available to the plugin function sub spellerPages though, since it is not operating on TWiki pages.

-- MagnusLewisSmith - 12 Oct 2005

SpellerPagesPlugin 13 Oct 2005 (V1.001) supports Nat skin (and others) by getting the form.textarea piece of javascript from a preference setting.

Does anyone know what the precedence order of preferences is? It seems to me to be

TWikiPreferences -> ThisWeb.WebPreferences -> ThisWeb.ThisTopic -> Main.UserName -> PluginTopic

So if the users in an organisation use a variety of skins, then it would be necessary to set the preferences in TWikiPreferences and allow individuals to override the FORM_TEXTAREA setting?

-- MagnusLewisSmith - 13 Oct 2005

Wow, there is so muc activity in the Plugins web I missed this new Plugin too. Thank you very much Magnus for sharing this Plugin with the growing TWikiCommunity smile

I made some changes to the Plugin topic, e.g. a short and SHORTDESCRIPTION that is not too technical. Feel free to carry that over to the next release.

How about measuring and documenting the PluginBenchmarks?

Listing path to executables and parameters to executables in the Plugin topic is a security risk. I have not looked int othe code, but it might be possible to inject arbitrary commands on the server by tweaking the settings.

-- PeterThoeny - 02 Nov 2005

TobyThain made a new version and attached it as SpellerPagesPlugin-1.002.zip. I re-attached it as SpellerPagesPlugin.zip.

-- PeterThoeny - 08 Feb 2006

Is there a plan to add custom wordlist functionality to this plugin, so that there would be an "Add" button that called some variant of "aspell --lang=LANG create master ./BASE < WORDLIST" (as cribbed from "info aspell")?

-- DanShick - 09 Feb 2006

Any suggestions on how to add this to the Nat skin's templates? It seems like the code should go into the edittopicactions.nat.tmpl, but my initial attempts to put it there have failed.

-- MarcPerkins - 13 Feb 2006

We just installed this and it works great (custom word lists would be awesome, but it's much better than before).

One of the frequent tasks that I need to do is search for every instance of a string in a topic and replace it with a new one. Most of the time, I simply paste the text into Notepad or Emacs, perform the operation and then copy it back to the edit textarea. I'm wondering whether the same interface could be used to simplify this process?

-- PankajPant - 05 Apr 2006

The instructions on how to install SpellerPagesPlugin seems incomplete.

http://twiki.org/cgi-bin/view/Plugins/SpellerPagesPlugin says to :

  • Include necessary JavaScript in template. Add the following line to the script block so that it reads:

So, what needs to be included here?

In edit.pattern.tmpl (I am using the default pattern skin), I have added the lines below "templatejavascript":

%TMPL:DEF{"templatejavascript"}%<script type="text/javascript" src="%PUBURLPATH%/%TWIKIWEB%/TWikiJavascripts/twiki_edit.js"></script>


yet when I click on the "Spell" button on the edit page nothing happens. Thus, I suspect I haven't done this right.

The httpd error logs showed:

[Mon Apr 10 20:01:47 2006] [error] [client] [Mon Apr 10 20:01:47 2006] viewfile: Can't create file /var/www/html/twiki/data/TWiki/spellerStyle/.xpcache - No such file or directory, referer: http://www.craig-aumann.net/twiki/bin/viewfile/TWiki/SpellerPagesPlugin?rev=;filename=controls.html

[Mon Apr 10 20:01:49 2006] [error] [client] [Mon Apr 10 20:01:49 2006] viewfile: Can't create file /var/www/html/twiki/data/TWiki/controlWindow/.xpcache - No such file or directory, referer: http://www.craig-aumann.net/twiki/bin/viewfile/TWiki/SpellerPagesPlugin?rev=;filename=controls.html

but after I added the directory "controlWindow" and "spellerStyle" directories, the plugin doens't work.

My setup is detailed at: http://twiki.org/cgi-bin/view/Support/SpellerPagesPluginInstallationIssues

-- CraigAumann - 11 Apr 2006

Another clue is that in Firefox, Tools->JavaScript Console notes an error: openSpellChecker is not defined.

It seems that the required javascript is not being included in SpellerPagesPlugin.pm for some reason.

-- CraigAumann - 12 Apr 2006

Craig, move the INCLUDEJSSPELLERPAGES inside the templatejavascript block like:

%TMPL:DEF{"templatejavascript"}%<script type="text/javascript" src="%PUBURLPATH%/%TWIKIWEB%/TWikiJavascripts/twiki_edit.js">

-- AubreyLewman - 05 May 2006

Many thanks Aubrey! This solved the problem. The installation instructions could have been clearer here.

-- CraigAumann - 27 May 2006


What version of aspell is required? I have aspell-0.33.7 and have problems. Once I click on teh Spell button I get a aspell Window and the error concerning unknow option --encoding=utf-8. I take this option out of the settings and the window appears without errors but without any other messages. I have a page full of spelling mistakes, what should I expect to see. If I click on the Close button the Window closes but the apsell processes remain on the host server. These processes use alot of machine resources and if not killed they hang the machine. Perhaps I need a newer version of aspell, but could someone post exactly what one is expected to see when using this plugin

-- PeterJones - 16 Jun 2006

Peter, I had the same problem that you've indicated. To resolved this problem I downloaded and installed aspell 0.60.4 from the following URL: http://www.linuxfromscratch.org/blfs/view/svn/general/aspell.html The installation copied aspell to /usr/local/aspell. I renamed the existing aspell in /usr/bin/aspell as /usr/bin/aspell.bak and created a symbolic link of /usr/local/aspell to /usr/bin/aspell. This ensured that the SpellerPagesPlugin saw the latest version of aspell. SpellerPagesPlugin was working after that. I added a Spell Check in my edit template later. I can share that information with you as well.

-- AlokNarula - 16 Jun 2006

When I click the Spell button nothing happens. In the javascript console in Firefox an error appears stating "openSpellChecker is not defined." I have modified line 8 in edit.pattern.tmpl to show the following:

%TMPL:DEF{"templatejavascript"}%<script type="text/javascript" src="%PUBURLPATH%/%TWIKIWEB%/TWikiJavascripts/twiki_edit.js">
Any ideas? I think the installation instructions assume too much.

-- GordonTerrell - 26 Jun 2006

Community, please accept my appologies for wasting roughly 400 bytes of space on the server. The reason the SpellerPagesPlugin was not working was because I forgot to enable the plugin on the configure page. Duh!!

-- GordonTerrell - 26 Jun 2006

Don't worry, you are not the first one falling into this gotcha. True plug & play would be more user friendly (as it was in Cairo) but apparently with a performance impact.

-- PeterThoeny - 27 Jun 2006

The SpellerPagesPlugin doesn't work on form fields. Any plans to make it work on form fields?

-- AlokNarula - 12 Jul 2006

I can only get this to work with IE, not with firefox Does anyone have it working with firefox?

-- MaryVerge - 29 Aug 2006

I have it working with firefox. Apache AddType was causing firefox to load spellchecker.html as text/plain. IE must ignore that server side directive. Great plugin, thanks Magnus.

-- MaryVerge - 29 Aug 2006

The plugin works with IE, but not with Opera. When using Opera the pop-up window shows the contents of spellchecker.html verbatim.

I enabled debugging in the plugin page, but when using IE and clicking on the "Spell" box I get the following error in the pop-up window above the spell controls:

Can't call method "writeDebug" on an undefined value at /home/httpd/twiki/lib/TWiki/Func.pm line 2033.

-- ChrisPurves - 27 Sep 2006

This plugin apparently does not work anymore in TWiki 4. To the Plugin maintainer: Please consider upgrading this Plugin so that it runs on Cairo and Dakar codebase. HandlingCairoDakarPluginDifferences has more.

-- PeterThoeny - 30 Sep 2006

Pattern skin integration. I created the following gif to match the patternskin buttons: spell.gif

To get to work I edited edit.pattern.template and added the definition near the top:

%TMPL:DEF{"templatejavascript"}%<script type="text/javascript" src="%PUBURLPATH%/%TWIKIWEB%/TWikiJavascripts/twiki_edit.js"></script><!-- INCLUDEJSSPELLERPAGES-->

Then I modified the textareabuttons section (the third line is inserted):

%TMPL:DEF{"textareabuttons"}%<div class="twistyMakeOpaque twikiRight">
<div style="text-align:left;">
<a href="#" class="twistyTrigger"><img alt="Spell Checker" title="Perform Spell Check" align="top" src="%PUBURLPATH%/%TWIKIWEB%/TWikiDocGraphics/spell.gif" height="16" border="0" onclick="return openSpellChecker();" /></a> &nbsp;
<a href="#" class="twistyTrigger"><img width="16" alt="%MAKETEXT{"Use monospace font"}%" title="%MAKETEXT{"Use monospace font"}%" align="top" src="%PUBURLPATH%/%TWIKIWEB%/TWikiDocGraphics/monospace.gif" height="16" border="0" onclick="return setEditBoxFontStyle('mono');" /></a> <a href="#" class="twistyTrigger"><img width="16" alt="%MAKETEXT{"Use proportional spaced font"}%" title="%MAKETEXT{"Use proportional spaced font"}%" align="top" src="%PUBURLPATH%/%TWIKIWEB%/TWikiDocGraphics/proportional.gif" height="16" border="0" onclick="return setEditBoxFontStyle('proportional');" /></a>

The I copied the spell.gif to the TWikiDocGraphics directory. On the edit page, I get something like this:


-- ChrisPurves - 05 Oct 2006

No Ispell or Aspell is installed on host. Therefore, is it possible to install this plugin by using just the Lingua-Ispell-0.07.tar.gz?

-- SteveStark - 18 Oct 2006

As "This plugin apparently does not work anymore in TWiki 4" and no one has touched it in 2 years I plan to obsolete this plugin.

-- MartinCleaver - 10 Oct 2008

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng edit_window.png r1 manage 1.5 K 2006-10-05 - 21:22 ChrisPurves edit window showing spell.gif
GIFgif spell.gif r1 manage 0.9 K 2006-10-05 - 21:19 ChrisPurves spell button
Edit | Attach | Watch | Print version | History: r28 < r27 < r26 < r25 < r24 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r28 - 2008-10-10 - MartinCleaver
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.