Permalink
Browse files

New lines need to be preserved

Simple line returns still need to look proper - nl2br added
  • Loading branch information...
TeckniX committed Dec 14, 2012
1 parent 6b31c53 commit b6e26235f8a3b0252a08ba0adc7fe0a80afeb4cf
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Cake/View/Helper/TextHelper.php
@@ -242,7 +242,7 @@ public static function autoParagraph($text) {
$texts = preg_split('/\n\s*\n/', $text, -1, PREG_SPLIT_NO_EMPTY); // make paragraphs, including one at the end
$text = '';
foreach ( $texts as $txt )
- $text .= '<p>' . trim($txt, "\n") . "</p>\n";
+ $text .= '<p>' . nl2br(trim($txt, "\n")) . "</p>\n";
$text = preg_replace('|<p>\s*</p>|', '', $text); // Remove empty/whitespace <p> tags
}
return $text;

0 comments on commit b6e2623

Please sign in to comment.