svn: /phpdoc/doc-base/trunk/ configure.php developer.template.xml.in

From: Date: Wed, 27 Apr 2011 12:10:32 +0000
Subject: svn: /phpdoc/doc-base/trunk/ configure.php developer.template.xml.in
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-8017@lists.php.net to get a copy of this message
bjori Wed, 27 Apr 2011 12:10:32 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=310556 Log: Add a --generate=path/to/xml/file.xml option to create a "partial build" Useful when you just want to quickly verify your bugfix, or just to render one boo etc etc For example; php doc-base/configure.php --generate=en/reference/mysqli/book.xml ; phd --package PHP --format php -d doc-base/.manual.xml takes less then 7 seconds :) Changed paths: _U phpdoc/doc-base/trunk/ U phpdoc/doc-base/trunk/configure.php A phpdoc/doc-base/trunk/developer.template.xml.in Property changes on: phpdoc/doc-base/trunk ___________________________________________________________________ Modified: svn:ignore - *.aux *.ced *.dvi *.fot *.bz2 *.gz *.html *.log *.pdf *.prc *.ps *.rtf *.ser *.tex *.zip *.chm manual.xml *.xml Makefile confdefs.h config.cache config.h.in config.log config.status configure diff html.cur install-unix.txt install-win.txt php_manual_* manual.txt manual.xml missing.txt php html status.txt chmonly.xml reserved.constants.xml autom4te* missing-entities.out manual.fo project infiles.cache version.xml + *.aux *.ced *.dvi *.fot *.bz2 *.gz *.html *.log *.pdf *.prc *.ps *.rtf *.ser *.tex *.zip *.chm manual.xml *.xml Makefile confdefs.h config.cache config.h.in config.log config.status configure diff html.cur install-unix.txt install-win.txt php_manual_* manual.txt manual.xml missing.txt php html status.txt chmonly.xml reserved.constants.xml autom4te* missing-entities.out manual.fo project infiles.cache version.xml install-unix.xml install-win.xml developer.template.xml tags Modified: phpdoc/doc-base/trunk/configure.php =================================================================== --- phpdoc/doc-base/trunk/configure.php 2011-04-27 12:07:36 UTC (rev 310555) +++ phpdoc/doc-base/trunk/configure.php 2011-04-27 12:10:32 UTC (rev 310556) @@ -65,6 +65,7 @@ --redirect-stderr-to-stdout Redirect STDERR to STDOUT. Use STDOUT as the standart output for XML errors [{$acd['STDERR_TO_STDOUT']}] --output=FILENAME Save to given file (i.e. not .manual.xml) [{$acd['OUTPUT_FILENAME']}] + --generate=FILENAME Create an XML only for provided file HELPCHUNK; } // }}} @@ -277,7 +278,9 @@ 'USE_BROKEN_TRANSLATION_FILENAME' => 'yes', 'COPYRIGHT_YEAR' => date('Y'), 'OUTPUT_FILENAME' => $srcdir . '/.manual.xml', - 'STDERR_TO_STDOUT' => 'no' + 'GENERATE' => 'no', + 'STDERR_TO_STDOUT' => 'no', + 'INPUT_FILENAME' => $srcdir . '/manual.xml', ); // }}} $ac = $acd; @@ -401,6 +404,10 @@ $ac['OUTPUT_FILENAME'] = $v; break; + case 'generate': + $ac['GENERATE'] = $v; + break; + case 'broken-file-listing': $ac['USE_BROKEN_TRANSLATION_FILENAME'] = $v; @@ -436,9 +443,6 @@ checking('for output filename'); checkvalue($ac['OUTPUT_FILENAME']); -checking('whether to save an invalid .manual.xml'); -checkvalue($ac['FORCE_DOM_SAVE']); - checking('whether to include CHM'); $ac['CHMONLY_INCL_BEGIN'] = ($ac['CHMENABLED'] == 'yes' ? '' : '<!--'); $ac['CHMONLY_INCL_END'] = ($ac['CHMENABLED'] == 'yes' ? '' : '-->'); @@ -508,6 +512,7 @@ 'manual.xml.in', 'install-unix.xml.in', 'install-win.xml.in', + 'developer.template.xml.in', 'entities/version.ent.in', 'scripts/file-entities.php.in', ); @@ -617,14 +622,32 @@ quietechorun("\"{$ac['PHP']}\" -q \"{$ac['basedir']}/scripts/file-entities.php\"{$redir}"); -echo "Loading and parsing manual.xml... "; + +checking("for if we should generate a simplified file"); +if ($ac["GENERATE"] != "no") { + if (!file_exists($ac["GENERATE"])) { + checkerror("Can't find {$ac["GENERATE"]}"); + } + $tmp = realpath($ac["GENERATE"]); + $ac["GENERATE"] = str_replace($ac["LANGDIR"], "", $tmp); + $str = "\n<!ENTITY developer.include.file SYSTEM 'file:///{$ac["GENERATE"]}'>"; + file_put_contents("{$ac["basedir"]}/entities/file-entities.ent", $str, FILE_APPEND); + $ac["INPUT_FILENAME"] = "developer.template.xml"; + $ac["FORCE_DOM_SAVE"] = "yes"; +} +checkvalue($ac["GENERATE"]); + +checking('whether to save an invalid .manual.xml'); +checkvalue($ac['FORCE_DOM_SAVE']); + +echo "Loading and parsing {$ac["INPUT_FILENAME"]}... "; flush(STDOUT); $dom = new DOMDocument(); // realpath() is important: omitting it causes severe performance degradation // and doubled memory usage on Windows. -$didLoad = $dom->load(realpath("{$ac['srcdir']}/manual.xml"), $LIBXML_OPTS); +$didLoad = $dom->load(realpath("{$ac['srcdir']}/{$ac["INPUT_FILENAME"]}"), $LIBXML_OPTS); // Check if the XML was simply broken, if so then just bail out if ($didLoad === false) { @@ -634,7 +657,7 @@ } echo "done.\n"; -echo "Validating manual.xml... "; +echo "Validating {$ac["INPUT_FILENAME"]}... "; flush(STDOUT); $dom->xinclude(); @@ -709,6 +732,10 @@ // Allow the .manual.xml file to be created, even if it is not valid. if ($ac['FORCE_DOM_SAVE'] == 'yes') { printf("writing %s anyway, and ", basename($ac["OUTPUT_FILENAME"])); + if ($ac["SEGFAULT_SPEED"]) { + $t = $dom->doctype; + $dom->removeChild($t); + } $dom->save($mxml); } @@ -717,7 +744,7 @@ echo "(This could take awhile. If you experience segfaults here, try again with --disable-xml-details)\n"; libxml_clear_errors(); // Clear the errrors, they contain incorrect filename&linenr - $dom->load("{$ac['srcdir']}/manual.xml", $LIBXML_OPTS | LIBXML_DTDVALID); + $dom->load("{$ac['srcdir']}/{$ac["INPUT_FILENAME"]}", $LIBXML_OPTS | LIBXML_DTDVALID); print_xml_errors(); } else { echo "here are the errors I got:\n"; Added: phpdoc/doc-base/trunk/developer.template.xml.in =================================================================== --- phpdoc/doc-base/trunk/developer.template.xml.in (rev 0) +++ phpdoc/doc-base/trunk/developer.template.xml.in 2011-04-27 12:10:32 UTC (rev 310556) @@ -0,0 +1,27 @@ +<?xml version='1.0' encoding='UTF-8' ?> +<!DOCTYPE set PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN" +"./docbook/docbook-xml/docbook.dtd" [ + +<!ENTITY % language-defs SYSTEM "../@LANGDIR@/language-defs.ent"> +<!ENTITY % language-snippets SYSTEM "../@LANGDIR@/language-snippets.ent"> + +%language-defs; +%language-snippets; + +<!-- All global entities for the XML files --> +<!ENTITY % global.entities SYSTEM "./entities/global.ent"> + +<!-- These are language independent --> +<!ENTITY % build.version SYSTEM "./entities/version.ent"> +<!ENTITY % global.file-entities SYSTEM "./entities/file-entities.ent"> + +%global.entities; +%global.file-entities; +%build.version; + +]> + +<set xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="index" xml:lang="en" xmlns:xlink="http://www.w3.org/1999/xlink"> + <title>Developers preview</title> + &developer.include.file; +</set>

« previous php.doc.cvs (#8017) next »