cvs: phd(rsync) / README.RENDERER build.php config.php package.xml /formats xhtml.php /include PhDFormat.class.php PhDHelper.class.php
PhDReader.class.php PhDTheme.class.php /themes/php bightml.php phpdotnet.php phpweb.php
| From: | Hannes Magnusson | Date: | Sun, 30 Dec 2007 14:38:22 +0000 |
| Subject: | cvs: phd(rsync) / README.RENDERER build.php config.php package.xml /formats xhtml.php /include PhDFormat.class.php PhDHelper.class.php PhDReader.class.php PhDTheme.class.php /themes/php bightml.php phpdotnet.php phpweb.php |
||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-940@lists.php.net to get a copy of this message | ||
bjori Sun Dec 30 14:38:22 2007 UTC
Added files: (Branch: rsync)
/phd/include PhDTheme.class.php
Modified files:
/phd README.RENDERER build.php config.php package.xml
/phd/formats xhtml.php
/phd/include PhDFormat.class.php PhDHelper.class.php
PhDReader.class.php
/phd/themes/php bightml.php phpdotnet.php phpweb.php
Log:
MFH: Sync to PhD 0.2.1
http://cvs.php.net/viewvc.cgi/phd/README.RENDERER?r1=1.5&r2=1.5.2.1&diff_format=u Index: phd/README.RENDERER diff -u phd/README.RENDERER:1.5 phd/README.RENDERER:1.5.2.1 --- phd/README.RENDERER:1.5 Tue Nov 20 22:26:42 2007 +++ phd/README.RENDERER Sun Dec 30 14:38:21 2007 @@ -1,7 +1,8 @@ Installing the PhD renderer: From Release ball: - pear install http://doc.php.net/phd/PhD-0.2.0.tgz + pear install http://doc.php.net/phd/PhD-x.y.z.tgz + # Where x.y.z is the version number, i.e. 0.2.1 From CVS: cvs -d:pserver:cvsread@cvs.php.net/repository co phd @@ -36,6 +37,7 @@ #5) phd --docbook ~/phpdoc/.manual.xml (Using PHP prior to 5.3:) #5-old) phd -d ~/phpdoc/.manual.xml + NOTE: The shortform works on PHP5.3 too This will create http://cvs.php.net/viewvc.cgi/phd/build.php?r1=1.37&r2=1.37.2.1&diff_format=u Index: phd/build.php diff -u phd/build.php:1.37 phd/build.php:1.37.2.1 --- phd/build.php:1.37 Mon Nov 5 19:49:04 2007 +++ phd/build.php Sun Dec 30 14:38:21 2007 @@ -1,6 +1,6 @@ #!@php_bin@ <?php -/* $Id: build.php,v 1.37 2007/11/05 19:49:04 bjori Exp $ */ +/* $Id: build.php,v 1.37.2.1 2007/12/30 14:38:21 bjori Exp $ */ function err($no, $str, $file, $line) { global $notify; @@ -41,6 +41,7 @@ require $ROOT. "/include/PhDPartialReader.class.php"; require $ROOT. "/include/PhDHelper.class.php"; require $ROOT. "/include/PhDFormat.class.php"; +require $ROOT. "/include/PhDTheme.class.php"; if ($OPTIONS["index"]) { if ($OPTIONS["verbose"] & VERBOSE_INDEXING) { @@ -98,6 +99,11 @@ default: $themes[$themename] = new $themename($IDs); } + + // WARNING: this needs to go away when we add support for + // things other than xhtml + $themes[$themename]->registerFormat($format); + // If the theme returns empty callback map there is no need to include it $tmp = $themes[$themename]->getElementMap(); @@ -138,9 +144,9 @@ $props = array( "empty" => $reader->isEmptyElement, "isChunk" => $isChunk, - /* These two are not used at the moment */ "lang" => $reader->xmlLang, "ns" => $reader->namespaceURI, + "sibling" => $reader->getPreviousSiblingTagName(), ); $skip = array(); @@ -159,6 +165,7 @@ } continue; } + $funcname = $tag; $retval = $themes[$theme]->{$funcname}($open, $nodename, $attrs, $props); if ($retval !== false) { http://cvs.php.net/viewvc.cgi/phd/config.php?r1=1.12&r2=1.12.2.1&diff_format=u Index: phd/config.php diff -u phd/config.php:1.12 phd/config.php:1.12.2.1 --- phd/config.php:1.12 Thu Nov 8 16:40:54 2007 +++ phd/config.php Sun Dec 30 14:38:21 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: config.php,v 1.12 2007/11/08 16:40:54 bjori Exp $ */ +/* $Id: config.php,v 1.12.2.1 2007/12/30 14:38:21 bjori Exp $ */ function v($msg) { $args = func_get_args(); @@ -18,7 +18,7 @@ define('VERBOSE_ALL',VERBOSE_INDEXING|VERBOSE_FORMAT_RENDERING|VERBOSE_THEME_RENDERING|VERBOSE_RENDER_STYLE|VERBOSE_PARTIAL_READING|VERBOSE_PARTIAL_CHILD_READING|VERBOSE_TOC_WRITING|VERBOSE_CHUNK_WRITING); -define("PHD_VERSION", "0.2.0"); +define("PHD_VERSION", "0.2.1"); $OPTIONS = array ( 'output_format' => array('xhtml'), @@ -85,11 +85,11 @@ case "d": case "docbook": if (is_array($v)) { - v("Can only parse one file at a time"); + v("Can only parse one file at a time\n"); exit(-1); } if (!file_exists($v) || is_dir($v) || !is_readable($v)) { - v("'%s' is not a readable docbook file", $v); + v("'%s' is not a readable docbook file\n", $v); exit(-1); } $OPTIONS["xml_root"] = dirname($v); @@ -102,7 +102,7 @@ case "f": case "format": if ($v != "xhtml") { - v("Only xhtml is supported at this time"); + v("Only xhtml is supported at this time\n"); exit(-1); } break; @@ -112,7 +112,7 @@ case "i": case "index": if (is_array($v)) { - v("You cannot pass %s more than once", $k); + v("You cannot pass %s more than once\n", $k); exit(-1); } switch ($v) { @@ -127,7 +127,7 @@ $OPTIONS["index"] = false; break; default: - v("yes/no || true/false || 1/0 expected"); + v("yes/no || true/false || 1/0 expected\n"); exit(-1); } break; @@ -167,7 +167,7 @@ } break; default: - v("Unkown theme '%s'", $val); + v("Unkown theme '%s'\n", $val); exit(-1); } } @@ -205,7 +205,7 @@ case "V": case "version": v("PhD version: %s\n", PHD_VERSION); - v("Copyright (c) 2007 The PHP Documentation Group"); + v("Copyright (c) 2007 The PHP Documentation Group\n"); exit(0); case "usage": http://cvs.php.net/viewvc.cgi/phd/package.xml?r1=1.14&r2=1.14.2.1&diff_format=u Index: phd/package.xml diff -u phd/package.xml:1.14 phd/package.xml:1.14.2.1 --- phd/package.xml:1.14 Thu Nov 8 16:39:34 2007 +++ phd/package.xml Sun Dec 30 14:38:21 2007 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.5.4" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>PhD</name> - <uri>http://doc.php.net/phd/phd-0.2.0</uri> + <uri>http://doc.php.net/phd/phd-0.2.1</uri> <summary>A PHP based Docbook renderer</summary> <description> PhD is a PHP based Docbook renderer aimed to replace the Docbook-XSL @@ -13,10 +13,10 @@ <email>bjori@php.net</email> <active>yes</active> </lead> - <date>2007-11-08</date> + <date>2007-12-30</date> <version> - <release>0.2.0</release> - <api>0.2.0</api> + <release>0.2.1</release> + <api>0.2.1</api> </version> <stability> <release>snapshot</release> @@ -24,19 +24,17 @@ </stability> <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license> <notes> - - Added partial rendering - - Added various verbosity levels - - Added getopt() parsing for few configuration options - - Added support for errorcode, symbol and superscript elements (used by few translations) - - Suppressed the contrib element - - - Fixed bug#43192 (Chunked HTML output difficult to use without TOC). (Edward Z. Yang) - - Fixed bug#43191 (build.php fails to included necessary theme dependencies). (Edward Z. Yang, Richard Q) + - Multiple <term>s should be line seperated + - Fixed autogenerated links to methods (Edward Z.) + - Compressed methodnames in classsynopsis (Edward Z.) + - Added HTML headers for the bightml theme + - Removed warnings about missing translation files </notes> <contents> <dir baseinstalldir="phd" name="/"> <file baseinstalldir="phd" name="formats/xhtml.php" role="php"/> <file baseinstalldir="phd" name="include/PhDFormat.class.php" role="php"/> + <file baseinstalldir="phd" name="include/PhDTheme.class.php" role="php"/> <file baseinstalldir="phd" name="include/PhDHelper.class.php" role="php"/> <file baseinstalldir="phd" name="include/PhDReader.class.php" role="php"/> <file baseinstalldir="phd" name="include/PhDPartialReader.class.php" role="php"/> @@ -157,6 +155,30 @@ </notes> </release> </changelog> + <changelog> + <release> + <version> + <release>0.2.0</release> + <api>0.2.0</api> + </version> + <stability> + <release>beta</release> + <api>devel</api> + </stability> + <date>2007-11-08</date> + <notes> + - Added partial rendering + - Added various verbosity levels + - Added getopt() parsing for few configuration options + - Added support for errorcode, symbol and superscript elements (used by few translations) + - Suppressed the contrib element + + - Fixed bug#43192 (Chunked HTML output difficult to use without TOC). (Edward Z. Yang) + - Fixed bug#43191 (build.php fails to included necessary theme dependencies). (Edward Z. Yang, Richard Q) + </notes> + </release> + </changelog> + </package> <!-- vim: et sw=2 ts=2 http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.41&r2=1.41.2.1&diff_format=u Index: phd/formats/xhtml.php diff -u phd/formats/xhtml.php:1.41 phd/formats/xhtml.php:1.41.2.1 --- phd/formats/xhtml.php:1.41 Sat Nov 3 17:14:45 2007 +++ phd/formats/xhtml.php Sun Dec 30 14:38:21 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: xhtml.php,v 1.41 2007/11/03 17:14:45 bjori Exp $ */ +/* $Id: xhtml.php,v 1.41.2.1 2007/12/30 14:38:21 bjori Exp $ */ class XHTMLPhDFormat extends PhDFormat { protected $elementmap = array( /* {{{ */ @@ -195,7 +195,7 @@ 'synopsis' => 'pre', 'tag' => 'code', 'table' => 'format_table', - 'term' => 'span', + 'term' => 'format_term', 'tfoot' => 'format_th', 'thead' => 'format_th', 'tgroup' => 'format_tgroup', @@ -254,6 +254,28 @@ /* DEFAULT */ false, 'fieldsynopsis' => 'format_fieldsynopsis_modifier_text', ), + 'classname' => array( + /* DEFAULT */ false, + 'ooclass' => array( + /* DEFAULT */ false, + 'classsynopsis' => 'format_classsynopsis_ooclass_classname_text', + ), + ), + 'methodname' => array( + /* DEFAULT */ false, + 'constructorsynopsis' => array( + /* DEFAULT */ false, + 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', + ), + 'methodsynopsis' => array( + /* DEFAULT */ false, + 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', + ), + 'destructorsynopsis' => array( + /* DEFAULT */ false, + 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', + ), + ), ); @@ -389,6 +411,31 @@ } return "</div>"; } + + public function format_classsynopsis_ooclass_classname_text($value, $tag) { + $this->tmp["classsynopsis"]["classname"] = $value; + return $value; + } + + public function format_classsynopsis_methodsynopsis_methodname_text($value, $tag) { + if (!isset($this->tmp["classsynopsis"]["classname"])) { + return $value; + } + if (strpos($value, '::')) { + $explode = '::'; + } else if (strpos($value, '->')) { + $explode = '->'; + } else { + return $value; + } + + list($class, $method) = explode($explode, $value); + if ($class !== $this->tmp["classsynopsis"]["classname"]) { + return $value; + } + return $method; + } + public function format_fieldsynopsis($open, $name, $attrs) { $this->tmp["fieldsynopsis"] = array(); if ($open) { @@ -587,6 +634,15 @@ } return "</dd>\n"; } + public function format_term($open, $name, $attrs, $props) { + if ($open) { + if ($props["sibling"] == $name) { + return '<br /><span class="' .$name. '">'; + } + return '<span class="' .$name. '">'; + } + return "</span>\n"; + } public function format_userinput($open, $name, $attrs) { if ($open) { return '<strong class="' .$name. '"><code>'; http://cvs.php.net/viewvc.cgi/phd/include/PhDFormat.class.php?r1=1.7&r2=1.7.2.1&diff_format=u Index: phd/include/PhDFormat.class.php diff -u phd/include/PhDFormat.class.php:1.7 phd/include/PhDFormat.class.php:1.7.2.1 --- phd/include/PhDFormat.class.php:1.7 Tue Oct 2 14:37:42 2007 +++ phd/include/PhDFormat.class.php Sun Dec 30 14:38:22 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDFormat.class.php,v 1.7 2007/10/02 14:37:42 bjori Exp $ */ +/* $Id: PhDFormat.class.php,v 1.7.2.1 2007/12/30 14:38:22 bjori Exp $ */ abstract class PhDFormat extends PhDHelper { private $TABLE = array(); @@ -79,9 +79,6 @@ } -interface PhDTheme { - public function appendData($data, $isChunk); -} /* * vim600: sw=4 ts=4 fdm=syntax syntax=php et * vim<600: sw=4 ts=4 http://cvs.php.net/viewvc.cgi/phd/include/PhDHelper.class.php?r1=1.7.2.1&r2=1.7.2.2&diff_format=u Index: phd/include/PhDHelper.class.php diff -u phd/include/PhDHelper.class.php:1.7.2.1 phd/include/PhDHelper.class.php:1.7.2.2 --- phd/include/PhDHelper.class.php:1.7.2.1 Sun Nov 25 13:08:29 2007 +++ phd/include/PhDHelper.class.php Sun Dec 30 14:38:22 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDHelper.class.php,v 1.7.2.1 2007/11/25 13:08:29 bjori Exp $ */ +/* $Id: PhDHelper.class.php,v 1.7.2.2 2007/12/30 14:38:22 bjori Exp $ */ class PhDHelper { private $IDs = array(); http://cvs.php.net/viewvc.cgi/phd/include/PhDReader.class.php?r1=1.12&r2=1.12.2.1&diff_format=u Index: phd/include/PhDReader.class.php diff -u phd/include/PhDReader.class.php:1.12 phd/include/PhDReader.class.php:1.12.2.1 --- phd/include/PhDReader.class.php:1.12 Sun Oct 21 17:08:44 2007 +++ phd/include/PhDReader.class.php Sun Dec 30 14:38:22 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDReader.class.php,v 1.12 2007/10/21 17:08:44 bjori Exp $ */ +/* $Id: PhDReader.class.php,v 1.12.2.1 2007/12/30 14:38:22 bjori Exp $ */ //6271 class PhDReader extends XMLReader { @@ -13,6 +13,7 @@ private $STACK = array(); private $LAST_DEPTH = -1; private $lastChunkDepth = -1; + private $PREVIOUS_SIBLING = ""; public $isChunk = false; @@ -107,6 +108,10 @@ public function getParentTagName() { return $this->STACK[$this->depth-1]; } + public function getPreviousSiblingTagName() { + return $this->PREVIOUS_SIBLING; + } + public function read() { $this->isChunk = false; if(XMLReader::read()) { http://cvs.php.net/viewvc.cgi/phd/themes/php/bightml.php?r1=1.5.2.1&r2=1.5.2.2&diff_format=u Index: phd/themes/php/bightml.php diff -u phd/themes/php/bightml.php:1.5.2.1 phd/themes/php/bightml.php:1.5.2.2 --- phd/themes/php/bightml.php:1.5.2.1 Sun Nov 25 14:11:26 2007 +++ phd/themes/php/bightml.php Sun Dec 30 14:38:22 2007 @@ -1,8 +1,8 @@ <?php -/* $Id: bightml.php,v 1.5.2.1 2007/11/25 14:11:26 bjori Exp $ */ +/* $Id: bightml.php,v 1.5.2.2 2007/12/30 14:38:22 bjori Exp $ */ require_once $ROOT . '/themes/php/phpdotnet.php'; -class bightml extends phpdotnet implements PhDTheme { +class bightml extends phpdotnet { public function __construct(array $IDs, $filename, $ext = "html") { parent::__construct($IDs, $filename, $ext, false); $this->stream = fopen("bightml.html", "w"); http://cvs.php.net/viewvc.cgi/phd/themes/php/phpdotnet.php?r1=1.28&r2=1.28.2.1&diff_format=u Index: phd/themes/php/phpdotnet.php diff -u phd/themes/php/phpdotnet.php:1.28 phd/themes/php/phpdotnet.php:1.28.2.1 --- phd/themes/php/phpdotnet.php:1.28 Sat Nov 3 16:44:10 2007 +++ phd/themes/php/phpdotnet.php Sun Dec 30 14:38:22 2007 @@ -1,7 +1,7 @@ <?php -/* $Id: phpdotnet.php,v 1.28 2007/11/03 16:44:10 bjori Exp $ */ +/* $Id: phpdotnet.php,v 1.28.2.1 2007/12/30 14:38:22 bjori Exp $ */ -class phpdotnet extends PhDHelper { +abstract class phpdotnet extends PhDTheme { protected $elementmap = array( 'acronym' => 'format_suppressed_tags', 'function' => 'format_suppressed_tags', @@ -80,7 +80,21 @@ protected $textmap = array( 'acronym' => 'format_acronym_text', 'function' => 'format_function_text', - 'methodname' => 'format_function_text', + 'methodname' => array( + /* DEFAULT */ 'format_function_text', + 'constructorsynopsis' => array( + /* DEFAULT */ 'format_function_text', + 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', + ), + 'methodsynopsis' => array( + /* DEFAULT */ 'format_function_text', + 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', + ), + 'destructorsynopsis' => array( + /* DEFAULT */ 'format_function_text', + 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', + ), + ), 'type' => array( /* DEFAULT */ 'format_type_text', 'classsynopsisinfo' => false, @@ -353,14 +367,34 @@ /* ignore it */ return ""; } - public function format_function_text($value, $tag) { + + public function format_classsynopsis_methodsynopsis_methodname_text($value, $tag) { + $display_value = $this->format->format_classsynopsis_methodsynopsis_methodname_text($value, $tag); + return $this->format_function_text($value, $tag, $display_value); + } + + public function format_function_text($value, $tag, $display_value = null) { + if ($display_value === null) { + $display_value = $value; + } + $link = strtolower(str_replace(array("__", "_", "::", "->"), array("", "-", "-", "-"), $value)); - - if ($this->CURRENT_FUNCTION === $link || !($filename = PhDHelper::getFilename("function.$link"))) { - return '<b>' .$value.($tag == "function" ? "()" : ""). '</b>'; + $oop_link = strtolower(str_replace(array("_", "::", "->"), array("", ".", "."), $value)); + + if ( + ( + $this->CURRENT_FUNCTION === $link || + !($filename = PhDHelper::getFilename("function.$link")) + ) && + ( + $this->CURRENT_ID === $oop_link || + !($filename = PhDHelper::getFilename($oop_link)) + ) + ) { + return '<b>' .$display_value.($tag == "function" ? "()" : ""). '</b>'; } - return '<a href="' .($this->chunked ? "" : "#").$filename. '.' .$this->ext. '" class="function">' .$value.($tag == "function" ? "()" : ""). '</a>'; + return '<a href="' .($this->chunked ? "" : "#").$filename. '.' .$this->ext. '" class="function">' .$display_value.($tag == "function" ? "()" : ""). '</a>'; } public function format_type_text($type, $tagname) { $t = strtolower($type); @@ -392,7 +426,11 @@ $href = "language.pseudo-types"; $fragment = "language.types.$t"; break; + default: + /* Check if its a classname. */ + $href = PhDTheme::getFilename("class.$t"); } + if ($href && $this->chunked) { return '<a href="' .$href. '.' .$this->ext.($fragment ? "#$fragment" : ""). '" class="' .$tagname. ' ' .$type. '">' .$type. '</a>'; } http://cvs.php.net/viewvc.cgi/phd/themes/php/phpweb.php?r1=1.18&r2=1.18.2.1&diff_format=u Index: phd/themes/php/phpweb.php diff -u phd/themes/php/phpweb.php:1.18 phd/themes/php/phpweb.php:1.18.2.1 --- phd/themes/php/phpweb.php:1.18 Mon Nov 5 19:49:04 2007 +++ phd/themes/php/phpweb.php Sun Dec 30 14:38:22 2007 @@ -1,8 +1,8 @@ <?php -/* $Id: phpweb.php,v 1.18 2007/11/05 19:49:04 bjori Exp $ */ +/* $Id: phpweb.php,v 1.18.2.1 2007/12/30 14:38:22 bjori Exp $ */ require_once $ROOT . '/themes/php/phpdotnet.php'; -class phpweb extends phpdotnet implements PhDTheme { +class phpweb extends phpdotnet { protected $streams = array(); protected $writeit = false; http://cvs.php.net/viewvc.cgi/phd/include/PhDTheme.class.php?view=markup&rev=1.1 Index: phd/include/PhDTheme.class.php +++ phd/include/PhDTheme.class.php <?php /* $Id: PhDTheme.class.php,v 1.1 2007/11/25 20:29:30 bjori Exp $ */ abstract class PhDTheme extends PhDHelper implements iPhDTheme { protected $format; public function registerFormat($format) { $this->format = $format; } } interface iPhDTheme { public function appendData($data, $isChunk); } /* * vim600: sw=4 ts=4 fdm=syntax syntax=php et * vim<600: sw=4 ts=4 */
http://cvs.php.net/viewvc.cgi/phd/README.RENDERER?r1=1.5&r2=1.5.2.1&diff_format=u Index: phd/README.RENDERER diff -u phd/README.RENDERER:1.5 phd/README.RENDERER:1.5.2.1 --- phd/README.RENDERER:1.5 Tue Nov 20 22:26:42 2007 +++ phd/README.RENDERER Sun Dec 30 14:38:21 2007 @@ -1,7 +1,8 @@ Installing the PhD renderer: From Release ball: - pear install http://doc.php.net/phd/PhD-0.2.0.tgz + pear install http://doc.php.net/phd/PhD-x.y.z.tgz + # Where x.y.z is the version number, i.e. 0.2.1 From CVS: cvs -d:pserver:cvsread@cvs.php.net/repository co phd @@ -36,6 +37,7 @@ #5) phd --docbook ~/phpdoc/.manual.xml (Using PHP prior to 5.3:) #5-old) phd -d ~/phpdoc/.manual.xml + NOTE: The shortform works on PHP5.3 too This will create http://cvs.php.net/viewvc.cgi/phd/build.php?r1=1.37&r2=1.37.2.1&diff_format=u Index: phd/build.php diff -u phd/build.php:1.37 phd/build.php:1.37.2.1 --- phd/build.php:1.37 Mon Nov 5 19:49:04 2007 +++ phd/build.php Sun Dec 30 14:38:21 2007 @@ -1,6 +1,6 @@ #!@php_bin@ <?php -/* $Id: build.php,v 1.37 2007/11/05 19:49:04 bjori Exp $ */ +/* $Id: build.php,v 1.37.2.1 2007/12/30 14:38:21 bjori Exp $ */ function err($no, $str, $file, $line) { global $notify; @@ -41,6 +41,7 @@ require $ROOT. "/include/PhDPartialReader.class.php"; require $ROOT. "/include/PhDHelper.class.php"; require $ROOT. "/include/PhDFormat.class.php"; +require $ROOT. "/include/PhDTheme.class.php"; if ($OPTIONS["index"]) { if ($OPTIONS["verbose"] & VERBOSE_INDEXING) { @@ -98,6 +99,11 @@ default: $themes[$themename] = new $themename($IDs); } + + // WARNING: this needs to go away when we add support for + // things other than xhtml + $themes[$themename]->registerFormat($format); + // If the theme returns empty callback map there is no need to include it $tmp = $themes[$themename]->getElementMap(); @@ -138,9 +144,9 @@ $props = array( "empty" => $reader->isEmptyElement, "isChunk" => $isChunk, - /* These two are not used at the moment */ "lang" => $reader->xmlLang, "ns" => $reader->namespaceURI, + "sibling" => $reader->getPreviousSiblingTagName(), ); $skip = array(); @@ -159,6 +165,7 @@ } continue; } + $funcname = $tag; $retval = $themes[$theme]->{$funcname}($open, $nodename, $attrs, $props); if ($retval !== false) { http://cvs.php.net/viewvc.cgi/phd/config.php?r1=1.12&r2=1.12.2.1&diff_format=u Index: phd/config.php diff -u phd/config.php:1.12 phd/config.php:1.12.2.1 --- phd/config.php:1.12 Thu Nov 8 16:40:54 2007 +++ phd/config.php Sun Dec 30 14:38:21 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: config.php,v 1.12 2007/11/08 16:40:54 bjori Exp $ */ +/* $Id: config.php,v 1.12.2.1 2007/12/30 14:38:21 bjori Exp $ */ function v($msg) { $args = func_get_args(); @@ -18,7 +18,7 @@ define('VERBOSE_ALL',VERBOSE_INDEXING|VERBOSE_FORMAT_RENDERING|VERBOSE_THEME_RENDERING|VERBOSE_RENDER_STYLE|VERBOSE_PARTIAL_READING|VERBOSE_PARTIAL_CHILD_READING|VERBOSE_TOC_WRITING|VERBOSE_CHUNK_WRITING); -define("PHD_VERSION", "0.2.0"); +define("PHD_VERSION", "0.2.1"); $OPTIONS = array ( 'output_format' => array('xhtml'), @@ -85,11 +85,11 @@ case "d": case "docbook": if (is_array($v)) { - v("Can only parse one file at a time"); + v("Can only parse one file at a time\n"); exit(-1); } if (!file_exists($v) || is_dir($v) || !is_readable($v)) { - v("'%s' is not a readable docbook file", $v); + v("'%s' is not a readable docbook file\n", $v); exit(-1); } $OPTIONS["xml_root"] = dirname($v); @@ -102,7 +102,7 @@ case "f": case "format": if ($v != "xhtml") { - v("Only xhtml is supported at this time"); + v("Only xhtml is supported at this time\n"); exit(-1); } break; @@ -112,7 +112,7 @@ case "i": case "index": if (is_array($v)) { - v("You cannot pass %s more than once", $k); + v("You cannot pass %s more than once\n", $k); exit(-1); } switch ($v) { @@ -127,7 +127,7 @@ $OPTIONS["index"] = false; break; default: - v("yes/no || true/false || 1/0 expected"); + v("yes/no || true/false || 1/0 expected\n"); exit(-1); } break; @@ -167,7 +167,7 @@ } break; default: - v("Unkown theme '%s'", $val); + v("Unkown theme '%s'\n", $val); exit(-1); } } @@ -205,7 +205,7 @@ case "V": case "version": v("PhD version: %s\n", PHD_VERSION); - v("Copyright (c) 2007 The PHP Documentation Group"); + v("Copyright (c) 2007 The PHP Documentation Group\n"); exit(0); case "usage": http://cvs.php.net/viewvc.cgi/phd/package.xml?r1=1.14&r2=1.14.2.1&diff_format=u Index: phd/package.xml diff -u phd/package.xml:1.14 phd/package.xml:1.14.2.1 --- phd/package.xml:1.14 Thu Nov 8 16:39:34 2007 +++ phd/package.xml Sun Dec 30 14:38:21 2007 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.5.4" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>PhD</name> - <uri>http://doc.php.net/phd/phd-0.2.0</uri> + <uri>http://doc.php.net/phd/phd-0.2.1</uri> <summary>A PHP based Docbook renderer</summary> <description> PhD is a PHP based Docbook renderer aimed to replace the Docbook-XSL @@ -13,10 +13,10 @@ <email>bjori@php.net</email> <active>yes</active> </lead> - <date>2007-11-08</date> + <date>2007-12-30</date> <version> - <release>0.2.0</release> - <api>0.2.0</api> + <release>0.2.1</release> + <api>0.2.1</api> </version> <stability> <release>snapshot</release> @@ -24,19 +24,17 @@ </stability> <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license> <notes> - - Added partial rendering - - Added various verbosity levels - - Added getopt() parsing for few configuration options - - Added support for errorcode, symbol and superscript elements (used by few translations) - - Suppressed the contrib element - - - Fixed bug#43192 (Chunked HTML output difficult to use without TOC). (Edward Z. Yang) - - Fixed bug#43191 (build.php fails to included necessary theme dependencies). (Edward Z. Yang, Richard Q) + - Multiple <term>s should be line seperated + - Fixed autogenerated links to methods (Edward Z.) + - Compressed methodnames in classsynopsis (Edward Z.) + - Added HTML headers for the bightml theme + - Removed warnings about missing translation files </notes> <contents> <dir baseinstalldir="phd" name="/"> <file baseinstalldir="phd" name="formats/xhtml.php" role="php"/> <file baseinstalldir="phd" name="include/PhDFormat.class.php" role="php"/> + <file baseinstalldir="phd" name="include/PhDTheme.class.php" role="php"/> <file baseinstalldir="phd" name="include/PhDHelper.class.php" role="php"/> <file baseinstalldir="phd" name="include/PhDReader.class.php" role="php"/> <file baseinstalldir="phd" name="include/PhDPartialReader.class.php" role="php"/> @@ -157,6 +155,30 @@ </notes> </release> </changelog> + <changelog> + <release> + <version> + <release>0.2.0</release> + <api>0.2.0</api> + </version> + <stability> + <release>beta</release> + <api>devel</api> + </stability> + <date>2007-11-08</date> + <notes> + - Added partial rendering + - Added various verbosity levels + - Added getopt() parsing for few configuration options + - Added support for errorcode, symbol and superscript elements (used by few translations) + - Suppressed the contrib element + + - Fixed bug#43192 (Chunked HTML output difficult to use without TOC). (Edward Z. Yang) + - Fixed bug#43191 (build.php fails to included necessary theme dependencies). (Edward Z. Yang, Richard Q) + </notes> + </release> + </changelog> + </package> <!-- vim: et sw=2 ts=2 http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.41&r2=1.41.2.1&diff_format=u Index: phd/formats/xhtml.php diff -u phd/formats/xhtml.php:1.41 phd/formats/xhtml.php:1.41.2.1 --- phd/formats/xhtml.php:1.41 Sat Nov 3 17:14:45 2007 +++ phd/formats/xhtml.php Sun Dec 30 14:38:21 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: xhtml.php,v 1.41 2007/11/03 17:14:45 bjori Exp $ */ +/* $Id: xhtml.php,v 1.41.2.1 2007/12/30 14:38:21 bjori Exp $ */ class XHTMLPhDFormat extends PhDFormat { protected $elementmap = array( /* {{{ */ @@ -195,7 +195,7 @@ 'synopsis' => 'pre', 'tag' => 'code', 'table' => 'format_table', - 'term' => 'span', + 'term' => 'format_term', 'tfoot' => 'format_th', 'thead' => 'format_th', 'tgroup' => 'format_tgroup', @@ -254,6 +254,28 @@ /* DEFAULT */ false, 'fieldsynopsis' => 'format_fieldsynopsis_modifier_text', ), + 'classname' => array( + /* DEFAULT */ false, + 'ooclass' => array( + /* DEFAULT */ false, + 'classsynopsis' => 'format_classsynopsis_ooclass_classname_text', + ), + ), + 'methodname' => array( + /* DEFAULT */ false, + 'constructorsynopsis' => array( + /* DEFAULT */ false, + 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', + ), + 'methodsynopsis' => array( + /* DEFAULT */ false, + 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', + ), + 'destructorsynopsis' => array( + /* DEFAULT */ false, + 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', + ), + ), ); @@ -389,6 +411,31 @@ } return "</div>"; } + + public function format_classsynopsis_ooclass_classname_text($value, $tag) { + $this->tmp["classsynopsis"]["classname"] = $value; + return $value; + } + + public function format_classsynopsis_methodsynopsis_methodname_text($value, $tag) { + if (!isset($this->tmp["classsynopsis"]["classname"])) { + return $value; + } + if (strpos($value, '::')) { + $explode = '::'; + } else if (strpos($value, '->')) { + $explode = '->'; + } else { + return $value; + } + + list($class, $method) = explode($explode, $value); + if ($class !== $this->tmp["classsynopsis"]["classname"]) { + return $value; + } + return $method; + } + public function format_fieldsynopsis($open, $name, $attrs) { $this->tmp["fieldsynopsis"] = array(); if ($open) { @@ -587,6 +634,15 @@ } return "</dd>\n"; } + public function format_term($open, $name, $attrs, $props) { + if ($open) { + if ($props["sibling"] == $name) { + return '<br /><span class="' .$name. '">'; + } + return '<span class="' .$name. '">'; + } + return "</span>\n"; + } public function format_userinput($open, $name, $attrs) { if ($open) { return '<strong class="' .$name. '"><code>'; http://cvs.php.net/viewvc.cgi/phd/include/PhDFormat.class.php?r1=1.7&r2=1.7.2.1&diff_format=u Index: phd/include/PhDFormat.class.php diff -u phd/include/PhDFormat.class.php:1.7 phd/include/PhDFormat.class.php:1.7.2.1 --- phd/include/PhDFormat.class.php:1.7 Tue Oct 2 14:37:42 2007 +++ phd/include/PhDFormat.class.php Sun Dec 30 14:38:22 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDFormat.class.php,v 1.7 2007/10/02 14:37:42 bjori Exp $ */ +/* $Id: PhDFormat.class.php,v 1.7.2.1 2007/12/30 14:38:22 bjori Exp $ */ abstract class PhDFormat extends PhDHelper { private $TABLE = array(); @@ -79,9 +79,6 @@ } -interface PhDTheme { - public function appendData($data, $isChunk); -} /* * vim600: sw=4 ts=4 fdm=syntax syntax=php et * vim<600: sw=4 ts=4 http://cvs.php.net/viewvc.cgi/phd/include/PhDHelper.class.php?r1=1.7.2.1&r2=1.7.2.2&diff_format=u Index: phd/include/PhDHelper.class.php diff -u phd/include/PhDHelper.class.php:1.7.2.1 phd/include/PhDHelper.class.php:1.7.2.2 --- phd/include/PhDHelper.class.php:1.7.2.1 Sun Nov 25 13:08:29 2007 +++ phd/include/PhDHelper.class.php Sun Dec 30 14:38:22 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDHelper.class.php,v 1.7.2.1 2007/11/25 13:08:29 bjori Exp $ */ +/* $Id: PhDHelper.class.php,v 1.7.2.2 2007/12/30 14:38:22 bjori Exp $ */ class PhDHelper { private $IDs = array(); http://cvs.php.net/viewvc.cgi/phd/include/PhDReader.class.php?r1=1.12&r2=1.12.2.1&diff_format=u Index: phd/include/PhDReader.class.php diff -u phd/include/PhDReader.class.php:1.12 phd/include/PhDReader.class.php:1.12.2.1 --- phd/include/PhDReader.class.php:1.12 Sun Oct 21 17:08:44 2007 +++ phd/include/PhDReader.class.php Sun Dec 30 14:38:22 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDReader.class.php,v 1.12 2007/10/21 17:08:44 bjori Exp $ */ +/* $Id: PhDReader.class.php,v 1.12.2.1 2007/12/30 14:38:22 bjori Exp $ */ //6271 class PhDReader extends XMLReader { @@ -13,6 +13,7 @@ private $STACK = array(); private $LAST_DEPTH = -1; private $lastChunkDepth = -1; + private $PREVIOUS_SIBLING = ""; public $isChunk = false; @@ -107,6 +108,10 @@ public function getParentTagName() { return $this->STACK[$this->depth-1]; } + public function getPreviousSiblingTagName() { + return $this->PREVIOUS_SIBLING; + } + public function read() { $this->isChunk = false; if(XMLReader::read()) { http://cvs.php.net/viewvc.cgi/phd/themes/php/bightml.php?r1=1.5.2.1&r2=1.5.2.2&diff_format=u Index: phd/themes/php/bightml.php diff -u phd/themes/php/bightml.php:1.5.2.1 phd/themes/php/bightml.php:1.5.2.2 --- phd/themes/php/bightml.php:1.5.2.1 Sun Nov 25 14:11:26 2007 +++ phd/themes/php/bightml.php Sun Dec 30 14:38:22 2007 @@ -1,8 +1,8 @@ <?php -/* $Id: bightml.php,v 1.5.2.1 2007/11/25 14:11:26 bjori Exp $ */ +/* $Id: bightml.php,v 1.5.2.2 2007/12/30 14:38:22 bjori Exp $ */ require_once $ROOT . '/themes/php/phpdotnet.php'; -class bightml extends phpdotnet implements PhDTheme { +class bightml extends phpdotnet { public function __construct(array $IDs, $filename, $ext = "html") { parent::__construct($IDs, $filename, $ext, false); $this->stream = fopen("bightml.html", "w"); http://cvs.php.net/viewvc.cgi/phd/themes/php/phpdotnet.php?r1=1.28&r2=1.28.2.1&diff_format=u Index: phd/themes/php/phpdotnet.php diff -u phd/themes/php/phpdotnet.php:1.28 phd/themes/php/phpdotnet.php:1.28.2.1 --- phd/themes/php/phpdotnet.php:1.28 Sat Nov 3 16:44:10 2007 +++ phd/themes/php/phpdotnet.php Sun Dec 30 14:38:22 2007 @@ -1,7 +1,7 @@ <?php -/* $Id: phpdotnet.php,v 1.28 2007/11/03 16:44:10 bjori Exp $ */ +/* $Id: phpdotnet.php,v 1.28.2.1 2007/12/30 14:38:22 bjori Exp $ */ -class phpdotnet extends PhDHelper { +abstract class phpdotnet extends PhDTheme { protected $elementmap = array( 'acronym' => 'format_suppressed_tags', 'function' => 'format_suppressed_tags', @@ -80,7 +80,21 @@ protected $textmap = array( 'acronym' => 'format_acronym_text', 'function' => 'format_function_text', - 'methodname' => 'format_function_text', + 'methodname' => array( + /* DEFAULT */ 'format_function_text', + 'constructorsynopsis' => array( + /* DEFAULT */ 'format_function_text', + 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', + ), + 'methodsynopsis' => array( + /* DEFAULT */ 'format_function_text', + 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', + ), + 'destructorsynopsis' => array( + /* DEFAULT */ 'format_function_text', + 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', + ), + ), 'type' => array( /* DEFAULT */ 'format_type_text', 'classsynopsisinfo' => false, @@ -353,14 +367,34 @@ /* ignore it */ return ""; } - public function format_function_text($value, $tag) { + + public function format_classsynopsis_methodsynopsis_methodname_text($value, $tag) { + $display_value = $this->format->format_classsynopsis_methodsynopsis_methodname_text($value, $tag); + return $this->format_function_text($value, $tag, $display_value); + } + + public function format_function_text($value, $tag, $display_value = null) { + if ($display_value === null) { + $display_value = $value; + } + $link = strtolower(str_replace(array("__", "_", "::", "->"), array("", "-", "-", "-"), $value)); - - if ($this->CURRENT_FUNCTION === $link || !($filename = PhDHelper::getFilename("function.$link"))) { - return '<b>' .$value.($tag == "function" ? "()" : ""). '</b>'; + $oop_link = strtolower(str_replace(array("_", "::", "->"), array("", ".", "."), $value)); + + if ( + ( + $this->CURRENT_FUNCTION === $link || + !($filename = PhDHelper::getFilename("function.$link")) + ) && + ( + $this->CURRENT_ID === $oop_link || + !($filename = PhDHelper::getFilename($oop_link)) + ) + ) { + return '<b>' .$display_value.($tag == "function" ? "()" : ""). '</b>'; } - return '<a href="' .($this->chunked ? "" : "#").$filename. '.' .$this->ext. '" class="function">' .$value.($tag == "function" ? "()" : ""). '</a>'; + return '<a href="' .($this->chunked ? "" : "#").$filename. '.' .$this->ext. '" class="function">' .$display_value.($tag == "function" ? "()" : ""). '</a>'; } public function format_type_text($type, $tagname) { $t = strtolower($type); @@ -392,7 +426,11 @@ $href = "language.pseudo-types"; $fragment = "language.types.$t"; break; + default: + /* Check if its a classname. */ + $href = PhDTheme::getFilename("class.$t"); } + if ($href && $this->chunked) { return '<a href="' .$href. '.' .$this->ext.($fragment ? "#$fragment" : ""). '" class="' .$tagname. ' ' .$type. '">' .$type. '</a>'; } http://cvs.php.net/viewvc.cgi/phd/themes/php/phpweb.php?r1=1.18&r2=1.18.2.1&diff_format=u Index: phd/themes/php/phpweb.php diff -u phd/themes/php/phpweb.php:1.18 phd/themes/php/phpweb.php:1.18.2.1 --- phd/themes/php/phpweb.php:1.18 Mon Nov 5 19:49:04 2007 +++ phd/themes/php/phpweb.php Sun Dec 30 14:38:22 2007 @@ -1,8 +1,8 @@ <?php -/* $Id: phpweb.php,v 1.18 2007/11/05 19:49:04 bjori Exp $ */ +/* $Id: phpweb.php,v 1.18.2.1 2007/12/30 14:38:22 bjori Exp $ */ require_once $ROOT . '/themes/php/phpdotnet.php'; -class phpweb extends phpdotnet implements PhDTheme { +class phpweb extends phpdotnet { protected $streams = array(); protected $writeit = false; http://cvs.php.net/viewvc.cgi/phd/include/PhDTheme.class.php?view=markup&rev=1.1 Index: phd/include/PhDTheme.class.php +++ phd/include/PhDTheme.class.php <?php /* $Id: PhDTheme.class.php,v 1.1 2007/11/25 20:29:30 bjori Exp $ */ abstract class PhDTheme extends PhDHelper implements iPhDTheme { protected $format; public function registerFormat($format) { $this->format = $format; } } interface iPhDTheme { public function appendData($data, $isChunk); } /* * vim600: sw=4 ts=4 fdm=syntax syntax=php et * vim<600: sw=4 ts=4 */