PHPDoc

From: Date: Wed, 12 Dec 2001 15:35:52 +0000
Subject: PHPDoc
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-3462@lists.php.net to get a copy of this message
Hi everybody! I have fixed some bugs in the PHPDoc. Please see the list of changes below. The list of changes: - xmlexporter/PhpdocXMLDocumentExporter.php - fixed the documentation error. - renderer/html/templates/module.html - changed the module template header and made some other minor changes due to the fact that sdesc has now been included in the full description. Changed "function_{NAME}" to "functions_{NAME}" and "constant_{NAME}" to "consts_{NAME}" to generate anchor links in the "Elements list". - renderer/html/templates/class.html - a minor fix to the template structure √ also changed "function_{NAME}" to "functions_{NAME}" and "constant_{NAME}" to "consts_{NAME}" to generate anchor links in the "Elements list". - renderer/html/PhpdocHTMLModuleRenderer.php - fixed a minor module rendering bug. - renderer/html/PhpdocHTMLIndexRenderer.php - for "functions", "variables" and "consts" changed the link to an anchor link in the "Elements list". - renderer/html/PhpdocHTMLDocumentRenderer.php - now the link will open in a new browser window. - renderer/html/PhpdocHTMLClassRenderer.php - fixed the documentation error. - parser/PhpdocParserRegExp.php - added the "empty_resource" type for cases when user calls functions like foo($bar=NULL) and changed the regular expression for the "@global" tag. For the previous expression I needed to use the following construction to document a global object: " * @global object object sqlStorage $regStorage Registry storage" instead of " * @global object sqlStorage $regStorage Registry storage". - parser/PhpdocParserCore.php - added code for resource. -- Sincerely yours, Hayk mailto:hayk@softerra.com

