summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorRick Ellis <rick.ellis@ellislab.com>2008-09-11 23:35:39 +0200
committerRick Ellis <rick.ellis@ellislab.com>2008-09-11 23:35:39 +0200
commit3ef59b7831f2eb6abff5ec255615b66b36e62797 (patch)
treecfd6ee8864e58e36e7901d1fb1f134f1a8575767 /system
parent25319a35d0bb35bd260b06b4253f31c7a4323673 (diff)
more tweaks!
Diffstat (limited to 'system')
-rw-r--r--system/libraries/Typography.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php
index 908f42032..66c21853d 100644
--- a/system/libraries/Typography.php
+++ b/system/libraries/Typography.php
@@ -30,7 +30,7 @@ class CI_Typography {
var $block_elements = 'p|div|blockquote|pre|code|h\d|script|ol|ul';
// Elements that should not have <p> and <br /> tags within them.
- var $skip_elements = 'pre|ol|ul|p';
+ var $skip_elements = 'p|pre|ol|ul';
// Tags we want the parser to completely ignore when splitting the string.
var $ignore_elements = 'a|b|i|em|strong|span|img|li';
@@ -102,21 +102,22 @@ class CI_Typography {
// Build our finalized string. We cycle through the array, skipping tags, and processing the contained text
$str = '';
$process = TRUE;
+ $paragraph = FALSE;
foreach ($chunks as $chunk)
{
// Are we dealing with a tag? If so, we'll skip the processing for this cycle.
// Well also set the "process" flag which allows us to skip <pre> tags and a few other things.
if (preg_match("#<(/*)(".$this->block_elements.").*?\>#", $chunk, $match))
{
- if (preg_match("#".$this->skip_elements."#", $match['2']))
+ if (preg_match("#".$this->skip_elements."#", $match[2]))
{
- $process = ($match['1'] == '/') ? TRUE : FALSE;
+ $process = ($match[1] == '/') ? TRUE : FALSE;
}
-
+
$str .= $chunk;
continue;
}
-
+
if ($process == FALSE)
{
$str .= $chunk;
@@ -129,7 +130,7 @@ class CI_Typography {
// Convert Quotes, elipsis, and em-dashes
$str = $this->format_characters($str);
-
+
// Do we need to reduce empty lines?
if ($this->reduce_empty_lines == TRUE)
{
@@ -231,7 +232,7 @@ class CI_Typography {
{
return $str;
}
-
+
$str = str_replace("\n\n", "</p>\n\n<p>", $str);
$str = preg_replace("/([^\n])(\n)([^\n])/", "\\1<br />\\2\\3", $str);