From 409f26c8f6fa4e96f27030b5d38ffaf6acc83419 Mon Sep 17 00:00:00 2001 From: matthiasgrimm Date: Sun, 12 Jun 2005 17:42:41 +0200 Subject: spellchecker fix for broken aspell The current Aspell version has a bug that causes a corrupt output file. Output lines beginning with '?' weren't terminated with a newline. This patch fixes the broken output format. It is not possible to detect automatically if a Aspell version handles '?'-lines correctly. Therefore DokuWiki checks for Aspells version number and corrects the output format accordingly if version < darcs-hash:20050612154241-7ef76-dfa98470651d6701562ca51908e6f8c8392b28bd.gz --- lib/exe/spellcheck.php | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'lib') diff --git a/lib/exe/spellcheck.php b/lib/exe/spellcheck.php index d8faa0291..d9086f9c6 100644 --- a/lib/exe/spellcheck.php +++ b/lib/exe/spellcheck.php @@ -141,29 +141,9 @@ function spell_check() { return; } - $misspell = true; $len = utf8_strlen($word); - - // try to insert markup - // Aspell sometimes returns too few blank lines, the following loop - // tries to compensate by skipping to next line if Aspell's output - // doesn't match - we're skipping maximal 2 lines before giving up and - // throwing an error - for($x=0; $x<3; $x++){ - $lcnt -= $x; - if(utf8_substr($data[$lcnt],$off,$len) == $word){ - $data[$lcnt] = utf8_substr_replace($data[$lcnt], - spell_formatword($word,$sug), - $off, $len); - break; - }elseif($x == 2){ - print '2'; - print "The spellchecker output doesn't match the input data.\n"; - print "Offending word: '$word' offset: $off, line $i"; - return; - } - } + $data[$lcnt] = utf8_substr_replace($data[$lcnt],spell_formatword($word,$sug),$off, $len); }//end of output parsing -- cgit v1.2.3