didou Wed Mar 17 05:45:52 2004 EDT
Added files:
/livedocs mk_peardoc.php mk_phpdoc.php
Modified files:
/livedocs TODO build-ops.in build.sh configure.in mkindex.php
Log:
splitted the build process
- added an option to ./configure : --with-build-type[=phpdoc|peardoc]
- mkindex.php now takes another argument, the build type
- added two configuration files (phpdoc and peardoc)
http://cvs.php.net/diff.php/livedocs/TODO?r1=1.15&r2=1.16&ty=u
Index: livedocs/TODO
diff -u livedocs/TODO:1.15 livedocs/TODO:1.16
--- livedocs/TODO:1.15 Fri Mar 12 06:12:13 2004
+++ livedocs/TODO Wed Mar 17 05:45:50 2004
@@ -9,7 +9,10 @@
on filename)
- Make the parsing and presentation more generic, so sort of plugins can be
developed for livedocs (for special PEAR or PHP-GTK needs) :
- * work in progress for PEAR, see the comments in mkindex.php
+ * work in progress for PEAR. TODO :
+ - customize search_parse_dir() in mk_peardoc.php
+ - reimplement scan_entities() to accept an argument containing the entities files
+ locations
- Better display of how an extension is available (PHP core, bundled ext.,
PECL ext.)
- In livedocs.php, for format_function() :
@@ -20,4 +23,4 @@
tags currently in use.
-$Revision: 1.15 $
+$Revision: 1.16 $
http://cvs.php.net/diff.php/livedocs/build-ops.in?r1=1.6&r2=1.7&ty=u
Index: livedocs/build-ops.in
diff -u livedocs/build-ops.in:1.6 livedocs/build-ops.in:1.7
--- livedocs/build-ops.in:1.6 Thu Feb 5 09:59:16 2004
+++ livedocs/build-ops.in Wed Mar 17 05:45:50 2004
@@ -3,6 +3,7 @@
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
http://cvs.php.net/diff.php/livedocs/build.sh?r1=1.20&r2=1.21&ty=u
Index: livedocs/build.sh
diff -u livedocs/build.sh:1.20 livedocs/build.sh:1.21
--- livedocs/build.sh:1.20 Thu Feb 5 09:59:16 2004
+++ livedocs/build.sh Wed Mar 17 05:45:50 2004
@@ -15,7 +15,7 @@
for i in ${LANGUAGES};
do
if test "$CONFIGURE_PHP_DOC" != "no" ; then
- echo -n "Configuring phpdoc for $i: "
+ echo -n "Configuring ${BUILDTYPE} for $i: "
date
cd ${PHPDOC}
if ! ./configure --with-lang=$i --with-php="${PHP}" ; then
@@ -41,7 +41,7 @@
echo -n "Making index for $i: "
date
- ${PHP} ${LIVEDOCSFORPHP}/mkindex.php ${PHPDOCFORPHP} $i ${GENDIRFORPHP}
+ ${PHP} ${LIVEDOCSFORPHP}/mkindex.php ${PHPDOCFORPHP} $i ${GENDIRFORPHP}
${BUILDTYPE}
mv ${GENDIR}/livedoc-idx.$i.sqlite ${OUTPUTDIR}
# create output dir
mkdir -p ${OUTPUTDIR}/$i
http://cvs.php.net/diff.php/livedocs/configure.in?r1=1.16&r2=1.17&ty=u
Index: livedocs/configure.in
diff -u livedocs/configure.in:1.16 livedocs/configure.in:1.17
--- livedocs/configure.in:1.16 Thu Feb 5 09:59:16 2004
+++ livedocs/configure.in Wed Mar 17 05:45:50 2004
@@ -1,5 +1,5 @@
## A configure script
-## $Id: configure.in,v 1.16 2004/02/05 14:59:16 wez Exp $
+## $Id: configure.in,v 1.17 2004/03/17 10:45:50 didou Exp $
AC_PREREQ(2.13)
AC_INIT(livedoc.css)
@@ -51,11 +51,15 @@
[BUILDLOG="$withval"],
[BUILDLOG="/var/log/livedocs-index"])
+AC_ARG_WITH(build-type,[ --with-build-type[=BUILD_TYPE] Build type
(phpdoc|peardoc) [default=phpdoc]],
+ [BUILDTYPE="$withval"],
+ [BUILDTYPE="phpdoc"])
+
AC_ARG_WITH(theme,[ --with-theme[=THEME_NAME] Theme name [default=default]],
[THEMENAME="$withval"],
[THEMENAME="default"])
-AC_ARG_WITH(docs,[ --with-docs[=DIR] PHP Doc location
[default=/dat/dev/php/phpdoc-all]],
+AC_ARG_WITH(docs,[ --with-docs[=DIR] Docs location
[default=/dat/dev/php/phpdoc-all]],
[PHPDOC="$withval"],
[PHPDOC="/dat/dev/php/phpdoc-all"])
@@ -110,6 +114,7 @@
AC_SUBST(OUTPUTDIR)
AC_SUBST(LANGUAGES)
AC_SUBST(THEMENAME)
+AC_SUBST(BUILDTYPE)
AC_SUBST(FORCE_DYNAMIC)
AC_SUBST(WEBBASE)
AC_SUBST(GENDIR)
http://cvs.php.net/diff.php/livedocs/mkindex.php?r1=1.21&r2=1.22&ty=u
Index: livedocs/mkindex.php
diff -u livedocs/mkindex.php:1.21 livedocs/mkindex.php:1.22
--- livedocs/mkindex.php:1.21 Fri Mar 12 06:13:44 2004
+++ livedocs/mkindex.php Wed Mar 17 05:45:51 2004
@@ -15,11 +15,11 @@
// +----------------------------------------------------------------------+
// | Authors: Wez Furlong, Derick Rethans, Ilia Alshanetsky |
// +----------------------------------------------------------------------+
-// | This script walks a phpdoc checkout and parses each page to |
+// | This script walks a (php|pear)doc checkout and parses each page to |
// | construct an index |
// +----------------------------------------------------------------------+
//
-// $Id: mkindex.php,v 1.21 2004/03/12 11:13:44 didou Exp $
+// $Id: mkindex.php,v 1.22 2004/03/17 10:45:51 didou Exp $
/* just to be on the safe side */
@@ -29,12 +29,15 @@
$PHPDOC = $argv[1];
$LANG = $argv[2];
$TMPDIR = $argv[3];
+$BUILDTYPE = $argv[4];
if (!is_dir($PHPDOC) || !is_dir($PHPDOC . DIRECTORY_SEPARATOR . $LANG)) {
- echo "Usage: mkindex.php /path/to/phpdoc lang tmp-dir\n";
+ echo "Usage: mkindex.php /path/to/phpdoc lang tmp-dir build-type\n";
exit(1);
}
+require 'mk_' . $BUILDTYPE . '.php';
+
function entity_replace($data) {
global $replacements;
@@ -92,10 +95,6 @@
$this->data .= "INSERT INTO idents VALUES ('{$this->last_id}',
{$this->fileid}, '" . sqlite_escape_string(trim($this->cdata)) . "');";
- if ($this->last_id == 'wrappers') {
- echo "\n\n";
- }
-
$this->last_id = false;
}
}
@@ -123,7 +122,6 @@
}
}
-// not working for peardoc, you'll need to comment this code
function build_func_list() {
global $idx;
@@ -176,10 +174,6 @@
sqlite_query($idx, 'delete from ents');
- // for peardoc only
- //$global_one = array('/home/didou/cvs/peardoc/global.ent'); // yep, it's ugly
- // you'll need to add $global_one to the array_merge call
-
$ents = glob($dirname . '/*.ent');
$language_defs = glob($GLOBALS['PHPDOC'] . DIRECTORY_SEPARATOR . $LANG .
DIRECTORY_SEPARATOR . '*.ent');
@@ -345,12 +339,17 @@
sqlite_query($idx, $create);
sqlite_query($idx, 'BEGIN TRANSACTION');
-$replacements = scan_entities($PHPDOC . DIRECTORY_SEPARATOR . 'entities');
-// no such file for peardoc
-parse_file($PHPDOC . DIRECTORY_SEPARATOR. 'installpart.xml', 'installpart.xml', 0);
+if ($BUILDTYPE == 'phpdoc') {
+ parse_file($PHPDOC . DIRECTORY_SEPARATOR. 'installpart.xml',
'installpart.xml', 0);
+ $replacements = scan_entities($PHPDOC . DIRECTORY_SEPARATOR . 'entities');
+} elseif ($BUILDTYPE == 'peardoc') {
+ $replacements = scan_entities($PHPDOC);
+}
parse_file($PHPDOC . DIRECTORY_SEPARATOR. 'manual.xml', 'manual.xml', 0);
scan_dir($PHPDOC . DIRECTORY_SEPARATOR . $LANG);
-build_func_list();
+if (MK_VERSION) {
+ build_func_list();
+}
$toc = file_get_contents($TMPDIR. '/toc-insert.sql');
sqlite_query($idx, $toc);
sqlite_query($idx, 'COMMIT');
@@ -449,66 +448,8 @@
return array_unique(explode(' ', sqlite_escape_string($ret)));
}
-function search_parse_dir($path, $section)
-{
- global $idx, $toca, $tocd;
-
- $d = opendir($path);
- readdir($d); readdir($d);
-
- while (($f = readdir($d))) {
- if ($f == 'functions.xml' || $f == 'CVS' || $f == '.cvsignore') {
- continue;
- }
- switch (filetype($path . '/' . $f)) {
- case 'file':
- switch ($section) {
- case 'reference' :
- if ($f == 'configure.xml' || $f ==
'constants.xml' || $f == 'ini.xml' || $f == 'reference.xml') {
- $docbook_id = 'ref.' .
basename($path);
- } else {
- $docbook_id = 'function.' .
substr($f, 0, -4);
- }
- break;
- case 'faq':
- case 'security' :
- $docbook_id = $section . '.' .
substr($f, 0, -4);
- break;
- case 'chapters' :
- case 'appendices' :
- $docbook_id = substr($f, 0, -4);
- break;
- }
-
- if (isset($toca[$docbook_id])) {
- $id = $toca[$docbook_id];
- $wl = search_parse_file($path . '/' . $f,
$descr);
- if ($descr && !isset($tocd[$id])) {
- $tocd[$id] = trim($descr);
- }
- $qry = '';
- foreach ($wl as $w) {
- if (strlen($w) > MIN_WORD_LEN) {
- $qry .= "INSERT INTO
full_search VALUES('{$w}', {$id});";
- }
- }
- sqlite_query($idx, $qry);
- } else {
- echo "BAD ID: $docbook_id ($path, $f,
$section)\n";
- }
- break;
- case 'dir' :
- search_parse_dir($path . '/' . $f, $section);
- break;
- }
- }
- closedir($d);
-}
-
// list of directories to index
-$parse_dirs = array('faq', 'reference', 'security', 'chapters', 'appendices');
-// For peardoc, uses this :
-// $parse_dirs = array('authoring', 'chapters', 'core', 'guide', 'package', 'pecl');
+// $parse_dirs is defined in mk_XXX.php
$path = $PHPDOC . DIRECTORY_SEPARATOR . $LANG . DIRECTORY_SEPARATOR;
sqlite_query($idx, 'BEGIN TRANSACTION');
http://cvs.php.net/co.php/livedocs/mk_peardoc.php?r=1.1&p=1
Index: livedocs/mk_peardoc.php
+++ livedocs/mk_peardoc.php
<?php
/* vim: set tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.php.net/license/3_0.txt. |
// | If you 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 |
// | [EMAIL PROTECTED] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Wez Furlong, Derick Rethans, Ilia Alshanetsky |
// +----------------------------------------------------------------------+
// | Configuration file for peardoc build |
// +----------------------------------------------------------------------+
//
// $Id: mk_peardoc.php,v 1.1 2004/03/17 10:45:51 didou Exp $
define('MK_VERSION', false);
$parse_dirs = array('authoring', 'chapters', 'core', 'guide', 'package', 'pecl');
function search_parse_dir($path, $section)
{
global $idx, $toca, $tocd;
$d = opendir($path);
readdir($d); readdir($d);
while (($f = readdir($d))) {
if ($f == 'CVS' || $f == '.cvsignore') {
continue;
}
switch (filetype($path . '/' . $f)) {
case 'file':
switch ($section) {
case 'reference' :
if ($f == 'configure.xml' || $f == 'constants.xml' || $f ==
'ini.xml' || $f == 'reference.xml') {
$docbook_id = 'ref.' . basename($path);
} else {
$docbook_id = 'function.' . substr($f, 0, -4);
}
break;
case 'faq':
case 'security' :
$docbook_id = $section . '.' . substr($f, 0, -4);
break;
case 'chapters' :
case 'appendices' :
$docbook_id = substr($f, 0, -4);
break;
}
if (isset($toca[$docbook_id])) {
$id = $toca[$docbook_id];
$wl = search_parse_file($path . '/' . $f, $descr);
if ($descr && !isset($tocd[$id])) {
$tocd[$id] = trim($descr);
}
$qry = '';
foreach ($wl as $w) {
if (strlen($w) > MIN_WORD_LEN) {
$qry .= "INSERT INTO full_search VALUES('{$w}', {$id});";
}
}
sqlite_query($idx, $qry);
} else {
echo "BAD ID: $docbook_id ($path, $f, $section)\n";
}
break;
case 'dir' :
search_parse_dir($path . '/' . $f, $section);
break;
}
}
closedir($d);
}
http://cvs.php.net/co.php/livedocs/mk_phpdoc.php?r=1.1&p=1
Index: livedocs/mk_phpdoc.php
+++ livedocs/mk_phpdoc.php
<?php
/* vim: set tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.php.net/license/3_0.txt. |
// | If you 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 |
// | [EMAIL PROTECTED] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Wez Furlong, Derick Rethans, Ilia Alshanetsky |
// +----------------------------------------------------------------------+
// | Configuration file for phpdoc build |
// +----------------------------------------------------------------------+
//
// $Id: mk_phpdoc.php,v 1.1 2004/03/17 10:45:51 didou Exp $
define('MK_VERSION', true);
$parse_dirs = array('faq', 'reference', 'security', 'chapters', 'appendices');
function search_parse_dir($path, $section)
{
global $idx, $toca, $tocd;
$d = opendir($path);
readdir($d); readdir($d);
while (($f = readdir($d))) {
if ($f == 'functions.xml' || $f == 'CVS' || $f == '.cvsignore') {
continue;
}
switch (filetype($path . '/' . $f)) {
case 'file':
switch ($section) {
case 'reference' :
if ($f == 'configure.xml' || $f == 'constants.xml' || $f ==
'ini.xml' || $f == 'reference.xml') {
$docbook_id = 'ref.' . basename($path);
} else {
$docbook_id = 'function.' . substr($f, 0, -4);
}
break;
case 'faq':
case 'security' :
$docbook_id = $section . '.' . substr($f, 0, -4);
break;
case 'chapters' :
case 'appendices' :
$docbook_id = substr($f, 0, -4);
break;
}
if (isset($toca[$docbook_id])) {
$id = $toca[$docbook_id];
$wl = search_parse_file($path . '/' . $f, $descr);
if ($descr && !isset($tocd[$id])) {
$tocd[$id] = trim($descr);
}
$qry = '';
foreach ($wl as $w) {
if (strlen($w) > MIN_WORD_LEN) {
$qry .= "INSERT INTO full_search VALUES('{$w}', {$id});";
}
}
sqlite_query($idx, $qry);
} else {
echo "BAD ID: $docbook_id ($path, $f, $section)\n";
}
break;
case 'dir' :
search_parse_dir($path . '/' . $f, $section);
break;
}
}
closedir($d);
}