PHPDoc eats my descriptions! :-)
| From: | Martin Geisler | Date: | Wed, 11 Jul 2001 22:31:11 +0000 |
| Subject: | PHPDoc eats my descriptions! :-) | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-641@lists.php.net to get a copy of this message | ||
Hi!
I'm having some problems with PHPDoc. Actually I have two problems,
one of which I've managed to solve:
1) The first word of the description of a parameter disappears. So
@param string This is a string
becomes
<parameter name="$foot" type="string">is a string</parameter>
in the XML file. I haven't been able to find the place in the code
where this happens.
2) I want to word-wrap the long lines like this:
/**
* This is a short description. It spans
* several lines.
*
* This is a long description that spans
* several lines.
*
* The long description it self is split
* up into several paragraphs.
*
* @param mixed foo
*/
The difference is, that I don't think that a single newline should
terminate the short description. Instead, it should work like in
LaTeX where you have to use two or more newlines to end the current
paragraph.
I modified getDescription() in PhpdocParserCore.php and have
attached a patch below.
467,484c467,492
<
< $lines = split($this->PHP_BASE["break"], $desc);
<
< if (1 == count($lines) || "" == $desc) {
<
< // only a short description but no long description - or even none of both
< $description = array ($desc, "");
<
< } else {
<
< $sdesc = trim($lines[0]);
< unset($lines[0]);
<
< $description = array ($sdesc, implode($this->PHP_BASE["break"],
$lines));
<
< }
<
< return $description;
---
>
> /* The following code collapses multiple empty lines
> into just one, just as LaTeX would have done. This
> means that the short description can be split over
> multiple lines.
>
> by Martin Geisler <gimpster@gimpster.com> */
>
> $split = split($this->PHP_BASE['break'] .
> $this->PHP_BASE['break'] . '+',
> $desc, 2);
> $sdesc = $split[0];
> if (count($split) == 1) {
> $desc = '';
> } else {
> $desc = $split[1];
> }
>
> $desc = ereg_replace($this->PHP_BASE['break'] .
> $this->PHP_BASE['break'] .
> $this->PHP_BASE['break'] . '+',
> $this->PHP_BASE['break'] .
> $this->PHP_BASE['break'],
> $desc);
> return array($sdesc, $desc);
>
--
Best regards,
Martin Geisler
Checkout http://www.gimpster.com for:
PHP Weather => Shows the current weather on your webpages.
PHP Shell => A telnet-connection (almost :-) in a PHP page.