diff options
author | andi <andi@splitbrain.org> | 2005-06-10 01:01:43 +0200 |
---|---|---|
committer | andi <andi@splitbrain.org> | 2005-06-10 01:01:43 +0200 |
commit | d8681a9e775f904d35aa033a84ef569e1df09ac1 (patch) | |
tree | 633cb70df6dd4a1e92a89f0436719dfffced2750 /lib | |
parent | e1b80655c063a49d8762da43baee81198a5da1ff (diff) | |
download | rpg-d8681a9e775f904d35aa033a84ef569e1df09ac1.tar.gz rpg-d8681a9e775f904d35aa033a84ef569e1df09ac1.tar.bz2 |
Spellchecker fix for large files
darcs-hash:20050609230143-9977f-1b424e3f23bb4939d7636c5ef8f4d9516942f205.gz
Diffstat (limited to 'lib')
-rw-r--r-- | lib/exe/spellcheck.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/exe/spellcheck.php b/lib/exe/spellcheck.php index df4f134f4..ffa0e2886 100644 --- a/lib/exe/spellcheck.php +++ b/lib/exe/spellcheck.php @@ -48,13 +48,14 @@ if(!count($_POST) && $HTTP_RAW_POST_DATA){ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); require_once (DOKU_INC.'inc/init.php'); +session_write_close(); require_once (DOKU_INC.'inc/utf8.php'); require_once (DOKU_INC.'inc/aspell.php'); -header('Content-Type: text/html; charset=utf-8'); +header('Content-Type: text/plain; charset=utf-8'); //create spell object -$spell = new Aspell($conf['lang'],'null','utf-8'); +$spell = new Aspell($conf['lang'],null,'utf-8'); $spell->setMode(PSPELL_FAST); //call the requested function @@ -78,15 +79,15 @@ function spell_check() { // we need the text as array later $data = explode("\n",$string); - //prepare for aspell (add ^ to prevent commands) - $string = '^'.join("\n^",$data); - // keep some words from being checked (use blanks to preserve the offset) FIXME doesn't work yet + // keep some words from being checked (use blanks to preserve the offset) + // FIXME doesn't work yet... however with the used html mode of aspell this isn't really needed /* $string = preg_replace('!<\?(code|del|file)( \+)?>!e','spellclean(\\1)',$string); */ // $string = preg_replace('!()!e','spellclean(\\1)',$string); // run aspell in terse sgml mode - if(!$spell->runAspell("!\n+sgml\n".$string,$out,$err)){ + if(!$spell->runAspell($string,$out,$err,array('!','+html'))){ + //if(!$spell->runAspell($string,$out,$err)){ print '2'; //to indicate an error print "An error occured while trying to run the spellchecker:\n"; print $err; @@ -98,6 +99,7 @@ function spell_check() { $rcnt = count($lines)-1; // aspell result count $lcnt = count($data)+1; // original line counter + for($i=$rcnt; $i>=0; $i--){ $line = trim($lines[$i]); if($line[0] == '@') continue; // comment |