vrana           Fri Dec 19 12:59:49 2003 EDT

  Added files:                 
    /phpdoc/scripts     aspell.php en.pws 
  Log:
  Finding typos in manual with aspell
  

Index: phpdoc/scripts/aspell.php
+++ phpdoc/scripts/aspell.php
#!/usr/bin/php
<?php
/*
There are no restrictions on this file.
Author: Jakub Vrána <[EMAIL PROTECTED]>
See en.pws for list of ignored words.
*/

if ($_SERVER["argc"] != 3 || ($_SERVER["argv"][1] != "escape" && $_SERVER["argv"][1] 
!= "unescape")) {
        exit("Purpose: Escape or unescape all *.xml files for use in aspell.\n"
                . "Usage: aspell.php escape|unescape <directory>\n"
        );
}

// TODO: &xxx.xx; -> &xxx-xx;
$GOOD_TAGS = 
"type|parameter|function|refname|literal|methodname|abbrev|acronym|constant|varname|replaceable|filename|userinput|command|structname|structfield";
$MODE = $_SERVER["argv"][1];

// htmlentities in comments and CDATA
function callback_htmlentities($matches) {
        return $matches[1] . ($GLOBALS["MODE"] == "escape" ? htmlentities($matches[2]) 
: html_entity_decode($matches[2])) . $matches[3];
}

// make attributes from contents of always-good tags
function callback_make_value($matches) {
        return '<' . $matches[1] . $matches[2] . ' aspell="' . 
htmlentities($matches[3]) . '"/>';
}

// make contents from attributes of always-good tags
function callback_make_contents($matches) {
        return '<' . $matches[1] . $matches[2] . '>' . html_entity_decode($matches[3]) 
. '</' . $matches[1] . '>';
}

function recurse($dir) {
        echo "$dir\n";
        foreach (glob("$dir/*") as $filename) {
                if (is_dir($filename)) {
                        recurse($filename);
                } elseif (eregi('\\.xml$', $filename)) {
                        //~ echo "$filename\n";
                        $file = file_get_contents($filename);
                        $file = 
preg_replace_callback('~(<!\\[CDATA\\[)(.*)(\\]\\]>)~sU', "callback_htmlentities", 
$file);
                        $file = preg_replace_callback('~(<!--)(.*)(-->)~sU', 
"callback_htmlentities", $file); // isn't in one function as is can match 
!CDATA[[...-->
                        if ($GLOBALS["MODE"] == "escape") {
                                $file = preg_replace_callback('~<(' . 
$GLOBALS['GOOD_TAGS'] . ')( [^>]*)?>(.*)</\\1>~sU', "callback_make_value", $file);
                        } else { // "unescape"
                                $file = str_replace("\r", "", $file); // for Windows 
version of Aspell
                                $file = preg_replace_callback('~<(' . 
$GLOBALS['GOOD_TAGS'] . ')( [^>]*)? aspell="(.*)"/>~sU', "callback_make_contents", 
$file);
                        }
                        $fp = fopen($filename, "wb");
                        fwrite($fp, $file);
                        fclose($fp);
                }
        }
}

recurse($_SERVER["argv"][2]);
?>

Index: phpdoc/scripts/en.pws
+++ phpdoc/scripts/en.pws
personal_ws-1.1 en 242
ISAPI
plugin
UDM
HTTPS
https
dBase
httpd
UDP
pspell
Borland
Google
mcrypt
zlib
RPC
SQL
Bcc
conf
CMYK
RPN
EZMLM
bzip
iPlanet
GMP
cygwin
ClibPDF
bezier
xml
PostgreSQL
Solaris
XPath
builtin
versioning
GPG
JPEG
jpeg
jpg
ODBC
odbc
iODBC
GPL
mnoGoSearch
mnogosearch
README
prerelease
Zend
FAM
SPX
stdin
TCL
servlet
php
CRC
crc
gdb
stderr
cron
stdout
WDDX
SNMP
Sablotron
towards
gzip
JSP
MCVE
mcve
GTK
Gtk
TLS
CSR
mhash
XSL
SESAM
iconv
msession
gif
MCAL
mcal
SDK
PCNTL
pcntl
EGPCS
Xitami
Informix
LF
gcc
CGI
cgi
DNS
CLI
CCL
MacOS
FI
hw
gz
JS
CSS
gd
GID
MX
Ovrimos
ovrimos
png
NUL
NUM
MSIE
DSSSL
ZZIPlib
dir
LDAP
ldap
Inprise
EOF
NIS
SHA
PEM
openssl
awk
UX
IRC
func
url
EOL
ini
DTD
ip
API
OOP
api
PWS
NULLs
pid
SWF
Mozilla
fbsql
IIS
ascii
OCI
IDE
oid
UID
Verisign
CRLF
binutils
VBScript
unserialized
TTF
fopen
SSL
ssl
RSA
SAPI
XP
DLL
dll
PHP's
xmlrpc
ibase
FDF
fdf
unescaped
undefine
GmbH
NTFS
VC
mbstring
NSAPI
online
inline
unix
XHTML
NNTP
PECL
onload
hmac
PGP
pcre
YAZ
yaz
ActiveX
IRCG
unziped
Postgres
icap
validator
shmop
exe
ncurses
UCD
expat
IMAP
JScript
internet
IPv
PREG
SQLite
sqlite
concatenator
endian
Sybase
sybase
untar
inode
PDF
pdf
html
IPX
IPC
PKCS
symlink
RGB
rgb
XSLT
xslt
http
precompiled
JVM
POSIX
posix
APIs
CVS
CCVS
MySQL
mysql
msql
mSQL
MSSQL
mssql
mysqli
MySQLi
WBMP
BMP
symlinks
uncheck
OSX
UTF
UDF
utf
regex


Reply via email to