svn: /phd/trunk/ package.xml phpdotnet/phd/BuildOptionsParser.php phpdotnet/phd/Config.php phpdotnet/phd/Package/PHP/Web.php
phpdotnet/phd/functions.php
| From: | Philip Olson | Date: | Thu, 03 Jun 2010 03:33:21 +0000 |
| Subject: | svn: /phd/trunk/ package.xml phpdotnet/phd/BuildOptionsParser.php phpdotnet/phd/Config.php phpdotnet/phd/Package/PHP/Web.php phpdotnet/phd/functions.php |
||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-6783@lists.php.net to get a copy of this message | ||
philip Thu, 03 Jun 2010 03:33:21 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=300140
Log:
Added --notoc option to use cached toc (for PHP package), and now build toc/ by default.
Changed paths:
U phd/trunk/package.xml
U phd/trunk/phpdotnet/phd/BuildOptionsParser.php
U phd/trunk/phpdotnet/phd/Config.php
U phd/trunk/phpdotnet/phd/Package/PHP/Web.php
U phd/trunk/phpdotnet/phd/functions.php
Modified: phd/trunk/package.xml
===================================================================
--- phd/trunk/package.xml 2010-06-03 03:09:38 UTC (rev 300139)
+++ phd/trunk/package.xml 2010-06-03 03:33:21 UTC (rev 300140)
@@ -73,6 +73,8 @@
- Allow colored output on Windows, but not by default (Richard Quadling)
- Allow <void/> as return type for methodsynopsis tags rather than
<type>void</type> (Richard Quadling)
- Added support for <sidebar> (Richard Quadling)
+ - Now builds toc/* by default for the PHP package, and added --notoc option to use cached
version (Philip)
+ - Changed the VERBOSE_DEFAULT error level to exclude VERBOSE_TOC_WRITING messages (Philip)
</notes>
<contents>
Modified: phd/trunk/phpdotnet/phd/BuildOptionsParser.php
===================================================================
--- phd/trunk/phpdotnet/phd/BuildOptionsParser.php 2010-06-03 03:09:38 UTC (rev 300139)
+++ phd/trunk/phpdotnet/phd/BuildOptionsParser.php 2010-06-03 03:33:21 UTC (rev 300140)
@@ -20,6 +20,7 @@
'format:' => 'f:', // The format to render (xhtml,
pdf...)
'noindex' => 'I', // Do not re-index
'forceindex' => 'r', // Force re-indexing under all
circumstances
+ 'notoc' => 't', // Do not re-create TOC
'docbook:' => 'd:', // The Docbook XML file to render
from (.manual.xml)
'output:' => 'o:', // The output directory
'partial:' => 'p:', // The ID to render (optionally
ignoring its children)
@@ -99,6 +100,15 @@
Config::set_force_index(true);
}
+ public function option_t($k, $v)
+ {
+ $this->option_notoc($k, 'true');
+ }
+ public function option_notoc($k, $v)
+ {
+ Config::set_no_toc(true);
+ }
+
public function option_d($k, $v)
{
$this->option_docbook($k, $v);
@@ -340,6 +350,9 @@
-r
--forceindex Force re-indexing under all circumstances
(default: false)
+ -t
+ --notoc Do not rewrite TOC before rendering but load from cache
+ (default: false)
-d <filename>
--docbook <filename> The Docbook file to render from
-x
Modified: phd/trunk/phpdotnet/phd/Config.php
===================================================================
--- phd/trunk/phpdotnet/phd/Config.php 2010-06-03 03:09:38 UTC (rev 300139)
+++ phd/trunk/phpdotnet/phd/Config.php 2010-06-03 03:33:21 UTC (rev 300140)
@@ -18,6 +18,7 @@
),
'no_index' => false,
'force_index' => false,
+ 'no_toc' => false,
'xml_root' => '.',
'xml_file' => './.manual.xml',
'lang_dir' => './',
Modified: phd/trunk/phpdotnet/phd/Package/PHP/Web.php
===================================================================
--- phd/trunk/phpdotnet/phd/Package/PHP/Web.php 2010-06-03 03:09:38 UTC (rev 300139)
+++ phd/trunk/phpdotnet/phd/Package/PHP/Web.php 2010-06-03 03:33:21 UTC (rev 300140)
@@ -81,6 +81,9 @@
}
}
if ($this->getFormatName() == "PHP-Web") {
+ if (!Config::no_toc() && is_dir($this->getOutputDir() .
'toc')) {
+ removeDir($this->getOutputDir() . 'toc');
+ }
if (!file_exists($this->getOutputDir() . "toc") ||
is_file($this->getOutputDir() . "toc")) {
mkdir($this->getOutputDir() . "toc") or die("Can't
create the toc directory");
}
Modified: phd/trunk/phpdotnet/phd/functions.php
===================================================================
--- phd/trunk/phpdotnet/phd/functions.php 2010-06-03 03:09:38 UTC (rev 300139)
+++ phd/trunk/phpdotnet/phd/functions.php 2010-06-03 03:33:21 UTC (rev 300140)
@@ -30,7 +30,7 @@
define('VERBOSE_ALL', (VERBOSE_MISSING_ATTRIBUTES << 1) - 1);
-define('VERBOSE_DEFAULT',
(VERBOSE_ALL^(VERBOSE_PARTIAL_CHILD_READING|VERBOSE_CHUNK_WRITING|VERBOSE_WARNINGS)));
+define('VERBOSE_DEFAULT',
(VERBOSE_ALL^(VERBOSE_PARTIAL_CHILD_READING|VERBOSE_CHUNK_WRITING|VERBOSE_WARNINGS|VERBOSE_TOC_WRITING)));
$olderrrep = error_reporting();
error_reporting($olderrrep | VERBOSE_DEFAULT);
@@ -55,6 +55,20 @@
}
/* }}} */
+/* {{{ Removes a directory, recursively. Taken from: http://php.net/is_link */
+function removeDir($path) {
+ $dir = new \DirectoryIterator($path);
+ foreach ($dir as $fileinfo) {
+ if ($fileinfo->isFile() || $fileinfo->isLink()) {
+ unlink($fileinfo->getPathName());
+ } elseif (!$fileinfo->isDot() && $fileinfo->isDir()) {
+ removeDir($fileinfo->getPathName());
+ }
+ }
+ rmdir($path);
+}
+/* }}} */
+
/* {{{ The PhD errorhandler */
function errh($errno, $msg, $file, $line, $ctx = null) {
static $err = array(