cvs: phpdoc / Makefile.in /scripts fixphpweb.php
| From: | Gabor Hojtsy | Date: | Fri, 25 Apr 2003 16:23:52 +0000 |
| Subject: | cvs: phpdoc / Makefile.in /scripts fixphpweb.php | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969352859@lists.php.net to get a copy of this message | ||
goba Fri Apr 25 12:23:52 2003 EDT
Added files:
/phpdoc/scripts fixphpweb.php
Modified files:
/phpdoc Makefile.in
Log:
Adding zend figures dependencies to XSL generated
output too (html_xsl and phpweb_xsl)
Also add a fixphpweb script to remove the <!DOCTYPE
from the top of generated files, in case they are there.
With the current xsltproc there is no option to not output
a <!DOCTYPE with exsl:document. The current CVS version
of xsltproc fixes this, but I don't know when there will be any
release out of it. Someone would probably be able to write
this fixing code in a sed oneliner, but I don't know shell script
magic...
Index: phpdoc/Makefile.in
diff -u phpdoc/Makefile.in:1.128 phpdoc/Makefile.in:1.129
--- phpdoc/Makefile.in:1.128 Sat Apr 19 13:40:57 2003
+++ phpdoc/Makefile.in Fri Apr 25 12:23:52 2003
@@ -13,7 +13,7 @@
#
#
-# $Id: Makefile.in,v 1.128 2003/04/19 17:40:57 goba Exp $
+# $Id: Makefile.in,v 1.129 2003/04/25 16:23:52 goba Exp $
#
all: html
@@ -160,7 +160,7 @@
$(JADE) $(CATALOG) -d $(HTML_STYLESHEET) -V use-output-dir -t sgml $(XMLDCL) manual.xml
# still needs more tweaks!!
-html_xsl: manual.xml
+html_xsl: manual.xml zendapihtml
@test -d html || mkdir html
${XSLTPROC} xsl/html.xsl manual.xml
@@ -174,9 +174,10 @@
@test -d ./htmlhelp/html || mkdir ./htmlhelp/html
${XSLTPROC} $(CHM_XSL_SHEET) manual.xml
-phpweb_xsl: manual.xml
+phpweb_xsl: manual.xml zendapiphp
@test -d php || mkdir php
${XSLTPROC} xsl/phpweb.xsl manual.xml
+ $(PHP) -q $(scriptdir)/fixphpweb.php
pwd/php
php/index.php: manual.xml $(PHPWEB_DEPS)
@test -d php || mkdir php
Index: phpdoc/scripts/fixphpweb.php
+++ phpdoc/scripts/fixphpweb.php
#!/usr/bin/php -q
<?php
/*
# +----------------------------------------------------------------------+
# | PHP Version 4 |
# +----------------------------------------------------------------------+
# | Copyright (c) 1997-2002 The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 2.02 of the PHP licience, |
# | that is bundled with this package in the file LICENCE and is |
# | avalible through the world wide web at |
# | http://www.php.net/license/2_02.txt.
|
# | If uou did not receive a copy of the PHP license and are unable to |
# | obtain it through the world wide web, please send a note to |
# | license@php.net so we can mail you a copy immediately |
# +----------------------------------------------------------------------+
# | Authors: Gabor Hojtsy <goba@php.net> |
# +----------------------------------------------------------------------+
*/
set_time_limit(0);
ob_implicit_flush();
if ($argc < 2 || $argc > 3) { ?>
Deletes the HTML !DOCTYPE lines from 'phpweb_xsl' generated files
Usage:
<?=$argv[0]?> <dir>
<dir> is the folder, where the phpweb_xsl output
files are located. The files will be rewritten to
get the !DOCTYPE removed.
<?php
exit;
}
echo "Starting phpweb_xsl fix\n";
// Strip of any ending slash
$startdir = preg_replace('!/+$!', '', $argv[1]);
// Check folder
if (!is_dir($startdir)) {
die("ERROR: The first parameter is not a directory\n");
}
// Try to open folder
$dh = opendir($startdir);
if (!$dh) { die("ERROR: Unable to open directory\n"); }
// For all the files
while (($filename = readdir($dh)) !== FALSE) {
$fullname = "$startdir/$filename";
// If this is a php file
if (preg_match("!.php$!", $fullname) && is_file($fullname)) {
$contents = file($fullname);
// If !DOCTYPE is not found, skip file rewrite
if (strpos($contents[0], "<!DOCTYPE") === FALSE) { continue; }
// Otherwise, rewrite the contents of the
// file, skiping the first line
$fp = fopen($fullname, "w");
if (!$fp) { die("ERROR: unable to open $fullname for writing\n"); }
fwrite($fp, join("", array_slice($contents, 1)));
fclose($fp);
}
}
closedir($dh);
echo "SUCCESS: !DOCTYPE stripout finished\n";