From 9da2ee9155eb8694f06a125ac1bec166e9071ac8 Mon Sep 17 00:00:00 2001
From: Rick Ellis tags
- var $block_elements = 'p|div|blockquote|pre|code|h\d|script|ol|ul';
+ var $block_elements = 'p|div|blockquote|pre|code|h\d|script|ol|ul|dl|dt|dd';
// Elements that should not have and /' => '$1', // )+#' => '
tags within them.
- var $skip_elements = 'p|pre|ol|ul';
+ var $skip_elements = 'p|pre|ol|ul|dl';
// Tags we want the parser to completely ignore when splitting the string.
var $ignore_elements = 'a|b|i|em|strong|span|img|li';
@@ -154,7 +154,7 @@ class CI_Typography {
'/(
)+/' => '
', // Clean up stray paragraph tags that appear before block level elements @@ -260,11 +260,21 @@ class CI_Typography { { return $str; } - - $str = str_replace("\n\n", "
\n\n", $str); + + // Convert two consecutive newlines to paragraphs + $str = str_replace("\n\n", "
\n\n", $str);
+
+ // Convert single spaces to
tags
$str = preg_replace("/([^\n])(\n)([^\n])/", "\\1
\\2\\3", $str);
- return '
'.$str.'
'; + // Wrap the whole enchilada in enclosing paragraphs + $str = ''.$str.'
'; + + // Remove empty paragraphs if they are on the first line, as this + // is a potential unintended consequence of the previous code + $str = preg_replace("/<\/p>(.*)/", "\\1", $str, 1); + + return $str; } // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b