[dev] [imp-patch] HTML support with ispell
Francois Marier
francois at nit.ca
Mon Aug 9 16:41:09 PDT 2004
When dealing with HTML mail, aspell must receive the -H option to work
in HTML mode and so it gets this additional command-line option if
we're in rtemode.
Ispell on the other hand needs the -h (lowercase h) option.
This patch looks at the name of the executable and gives the correct
option depending on the spellchecker.
Francois
-------------- next part --------------
diff -rpuN -X ../ignorelist ../build/imp/spelling.php imp/spelling.php
--- ../build/imp/spelling.php Tue Jun 15 18:20:04 2004
+++ imp/spelling.php Mon Aug 9 19:24:12 2004
@@ -215,7 +215,8 @@ fwrite($fp, $tocheck);
fclose($fp);
/* Run the actual spell check. */
-if (empty($conf['utils']['spellchecker'])) {
+$spellchecker = $conf['utils']['spellchecker'];
+if (empty($spellchecker)) {
$notification->push(_("No spellchecking program configured."), 'horde.error');
} else {
/* Retrieve any spelling options. */
@@ -224,10 +225,15 @@ if (empty($conf['utils']['spellchecker']
$spell_opt = $nls['spelling'][$language];
}
if (Util::getFormData('rtemode')) {
- $spell_opt .= ' -H';
+ // Try to use the Spellchecker's HTML mode
+ if (strpos($spellchecker, 'ispell') !== false) {
+ $spell_opt .= ' -h';
+ } elseif (strpos($spellchecker, 'aspell') !== false) {
+ $spell_opt .= ' -H';
+ }
}
- exec(escapeshellcmd($conf['utils']['spellchecker'] . ' -a ' . $spell_opt) . ' < ' . $spellFile, $warnings);
+ exec(escapeshellcmd($spellchecker . ' -a ' . $spell_opt) . ' < ' . $spellFile, $warnings);
}
$msg = '';
More information about the dev
mailing list