peej/phpdoctor — Issue #62: <code> block not honoured
Author: wdoekes
Created: 2012-03-02 09:20:42+00:00
State: open

I see that the \ block does (a) not get a \

-style layout and (b) gets whitespace trimmed.

Here is a suboptimal, yet working, fix. All that whitespace trimming that you were doing is not really needed for html, and not doing that keeps the \ blocks looking like they should.

```diff
diff --git a/doclets/standard/stylesheet.css b/doclets/standard/stylesheet.css
index ec4b868..871e275 100644
--- a/doclets/standard/stylesheet.css
+++ b/doclets/standard/stylesheet.css
@@ -196,6 +196,11 @@ code.signature {
margin: 10px 0;
}

+/* Inline blocks in descriptions */
+div.comment p code {
+ white-space: pre;
+}
+
div.details {
margin: 10px 0 10px 20px;
}
diff --git a/formatters/htmlStandardFormatter.php b/formatters/htmlStandardFormatter.php
index 69ccc61..7d314fa 100644
--- a/formatters/htmlStandardFormatter.php
+++ b/formatters/htmlStandardFormatter.php
@@ -13,10 +13,10 @@
function toFormattedText($text)
{
$text = $this->_addListMarkupUL($text);
- $text = '

'.str_replace("\n\n", '

', $this->toPlainText($text)).'

';
+ $text = preg_replace("/[ \t\r]+\n/", "\n", $text); // trim only trailing WS
+ $text = '

'.str_replace("\n\n", '

', $text).'

';
$text = str_replace('

', "

\n

", $text);
$text = str_replace('

', "

\n

", $text);
- $text = $this->_removeWhitespace($text);
return $text;
}

```

Regards,
Walter Doekes
OSSO B.V.