This patch adds a --partial option to configure.php in REF_STRUCT_DEV,
allowing for quicker builds over on the PhD side.

The massive amounts of entities that .manual.xml.in defines still bloat
up the file, and I'm not exactly certain whether or not how partials for
refentry would be done.
-- 
 Edward Z. Yang                        GnuPG: 0x869C48DA
 HTML Purifier <http://htmlpurifier.org> Anti-XSS Filter
 [[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
Index: .cvsignore
===================================================================
RCS file: /repository/phpdoc/.cvsignore,v
retrieving revision 1.46
diff -u -r1.46 .cvsignore
--- .cvsignore  18 Sep 2005 12:04:14 -0000      1.46
+++ .cvsignore  10 Nov 2007 23:08:07 -0000
@@ -14,6 +14,7 @@
 *.zip
 *.chm
 .manual.xml
+.manual.*.xml
 Makefile
 confdefs.h
 config.cache
Index: configure.php
===================================================================
RCS file: /repository/phpdoc/configure.php,v
retrieving revision 1.6.2.3
diff -u -r1.6.2.3 configure.php
--- configure.php       5 Nov 2007 11:27:20 -0000       1.6.2.3
+++ configure.php       10 Nov 2007 23:01:37 -0000
@@ -114,6 +114,7 @@
 $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',
@@ -203,6 +204,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,6 +898,21 @@
 $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");
+    if ($node->tagName == 'book' || $node->tagName == 'set') exit("Partial 
section is not a book or set");
+    $set = $dom->documentElement;
+    $set->nodeValue = '';
+    $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, run php build.php on this file\n";
+    exit(0);
+}
+
 if ($dom->validate()) {
   echo "All good.\n";
   $dom->save(".manual.xml");
@@ -904,4 +924,4 @@
     $dom->save(".manual.xml");
   exit(1); // Tell the shell that this script finished with an error.
 }
-  
+

Reply via email to