Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<code> block not honoured #62

Open
wdoekes opened this issue Mar 2, 2012 · 0 comments
Open

<code> block not honoured #62

wdoekes opened this issue Mar 2, 2012 · 0 comments

Comments

@wdoekes
Copy link

wdoekes commented Mar 2, 2012

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 --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 <code> 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 = '<p>'.str_replace("\n\n", '</p><p>', $this->toPlainText($text)).'</p>';
+            $text = preg_replace("/[ \t\r]+\n/", "\n", $text); // trim only trailing WS
+            $text = '<p>'.str_replace("\n\n", '</p><p>', $text).'</p>';
             $text = str_replace('<ul>', "</p>\n<ul>", $text);
             $text = str_replace('</ul>', "</ul>\n<p>", $text);
-            $text = $this->_removeWhitespace($text);
             return $text;
         }

Regards,
Walter Doekes
OSSO B.V.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant