Permalink
Browse files

Do not pre-pad list-like structures. Fixes #65.

Reverts a partial fix to #22 that aimed to allow looser recognition of
lists where a previous paragraph adjoined it without 2 newline
characters.
  • Loading branch information...
1 parent c975b74 commit 3c7653542a4d694d4575516474fd597bf16984f7 @netcarver committed Jul 19, 2012
Showing with 23 additions and 21 deletions.
  1. +8 −21 classTextile.php
  2. +15 −0 test/basic.yaml
View
@@ -5,9 +5,15 @@
*
* $textile = new Textile;
* echo $textile->TextileThis($string);
+ *
*/
/*
+$HeadURL$
+$LastChangedRevision$
+*/
+
+/*
_____________
T E X T I L E
@@ -378,7 +384,7 @@ class Textile
var $max_span_depth = 5;
var $ver = '2.4.0';
- var $rev = '$Rev: 3359 $';
+ var $rev = '$Rev$';
var $doc_root;
@@ -523,7 +529,6 @@ function TextileThis($text, $lite = '', $encode = '', $noimage = '', $strict = '
return $text;
} else {
if(!$strict) {
- $text = $this->prePadLists($text);
$text = $this->cleanWhiteSpace($text);
}
@@ -564,7 +569,6 @@ function TextileRestricted($text, $lite = 1, $noimage = 1, $rel = 'nofollow')
// escape any raw html
$text = $this->encode_html($text, 0);
- $text = $this->prePadLists($text);
$text = $this->cleanWhiteSpace($text);
if($lite) {
@@ -872,24 +876,6 @@ function fRCList($m)
return implode("\n", $out);
}
-// -------------------------------------------------------------
- function prePadLists($text)
- {
- $list_item = "[#*;:]+(?:_|[\d]+)?$this->lc[ .].*\n";
- $non_blank_lines = ".+\n";
- $text = preg_replace_callback(
- "/^(?:$list_item)(?:$non_blank_lines)*\n/m",
- array(&$this, "fPrePadLists"),
- $text."\n\n"
- );
- return $text;
- }
-
-// -------------------------------------------------------------
- function fPrePadLists($m)
- {
- return "\n".$m[0];
- }
// -------------------------------------------------------------
function lists($text)
@@ -2054,3 +2040,4 @@ function blockLite($text)
} // end class
+
View
@@ -943,6 +943,12 @@ Make sure these don't get turned into lists... :
*(class)Here is a class* that is a little extended and is
*followed* by a strong word!
+
+ bc. ; Content-type: text/javascript
+ ; Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0
+ ; Expires: Sat, 24 Jul 2003 05:00:00 GMT
+ ; Last-Modified: Wed, 1 Jan 2025 05:00:00 GMT
+ ; Pragma: no-cache
expect: |
<p><strong>Here is a comment</strong></p>
@@ -951,6 +957,13 @@ Make sure these don't get turned into lists... :
<p><strong class="class">Here is a class</strong> that is a little extended and is<br />
<strong>followed</strong> by a strong word!</p>
+ <pre><code>; Content-type: text/javascript
+ ; Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0
+ ; Expires: Sat, 24 Jul 2003 05:00:00 GMT
+ ; Last-Modified: Wed, 1 Jan 2025 05:00:00 GMT
+ ; Pragma: no-cache
+ </code></pre>
+
Basic Ordered List:
input: |
# Ordered
@@ -962,6 +975,7 @@ Basic Ordered List:
# ... aaaaand back out
p. And here we are with some _(alt)Other colours_
+
# red
## greeny
browny
@@ -1144,6 +1158,7 @@ Basic Unordered lists:
* and regulars
_colours_
+
* yellow
* cyan
expect: |

0 comments on commit 3c76535

Please sign in to comment.