cvs: phpdoc / configure.php
| From: | Hannes Magnusson | Date: | Mon, 10 Dec 2007 17:26:20 +0000 |
| Subject: | cvs: phpdoc / configure.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-593@lists.php.net to get a copy of this message | ||
bjori Mon Dec 10 17:26:20 2007 UTC
Modified files:
/phpdoc configure.php
Log:
MFB: Added --partial/-p option to only generate ".manual.xml" for specified ID (set or
book)
MFB: Fix phd usage example
http://cvs.php.net/viewvc.cgi/phpdoc/configure.php?r1=1.9&r2=1.10&diff_format=u
Index: phpdoc/configure.php
diff -u phpdoc/configure.php:1.9 phpdoc/configure.php:1.10
--- phpdoc/configure.php:1.9 Mon Nov 5 11:27:52 2007
+++ phpdoc/configure.php Mon Dec 10 17:26:20 2007
@@ -17,10 +17,10 @@
| Authors: Dave Barr <dave@php.net> |
+----------------------------------------------------------------------+
- $Id: configure.php,v 1.9 2007/11/05 11:27:52 rquadling Exp $
+ $Id: configure.php,v 1.10 2007/12/10 17:26:20 bjori Exp $
*/
-$cvs_id = '$Id: configure.php,v 1.9 2007/11/05 11:27:52 rquadling Exp $';
+$cvs_id = '$Id: configure.php,v 1.10 2007/12/10 17:26:20 bjori Exp $';
$srcdir = "./";
echo "configure.php: $cvs_id\n";
@@ -114,10 +114,12 @@
$ac['HTMLHELP_ENCODING'] = '';
$ac['SP_OPTIONS'] = 'SP_ENCODING=XML SP_CHARSET_FIXED=YES';
$ac['FORCE_DOM_SAVE'] = false;
+$ac['PARTIAL'] = false;
$allowed_opts = array(
'help',
'force-dom-save',
+ 'partial',
'with-php=',
'with-jade=',
'with-nsgmls=',
@@ -203,6 +205,10 @@
case '--with-treesaving':
$ac['TREESAVING'] = '#t';
break;
+ case '--partial':
+ case '-p':
+ $ac['PARTIAL'] = $v;
+ break;
case '--force-dom-save':
$ac['FORCE_DOM_SAVE'] = true;
break;
@@ -893,15 +899,52 @@
$dom = new DOMDocument();
$dom->load("manual.xml", LIBXML_NOENT);
$dom->xinclude();
+
+if ($ac['PARTIAL']) {
+ $node = $dom->getElementById($ac['PARTIAL']);
+ if (!$node) exit("Failed to find partial ID in source XML: " .
$ac['PARTIAL']);
+ if ($node->tagName !== 'book' && $node->tagName !== 'set') {
+ // this node is not normally allowed here, attempt to wrap it
+ // in something else
+ $parents = array();
+ switch ($node->tagName) {
+ case 'refentry':
+ $parents[] = 'reference';
+ case 'part':
+ $parents[] = 'book';
+ break;
+ }
+ foreach ($parents as $name) {
+ $newNode = $dom->createElement($name);
+ $newNode->appendChild($node);
+ $node = $newNode;
+ }
+ }
+ $set = $dom->documentElement;
+ $set->nodeValue = '';
+ $set->appendChild($dom->createElement('title', 'PHP Manual
(Partial)')); // prevent validate from complaining unnecessarily
+ $set->appendChild($node);
+ $dom->validate(); // we don't care if the validation works or not
+ $filename = '.manual.' . $ac['PARTIAL'] . '.xml';
+ $dom->save($filename);
+ echo "Partial manual saved to $filename, to build it run 'phd -d" .
realpath($filename). "'\n";
+ exit(0);
+}
+
if ($dom->validate()) {
echo "All good.\n";
$dom->save(".manual.xml");
- echo "All you have to do now is run 'php build.php' in your phd checkout
folder\n";
+ echo "All you have to do now is run 'phd -d " . realpath(".manual.xml")
. "'\n";
exit(0); // Tell the shell that this script finished successfully.
} else {
echo "eyh man. No worries. Happ shittens. Try again after fixing the errors above\n";
- if ($ac['FORCE_DOM_SAVE']) // Allow the .manual.xml file to be created, even if it is
not valid.
+
+ if ($ac['FORCE_DOM_SAVE']) {
+ // Allow the .manual.xml file to be created, even if it is not valid.
+ echo "Writing .manual.xml anyway\n";
$dom->save(".manual.xml");
+ }
+
exit(1); // Tell the shell that this script finished with an error.
}
-
+