cvs: phd(RESTRUCTURE) /include PhDCompileOptions.class.php PhDRenderOptions.class.php PhDSetupOptions.class.php

From: Date: Thu, 10 Jul 2008 17:06:58 +0000
Subject: cvs: phd(RESTRUCTURE) /include PhDCompileOptions.class.php PhDRenderOptions.class.php PhDSetupOptions.class.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-1859@lists.php.net to get a copy of this message
gwynne Thu Jul 10 17:06:58 2008 UTC Modified files: (Branch: RESTRUCTURE) /phd/include PhDCompileOptions.class.php PhDRenderOptions.class.php PhDSetupOptions.class.php Log: several options that belong to setup moved there. and let's keep our quote styles straight

http://cvs.php.net/viewvc.cgi/phd/include/PhDCompileOptions.class.php?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: phd/include/PhDCompileOptions.class.php diff -u phd/include/PhDCompileOptions.class.php:1.1.2.2 phd/include/PhDCompileOptions.class.php:1.1.2.3 --- phd/include/PhDCompileOptions.class.php:1.1.2.2 Thu Jul 10 12:35:59 2008 +++ phd/include/PhDCompileOptions.class.php Thu Jul 10 17:06:58 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDCompileOptions.class.php,v 1.1.2.2 2008/07/10 12:35:59 gwynne Exp $ */ +/* $Id: PhDCompileOptions.class.php,v 1.1.2.3 2008/07/10 17:06:58 gwynne Exp $ */ require 'PhDCommonOptions.class.php'; @@ -8,10 +8,8 @@ public function getOptionList() { return array_merge(parent::getOptionList(), array( - 'output:' => 'o:', // Output directory or file - 'source:' => 's:', // Input phpdoc checkout - 'force:' => 'f:', // Force DOM save on validation fail - 'partial:' => 'p:', // Root ID + "force:" => "f:", // Force DOM save on validation fail + "partial:" => "p:", // Root ID )); } @@ -23,10 +21,6 @@ protected function getHelpText() { return <<<'ENDBLOB' - -o <file/directory> - --output <file/directory> The output directory or file (default: ./.manual.xml) - -s <directory> - --source <directory> The source documentation checkout (default: .) -f <bool> --force <bool> Save (true) invalid XML with errors or discard (default). -p <id> http://cvs.php.net/viewvc.cgi/phd/include/PhDRenderOptions.class.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: phd/include/PhDRenderOptions.class.php diff -u phd/include/PhDRenderOptions.class.php:1.1.2.1 phd/include/PhDRenderOptions.class.php:1.1.2.2 --- phd/include/PhDRenderOptions.class.php:1.1.2.1 Wed Jul 9 12:14:11 2008 +++ phd/include/PhDRenderOptions.class.php Thu Jul 10 17:06:58 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDRenderOptions.class.php,v 1.1.2.1 2008/07/09 12:14:11 gwynne Exp $ */ +/* $Id: PhDRenderOptions.class.php,v 1.1.2.2 2008/07/10 17:06:58 gwynne Exp $ */ require 'PhDCommonOptions.class.php'; @@ -10,55 +10,14 @@ public function getOptionList() { return array_merge(parent::getOptionList(), array( - "format:" => "f:", // The format to render (xhtml, pdf...) - "theme:" => "t:", // The theme to render (phpweb, bightml..) "index:" => "i:", // Re-index or load from cache "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) "skip:" => "s:", // The ID to skip (optionally skipping its children too) - "list::" => "l::", // List supported themes/formats )); } - public function option_f($k, $v) - { - $this->option_format($k, $v); - } - public function option_format($k, $v) - { - if ($v != "xhtml") { - trigger_error("Only xhtml is supported at this time", E_USER_ERROR); - } - } - - public function option_t($k, $v) - { - $this->option_theme($k, $v); - } - public function option_theme($k, $v) - { - /* Remove the default themes */ - $themes = PhDConfig::output_theme(); - $themes['xhtml']['php'] = array(); - - foreach((array)$v as $i => $val) { - switch($val) { - case "phpweb": - case "chunkedhtml": - case "bightml": - case "chmsource": - if (!in_array($val, $themes["xhtml"]["php"])) { - $themes["xhtml"]["php"][] = $val; - } - break; - default: - trigger_error(sprintf("Unknown theme '%s'", $val), E_USER_ERROR); - } - } - PhDConfig::set_output_theme($themes); - } - public function option_i($k, $v) { $this->option_index($k, $v); @@ -153,66 +112,6 @@ PhDConfig::set_skip_ids($skip_ids); } - public function option_l($k, $v) - { - $this->option_list($k, $v); - } - public function option_list($k, $v) - { - static $formatList = NULL; - static $themeList = NULL; - - if (is_null($formatList)) { - $formatList = array(); - foreach (glob($GLOBALS['ROOT'] . "/formats/*.php") as $item) { - $formatList[] = substr(basename($item), 0, -4); - } - } - if (is_null($themeList)) { - $themeList = array(); - foreach (glob($GLOBALS['ROOT'] . "/themes/*", GLOB_ONLYDIR) as $item) { - if (!in_array(basename($item), array('CVS', '.', '..'))) { - $maintheme = basename($item); - $subthemes = array(); - foreach (glob($item . "/*.php") as $subitem) { - $subthemes[] = substr(basename($subitem), 0, -4); - } - $themeList[$maintheme] = $subthemes; - } - } - } - - if ($v === false) { - $v = array('f', 't'); - } - - foreach((array)$v as $val) { - switch($val) { - case "f": - case "format": - case "formats": { - echo "Supported formats:\n"; - echo "\t" . implode("\n\t", $formatList) . "\n"; - break; - } - - case "t": - case "theme": - case "themes": - echo "Supported themes:\n"; - foreach ($themeList as $theme => $subthemes) { - echo "\t" . $theme . "\n\t\t" . implode("\n\t\t", $subthemes) . "\n"; - } - break; - - default: - echo "Unknown list type '$val'\n"; - break; - } - } - exit(0); - } - protected function getTitleText() { return "PhD Renderer"; @@ -221,10 +120,6 @@ protected function getHelpText() { return <<<'ENDBLOB' - -f <formatname> - --format <formatname> The build format to use - -t <themename> - --theme <themename> The theme to use -i <bool> --index <bool> Index before rendering (default) or load from cache (false) -d <filename> @@ -233,10 +128,8 @@ --partial <id[=bool]> The ID to render, optionally skipping its children chunks (default to true; render children) -s <id[=bool]> --skip <id[=bool]> The ID to skip, optionally skipping its children chunks (default to true; skip children) - -l <formats/themes> - --list <formats/themes> Print out the supported formats/themes (default: both) -o <directory> - --output <directory> The output directory (default: .) + --output <directory> The output directory for final generated files (default: .) ENDBLOB; } } http://cvs.php.net/viewvc.cgi/phd/include/PhDSetupOptions.class.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: phd/include/PhDSetupOptions.class.php diff -u phd/include/PhDSetupOptions.class.php:1.1.2.1 phd/include/PhDSetupOptions.class.php:1.1.2.2 --- phd/include/PhDSetupOptions.class.php:1.1.2.1 Thu Jul 10 16:51:28 2008 +++ phd/include/PhDSetupOptions.class.php Thu Jul 10 17:06:58 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDSetupOptions.class.php,v 1.1.2.1 2008/07/10 16:51:28 gwynne Exp $ */ +/* $Id: PhDSetupOptions.class.php,v 1.1.2.2 2008/07/10 17:06:58 gwynne Exp $ */ require 'PhDCommonOptions.class.php'; @@ -8,10 +8,128 @@ public function getOptionList() { return array_merge(parent::getOptionList(), array( -// 'output:' => 'o:', // Output directory or file + "format:" => "f:", // The format to render (xhtml, pdf...) + "theme:" => "t:", // The theme to render (phpweb, bightml..) + "list::" => "l::", // List supported themes/formats + "source:" => "s:", // Input phpdoc checkout + "output:" => "o:", // Output directory or file )); } + public function option_o($k, $v) + { + $this->option_output($k, $v); + } + public function option_output($k, $v) + { + if (is_array($v)) { + trigger_error("Only a single output location can be supplied", E_USER_ERROR); + } + @mkdir($v, 0777, true); + if (!is_dir($v) || !is_readable($v)) { + trigger_error(sprintf("'%s' is not a valid directory", $v), E_USER_ERROR); + } + PhDConfig::set_intermediate_output_dir($v); + } + + public function option_f($k, $v) + { + $this->option_format($k, $v); + } + public function option_format($k, $v) + { + if ($v != "xhtml") { + trigger_error("Only xhtml is supported at this time", E_USER_ERROR); + } + } + + public function option_t($k, $v) + { + $this->option_theme($k, $v); + } + public function option_theme($k, $v) + { + /* Remove the default themes */ + $themes = PhDConfig::output_theme(); + $themes['xhtml']['php'] = array(); + + foreach((array)$v as $i => $val) { + switch($val) { + case "phpweb": + case "chunkedhtml": + case "bightml": + case "chmsource": + if (!in_array($val, $themes["xhtml"]["php"])) { + $themes["xhtml"]["php"][] = $val; + } + break; + default: + trigger_error(sprintf("Unknown theme '%s'", $val), E_USER_ERROR); + } + } + PhDConfig::set_output_theme($themes); + } + + public function option_l($k, $v) + { + $this->option_list($k, $v); + } + public function option_list($k, $v) + { + static $formatList = NULL; + static $themeList = NULL; + + if (is_null($formatList)) { + $formatList = array(); + foreach (glob($GLOBALS['ROOT'] . "/formats/*.php") as $item) { + $formatList[] = substr(basename($item), 0, -4); + } + } + if (is_null($themeList)) { + $themeList = array(); + foreach (glob($GLOBALS['ROOT'] . "/themes/*", GLOB_ONLYDIR) as $item) { + if (!in_array(basename($item), array('CVS', '.', '..'))) { + $maintheme = basename($item); + $subthemes = array(); + foreach (glob($item . "/*.php") as $subitem) { + $subthemes[] = substr(basename($subitem), 0, -4); + } + $themeList[$maintheme] = $subthemes; + } + } + } + + if ($v === false) { + $v = array('f', 't'); + } + + foreach((array)$v as $val) { + switch($val) { + case "f": + case "format": + case "formats": { + echo "Supported formats:\n"; + echo "\t" . implode("\n\t", $formatList) . "\n"; + break; + } + + case "t": + case "theme": + case "themes": + echo "Supported themes:\n"; + foreach ($themeList as $theme => $subthemes) { + echo "\t" . $theme . "\n\t\t" . implode("\n\t\t", $subthemes) . "\n"; + } + break; + + default: + echo "Unknown list type '$val'\n"; + break; + } + } + exit(0); + } + protected function getTitleText() { return "PhD Setup"; @@ -19,10 +137,18 @@ protected function getHelpText() { - return '';/*<<<'ENDBLOB' - -o <file/directory> - --output <file/directory> The output directory or file (default: ./.manual.xml) -ENDBLOB;*/ + return <<<'ENDBLOB' + -s <directory> + --source <directory> The source documentation checkout (default: .) + -o <directory> + --output <directory> The output directory for intermediate build files (default: .) + -f <formatname> + --format <formatname> The output format to use + -t <themename> + --theme <themename> The theme to use + -l <formats/themes> + --list <formats/themes> Print out the supported formats/themes (default: both) +ENDBLOB; } }
« previous php.doc.cvs (#1859) next »