? patch.txt Index: parser/PhpdocParserCore.php =================================================================== RCS file: /repository/pear/PHPDoc/parser/PhpdocParserCore.php,v retrieving revision 1.5 diff -u -r1.5 PhpdocParserCore.php --- parser/PhpdocParserCore.php 29 Aug 2001 15:50:12 -0000 1.5 +++ parser/PhpdocParserCore.php 12 Dec 2001 14:26:52 -0000 @@ -637,7 +637,10 @@ $type = 'array'; } $raw_value == $value; - + } else if (preg_match($this->PHP_COMPLEX['type_empty_resource'], $code, $regs)) { + $type = 'resource'; + $value = $regs[0]; + $raw_value = $regs[0]; } else if (preg_match($this->PHP_COMPLEX['type_constant'], $code, $regs)) { $constant = strtolower(trim($regs[0])); if ($constant == 'null' || $constant == 'null,') { Index: parser/PhpdocParserRegExp.php =================================================================== RCS file: /repository/pear/PHPDoc/parser/PhpdocParserRegExp.php,v retrieving revision 1.3 diff -u -r1.3 PhpdocParserRegExp.php --- parser/PhpdocParserRegExp.php 28 Nov 2001 21:06:17 -0000 1.3 +++ parser/PhpdocParserRegExp.php 12 Dec 2001 14:26:58 -0000 @@ -164,7 +164,9 @@ "number" => "[+-]?\s*\d+", "array" => "array\s*\(", - "empty_array" => "array\s*\(\s*\)\s*" + "empty_array" => "array\s*\(\s*\)\s*", + + "empty_resource" => "NULL" ); /** @@ -223,7 +225,9 @@ "type_number" => "", "type_array" => "", - "type_empty_array" => "" + "type_empty_array" => "", + + "type_empty_resource" => "" ); /** @@ -357,7 +361,7 @@ // RegExp used to grep define statements. // NOTE: the backticks do not allow the usage of $this->PHP_BASE // - $this->PHP_COMPLEX["const"] = sprintf("@^[^>]%sdefine%s\(%s(%s)%s,%s(%s)%s(?:,%s(%s))?%s\)%s;@is", + $this->PHP_COMPLEX["const"] = sprintf("@^%sdefine%s\(%s(%s)%s,%s(%s)%s(?:,%s(%s))?%s\)%s;@is", $this->PHP_BASE["space_optional"], $this->PHP_BASE["space_optional"], $this->PHP_BASE["space_optional"], @@ -430,7 +434,7 @@ $elements = array( 'boolean', 'string', 'string_enclosed', 'constant', 'int_oct', 'int_hex', 'float', 'float_exponent', - 'number', 'array', 'empty_array' + 'number', 'array', 'empty_array', 'empty_resource' ); reset($elements); while (list($key, $name) = each($elements)) @@ -449,10 +453,10 @@ ); $this->TAGS["return"] = $this->TAGS["var"]; - $this->TAGS["global"] = sprintf("/%s%s(%s)%s(%s)%s(.*)/is", + $this->TAGS["global"] = sprintf("/%s(?:%s(%s))?(?:%s(%s))%s(.*)?/is", $this->C_BASE["vartype"], - $this->PHP_BASE["space_optional"], - $this->C_COMPLEX["objectname_optional"], + $this->PHP_BASE["space"], + $this->PHP_BASE["label"], $this->PHP_BASE["space"], $this->PHP_COMPLEX["varname"], $this->PHP_BASE["space_optional"] Index: renderer/html/PhpdocHTMLClassRenderer.php =================================================================== RCS file: /repository/pear/PHPDoc/renderer/html/PhpdocHTMLClassRenderer.php,v retrieving revision 1.2 diff -u -r1.2 PhpdocHTMLClassRenderer.php --- renderer/html/PhpdocHTMLClassRenderer.php 23 Aug 2001 21:47:33 -0000 1.2 +++ renderer/html/PhpdocHTMLClassRenderer.php 12 Dec 2001 14:27:01 -0000 @@ -368,7 +368,7 @@ * * @param int number of "&nbsp;" required. * @see $indent - * @return tring A string with the requested number of nunbreakable html spaces + * @return string A string with the requested number of nunbreakable html spaces */ function getIndent($level) { Index: renderer/html/PhpdocHTMLDocumentRenderer.php =================================================================== RCS file: /repository/pear/PHPDoc/renderer/html/PhpdocHTMLDocumentRenderer.php,v retrieving revision 1.2 diff -u -r1.2 PhpdocHTMLDocumentRenderer.php --- renderer/html/PhpdocHTMLDocumentRenderer.php 23 Aug 2001 21:47:33 -0000 1.2 +++ renderer/html/PhpdocHTMLDocumentRenderer.php 12 Dec 2001 14:27:07 -0000 @@ -613,7 +613,7 @@ $value = ""; if (!isset($links[0])) { - $value .= sprintf('<a href="%s">%s</a>%s, ', + $value .= sprintf('<a href="%s" target="_blank">%s</a>%s, ', $links["url"], $links["url"], ("" != $links["value"]) ? " - " . $links["value"] : "" @@ -622,7 +622,7 @@ reset($links); while (list($k, $link) = each($links)) { - $value .= sprintf('<a href="%s">%s</a>%s, ', + $value .= sprintf('<a href="%s" target="_blank">%s</a>%s, ', $link["url"], $link["url"], ("" != $link["value"]) ? " - " . $links["value"] : "" Index: renderer/html/PhpdocHTMLIndexRenderer.php =================================================================== RCS file: /repository/pear/PHPDoc/renderer/html/PhpdocHTMLIndexRenderer.php,v retrieving revision 1.2 diff -u -r1.2 PhpdocHTMLIndexRenderer.php --- renderer/html/PhpdocHTMLIndexRenderer.php 23 Aug 2001 15:59:50 -0000 1.2 +++ renderer/html/PhpdocHTMLIndexRenderer.php 12 Dec 2001 14:27:10 -0000 @@ -222,14 +222,14 @@ case "functions": $desc = sprintf('Function in %s <a href="%s">%s</a>', $element["sourcetype"], - $this->nameToUrl($element["source"]) . $this->file_extension, + $this->nameToUrl($element["source"]) . $this->file_extension . "#" . $element["type"] . "_" . $element["name"] . "()", $element["source"] ); break; case "variables": $desc = sprintf('Variable in Class <a href="%s">%s</a>', - $this->nameToUrl($element["source"]) . $this->file_extension, + $this->nameToUrl($element["source"]) . $this->file_extension . "#" . $element["type"] . "_" . $element["name"], $element["source"] ); break; @@ -245,7 +245,7 @@ case "consts": $desc = sprintf('Constant defined in %s <a href="%s">%s</a>', $element["sourcetype"], - $this->nameToUrl($element["source"]) . $this->file_extension, + $this->nameToUrl($element["source"]) . $this->file_extension . "#" . $element["type"] . "_" . $element["name"], $element["source"] ); break; Index: renderer/html/PhpdocHTMLModuleRenderer.php =================================================================== RCS file: /repository/pear/PHPDoc/renderer/html/PhpdocHTMLModuleRenderer.php,v retrieving revision 1.1 diff -u -r1.1 PhpdocHTMLModuleRenderer.php --- renderer/html/PhpdocHTMLModuleRenderer.php 8 May 2001 04:48:38 -0000 1.1 +++ renderer/html/PhpdocHTMLModuleRenderer.php 12 Dec 2001 14:27:11 -0000 @@ -57,13 +57,13 @@ $tplvars["MODULE_UNDOC"] = ("true" == $module["undoc"]) ? $this->undocumented : ""; if (isset($module["doc"]["link"])) - $this->renderLinks($module["doc"]["link"], "class_"); + $this->renderLinks($module["doc"]["link"], "module_"); if (isset($module["doc"]["author"])) - $this->renderAuthors($module["doc"]["author"], "class_"); + $this->renderAuthors($module["doc"]["author"], "module_"); if (isset($module["doc"]["see"])) - $this->renderSee($module["doc"]["see"], "class_"); + $this->renderSee($module["doc"]["see"], "module_"); $fields = array( "version", "deprecated", "copyright", "since", "magic"); reset($fields); Index: renderer/html/templates/class.html =================================================================== RCS file: /repository/pear/PHPDoc/renderer/html/templates/class.html,v retrieving revision 1.3 diff -u -r1.3 class.html --- renderer/html/templates/class.html 23 Aug 2001 21:47:34 -0000 1.3 +++ renderer/html/templates/class.html 12 Dec 2001 14:27:17 -0000 @@ -67,7 +67,7 @@ <td align="left" valign="top"> <table width="100%" border="0"> <tr> - <td align="left" valign="top"><h3>Methods inherited from {SOURCE}</h3></td> + <td align="left" valign="top"><h2>Methods inherited from {SOURCE}</h2></td> </tr> <tr> <td align="left" valign="top">{ELEMENTS}</td> @@ -86,7 +86,7 @@ <!-- BEGIN functionsummary_loop --> <tr> <td align="right" valign="top">{RETURNTYPE}</td> - <td align="left" valign="top" width="100%"><a href="#function_{NAME}()" class="head">{NAME}({PARAMETER})</a><br />{SHORTDESCRIPTION}{UNDOC}<br /></td> + <td align="left" valign="top" width="100%"><a href="#functions_{NAME}()" class="head">{NAME}({PARAMETER})</a><br />{SHORTDESCRIPTION}{UNDOC}<br /></td> </tr> <!-- END functionsummary_loop --> </table> @@ -98,7 +98,7 @@ <td align="left" valign="top"> <table width="100%" border="0"> <tr> - <td align="left" valign="top"><h3>Fields inherited from {SOURCE}</h3></td> + <td align="left" valign="top"><h2>Fields inherited from {SOURCE}</h2></td> </tr> <tr> <td align="left" valign="top">{ELEMENTS}</td> @@ -117,7 +117,7 @@ <!-- BEGIN variablesummary_loop --> <tr> <td align="right" valign="top">{TYPE}</td> - <td align="left" valign="top" width="100%"><a class="head" href="#variable_{NAME}">{NAME}</a><br />{SHORTDESCRIPTION}{UNDOC}<br /></td> + <td align="left" valign="top" width="100%"><a href="#variables_{NAME}" class="head">{NAME}</a><br />{SHORTDESCRIPTION}{UNDOC}<br /></td> </tr> <!-- END variablesummary_loop --> </table> @@ -129,7 +129,7 @@ <td align="left" valign="top"> <table width="100%" border="0"> <tr> - <td align="left" valign="top"><h3>Constants inherited from {SOURCE}</h3></td> + <td align="left" valign="top"><h2>Constants inherited from {SOURCE}</h2></td> </tr> <tr> <td align="left" valign="top">{ELEMENTS}</td> @@ -143,11 +143,11 @@ <td align="left" valign="top"> <table width="100%" border="0"> <tr> - <td align="left" valign="top" colspan=3><h3>{ACCESS} Constant Summary</h3></td> + <td align="left" valign="top" colspan=3><h2>{ACCESS} Constant Summary</h2></td> </tr> <!-- BEGIN constantssummary_loop --> <tr> - <td align="left" valign="top"><a href="#constants_{NAME}">{NAME}</a></td> + <td align="left" valign="top"><a href="#consts_{NAME}">{NAME}</a></td> <td align="left" valign="top">>><code>{VALUE}</code><<</td> <td align="left" valign="top" width="100%">{SHORTDESCRIPTION}{UNDOC}</td> </tr> @@ -161,7 +161,7 @@ <td align="left" valign="top"> <table width="100%" border="0"> <tr> - <td align="left" valign="top"><h3>Included files inherited from {SOURCE}</h3></td> + <td align="left" valign="top"><h2>Included files inherited from {SOURCE}</h2></td> </tr> <tr> <td align="left" valign="top">{ELEMENTS}</td> @@ -175,7 +175,7 @@ <td align="left" valign="top"> <table width="100%" border="0"> <tr> - <td align="left" valign="top" colspan=2><h3>Included files Summary, Type: {TYPE}</h3></td> + <td align="left" valign="top" colspan=2><h2>Included files Summary, Type: {TYPE}</h2></td> </tr> <!-- BEGIN usessummary_loop --> <tr> @@ -195,7 +195,7 @@ <td colspan="2" align="left" valign="top"><h2>{ACCESS} Method Details</h2></td> </tr> <!-- BEGIN functiondetails_loop --> - <tr><td colspan="2" align="left" valign="top"><a name="function_{NAME}()"><h4>{NAME}</h4></a></td></tr> + <tr><td colspan="2" align="left" valign="top"><a name="functions_{NAME}()"><h4>{NAME}</h4></a></td></tr> <tr> <td colspan="2" align="left" valign="top"> <b>{ACCESS} {ABSTRACT} {STATIC} {FINAL} {RETURNTYPE} {NAME}({PARAMETER})</b><p> @@ -331,7 +331,7 @@ <td colspan="2" align="left" valign="top"><h2>{ACCESS} Field Details</h2></td> </tr> <!-- BEGIN variabledetails_loop --> - <tr><td colspan="2" align="left" valign="top"><a name="variable_{NAME}"><h4>{NAME}</h4></a></td></tr> + <tr><td colspan="2" align="left" valign="top"><a name="variables_{NAME}"><h4>{NAME}</h4></a></td></tr> <tr> <td colspan="2" align="left" valign="top"> <b>{ACCESS} {STATIC} {FINAL} {TYPE} {NAME}</b> @@ -412,7 +412,7 @@ <!-- BEGIN constantdetails_loop --> <tr> <td colspan="2" align="left" valign="top"> - <a name="constant_{NAME}"><h4>{NAME}</h4></a> + <a name="consts_{NAME}"><h4>{NAME}</h4></a> <code>define( {NAME}, >>{VALUE}<< )</code><br> Case: {CASE} <p> @@ -555,6 +555,7 @@ </tr> <!-- END usesdetails_loop --> </table> + </td> </tr> <!-- END usesdetails --> <tr> @@ -562,7 +563,7 @@ </tr> <tr> <td align="left" valign="top" bgcolor="#C0C0C0"> - <table> + <table width="100%"> <tr> <td align="left" valign="top"><a href="phpdoc_packagelist.html">Packageindex</a></td> <td align="left" valign="top"><a href="phpdoc_classtree.html">Classtrees</a></td> Index: renderer/html/templates/module.html =================================================================== RCS file: /repository/pear/PHPDoc/renderer/html/templates/module.html,v retrieving revision 1.1 diff -u -r1.1 module.html --- renderer/html/templates/module.html 8 May 2001 04:48:39 -0000 1.1 +++ renderer/html/templates/module.html 12 Dec 2001 14:27:19 -0000 @@ -27,20 +27,13 @@ </tr> <tr> <td align="left" valign="top"> - File: <a href="file://{MODULE_FILE}">{MODULE_FILE}</a> - <h5>{APPNAME} - {MODULE_PACKAGE}</h5> + <h6>{MODULE_PACKAGE}</h6> <h1>{MODULE_GROUP}::{MODULE_NAME}</h1> - <p> - {MODULE_SHORTDESCRIPTION}{MODULE_UNDOC} - <p> - &nbsp; </td> </tr> <tr> <td align="left" valign="top"> <h4>{MODULE_ACCESS} module {MODULE_NAME}</h4> - {MODULE_SHORTDESCRIPTION} - <br> {MODULE_DESCRIPTION} <p> <table> @@ -78,7 +71,7 @@ <!-- BEGIN functionsummary_loop --> <tr> <td align="right" valign="top">{RETURNTYPE}</td> - <td align="left" valign="top" width="100%"><a href="#function_{NAME}()"><h4>{NAME}({PARAMETER})</h4></a>{SHORTDESCRIPTION}{UNDOC}</td> + <td align="left" valign="top" width="100%"><a href="#functions_{NAME}()" class="head">{NAME}({PARAMETER})</a><br />{SHORTDESCRIPTION}{UNDOC}<br /></td> </tr> <!-- END functionsummary_loop --> </table> @@ -90,11 +83,11 @@ <td align="left" valign="top"> <table width="100%" border="0"> <tr> - <td align="left" valign="top" colspan=3><h3>{ACCESS} Constant Summary</h3></td> + <td align="left" valign="top" colspan=3><h2>{ACCESS} Constant Summary</h2></td> </tr> <!-- BEGIN constantssummary_loop --> <tr> - <td align="left" valign="top"><a href="#constants_{NAME}">{NAME}</a></td> + <td align="left" valign="top"><a href="#consts_{NAME}">{NAME}</a></td> <td align="left" valign="top"> >><code>{VALUE}</code><< </td> <td align="left" valign="top" width="100%">{SHORTDESCRIPTION}{UNDOC}</td> </tr> @@ -108,7 +101,7 @@ <td align="left" valign="top"> <table width="100%" border="0"> <tr> - <td align="left" valign="top" colspan=2><h3>Included files Summary, Type: {TYPE}</h3></td> + <td align="left" valign="top" colspan=2><h2>Included files Summary, Type: {TYPE}</h2></td> </tr> <!-- BEGIN usessummary_loop --> <tr> @@ -128,7 +121,7 @@ <td colspan="2" align="left" valign="top"><h2>{ACCESS} Method Details</h2></td> </tr> <!-- BEGIN functiondetails_loop --> - <tr><td colspan="2" align="left" valign="top"><a name="function_{NAME}()"><h4>{NAME}</h4></a></td></tr> + <tr><td colspan="2" align="left" valign="top"><a name="functions_{NAME}()"><h4>{NAME}</h4></a></td></tr> <tr> <td colspan="2" align="left" valign="top"> <b>{ACCESS} {ABSTRACT} {STATIC} {FINAL} {RETURNTYPE} {NAME}( {PARAMETER} )</b><p> @@ -137,8 +130,6 @@ <tr> <td width="10" align="left" valign="top">&nbsp;</td> <td align="left" valign="top"> - {SHORTDESCRIPTION} - <br> {DESCRIPTION} <p> {UNDOC} @@ -268,12 +259,10 @@ <!-- BEGIN constantdetails_loop --> <tr> <td colspan="2" align="left" valign="top"> - <a name="constant_{NAME}"><h4>{NAME}</h4></a> + <a name="consts_{NAME}"><h4>{NAME}</h4></a> <code>define( {NAME}, >>{VALUE}<< )</code><br> Case: {CASE} <p> - {SHORTDESCRIPTION} - <br> {DESCRIPTION} </td> </tr> @@ -351,8 +340,6 @@ <td colspan="2" align="left" valign="top"> <b>{TYPE}( {FILE} )</b> <p> - {SHORTDESCRIPTION} - <br> {DESCRIPTION} </td> </tr> Index: xmlexporter/PhpdocXMLDocumentExporter.php =================================================================== RCS file: /repository/pear/PHPDoc/xmlexporter/PhpdocXMLDocumentExporter.php,v retrieving revision 1.1 diff -u -r1.1 PhpdocXMLDocumentExporter.php --- xmlexporter/PhpdocXMLDocumentExporter.php 8 May 2001 04:48:40 -0000 1.1 +++ xmlexporter/PhpdocXMLDocumentExporter.php 12 Dec 2001 14:27:23 -0000 @@ -209,7 +209,7 @@ /** * Adds a documentation block (author, links, see, params...) to the xml document * - * @param sarray + * @param array */ function docXML($data) {
« previous php.pear.dev (#3462) next »