Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Preserve leading whitespace in pre and bc blocks. [#129 state:resolved]

  • Loading branch information...
commit a9d5f73294e8a6e76d3f7cb82d2b3d8ed8e3f9a3 1 parent 56bd020
@jgarber authored
View
2  CHANGELOG
@@ -1,5 +1,7 @@
=== Edge
+* Preserve leading whitespace in pre and bc blocks. [Jason Garber]
+
* Don't add hard break after preexisting <br />. [Jason Garber]
* Change to list attributes so you can give style/class to list items (taken from PyTextile). Breaks backwards compatibility.
View
4 ext/redcloth_scan/redcloth_scan.rl
@@ -13,8 +13,8 @@
notextile_block_start = ( "notextile" >A %{ STORE("type"); } A C :> "." ( "." %extend | "" ) " "+ ) %SET_ATTR ;
pre_tag_start = "<pre" [^>]* ">" (space* code_tag_start)? ;
pre_tag_end = (code_tag_end space*)? "</pre>" LF? ;
- pre_block_start = ( "pre" >A %{ STORE("type"); } A C :> "." ( "." %extend | "" ) " "+ ) %SET_ATTR ;
- bc_start = ( "bc" >A %{ STORE("type"); } A C :> "." ( "." %extend | "" ) " "+ ) %SET_ATTR ;
+ pre_block_start = ( "pre" >A %{ STORE("type"); } A C :> "." ( "." %extend | "" ) " " ) %SET_ATTR ;
+ bc_start = ( "bc" >A %{ STORE("type"); } A C :> "." ( "." %extend | "" ) " " ) %SET_ATTR ;
bq_start = ( "bq" >A %{ STORE("type"); } A C :> "." ( "." %extend | "" ) ( ":" %A uri %{ STORE("cite"); } )? " "+ ) %SET_ATTR ;
non_ac_btype = ( "bq" | "bc" | "pre" | "notextile" | "table" );
btype = (alpha alnum*) -- (non_ac_btype | "fn" digit+);
View
24 spec/fixtures/basic.yml
@@ -937,4 +937,26 @@ html: |-
---
name: lang attribute cannot contain square brackets
in: "some @[[code]]@"
-html: "<p>some <code>[[code]]</code></p>"
+html: "<p>some <code>[[code]]</code></p>"
+---
+name: pre blocks preserve leading whitespace
+in: |-
+ pre. Text in a pre block
+ is displayed in a fixed-width
+ font. It preserves
+ s p a c e s, line breaks
+ and ascii bunnies.
+html: |-
+ <pre> Text in a pre block
+ is displayed in a fixed-width
+ font. It preserves
+ s p a c e s, line breaks
+ and ascii bunnies.</pre>
+---
+name: code blocks preserve leading whitespace
+in: |-
+ bc. false
+ } else {
+html: |-
+ <pre><code> false
+ } else {</code></pre>
Please sign in to comment.
Something went wrong with that request. Please try again.