From 9907df45d0003dee39480f4ea66004b2922b69c7 Mon Sep 17 00:00:00 2001
From: Rick Ellis
Date: Fri, 12 Sep 2008 07:22:21 +0000
Subject: Continued working on typography class and docs
---
system/application/config/config.php | 2 +-
system/helpers/typography_helper.php | 21 +++------------------
system/libraries/Typography.php | 34 ++++++++++++++++++++++++++++++++++
user_guide/libraries/parser.html | 2 +-
user_guide/libraries/unit_testing.html | 2 +-
user_guide/nav/nav.js | 1 +
user_guide/toc.html | 1 +
7 files changed, 42 insertions(+), 21 deletions(-)
diff --git a/system/application/config/config.php b/system/application/config/config.php
index 71ebd30d0..7dc6151ee 100644
--- a/system/application/config/config.php
+++ b/system/application/config/config.php
@@ -11,7 +11,7 @@
| http://example.com/
|
*/
-$config['base_url'] = "";
+$config['base_url'] = "http://127.0.0.1/EllisLab/_Development/CodeIgniter/";
/*
|--------------------------------------------------------------------------
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php
index 2c5c588bc..11acea1f7 100644
--- a/system/helpers/typography_helper.php
+++ b/system/helpers/typography_helper.php
@@ -38,26 +38,11 @@ if ( ! function_exists('nl2br_except_pre'))
{
function nl2br_except_pre($str)
{
- $ex = explode("pre>",$str);
- $ct = count($ex);
+ $CI =& get_instance();
- $newstr = "";
- for ($i = 0; $i < $ct; $i++)
- {
- if (($i % 2) == 0)
- {
- $newstr .= nl2br($ex[$i]);
- }
- else
- {
- $newstr .= $ex[$i];
- }
+ $CI->load->library('typography');
- if ($ct - 1 != $i)
- $newstr .= "pre>";
- }
-
- return $newstr;
+ return $CI->typography->nl2br_except_pre($str);
}
}
diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php
index b058fdab9..dd5f928d9 100644
--- a/system/libraries/Typography.php
+++ b/system/libraries/Typography.php
@@ -286,6 +286,40 @@ class CI_Typography {
{
$this->reduce_empty_lines = ($val === FALSE) ? FALSE : TRUE;
}
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * Convert newlines to HTML line breaks except within PRE tags
+ *
+ * @access public
+ * @param string
+ * @return string
+ */
+ function nl2br_except_pre($str)
+ {
+ $ex = explode("pre>",$str);
+ $ct = count($ex);
+
+ $newstr = "";
+ for ($i = 0; $i < $ct; $i++)
+ {
+ if (($i % 2) == 0)
+ {
+ $newstr .= nl2br($ex[$i]);
+ }
+ else
+ {
+ $newstr .= $ex[$i];
+ }
+
+ if ($ct - 1 != $i)
+ $newstr .= "pre>";
+ }
+
+ return $newstr;
+ }
+
}
// END Typography Class
diff --git a/user_guide/libraries/parser.html b/user_guide/libraries/parser.html
index 5743d2dec..7d6b2afa5 100644
--- a/user_guide/libraries/parser.html
+++ b/user_guide/libraries/parser.html
@@ -199,7 +199,7 @@ Previous Topic: Trackback Class
·
Top of Page ·
User Guide Home ·
-Next Topic: Unit Testing Class
+Next Topic: Typography
CodeIgniter · Copyright © 2006-2008 · Ellislab, Inc.
diff --git a/user_guide/libraries/unit_testing.html b/user_guide/libraries/unit_testing.html
index ffb3d95c3..376323272 100644
--- a/user_guide/libraries/unit_testing.html
+++ b/user_guide/libraries/unit_testing.html
@@ -192,7 +192,7 @@ $this->unit->set_template($str);