Skip to content

Commit

Permalink
Preserve leading whitespace in pre and bc blocks. [#129 state:resolved]
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarber committed May 26, 2009
1 parent 56bd020 commit a9d5f73
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
2 changes: 2 additions & 0 deletions 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.
Expand Down
4 changes: 2 additions & 2 deletions ext/redcloth_scan/redcloth_scan.rl
Expand Up @@ -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+);
Expand Down
24 changes: 23 additions & 1 deletion spec/fixtures/basic.yml
Expand Up @@ -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>

0 comments on commit a9d5f73

Please sign in to comment.