Skip to content

Commit

Permalink
Remove extra preformatted line breaks after extended block code.
Browse files Browse the repository at this point in the history
This change makes it compatible with Textile 2 [#79 state:resolved]
  • Loading branch information
jgarber committed Feb 12, 2009
1 parent 66f04a1 commit 83b8382
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
@@ -1,5 +1,7 @@
=== Edge

* Remove extra preformatted line breaks after extended block code. #79

* Fix inline <notextile> being recognized as block <notextile>. #81

* Allow leading spaces on lists for backward compatibility with RedCloth 3.x. #89
Expand Down
1 change: 1 addition & 0 deletions ext/redcloth_scan/redcloth.h
Expand Up @@ -36,6 +36,7 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
#define RESET_REG() reg = NULL
#define CAT(H) rb_str_cat(H, ts, te-ts)
#define CLEAR(H) H = rb_str_new2("")
#define RSTRIP_BANG(H) rb_funcall(H, rb_intern("rstrip!"), 0)
#define SET_PLAIN_BLOCK(T) plain_block = rb_str_new2(T)
#define RESET_TYPE(T) rb_hash_aset(regs, ID2SYM(rb_intern("type")), plain_block)
#define INLINE(H, T) rb_str_append(H, rb_funcall(self, rb_intern(T), 1, regs))
Expand Down
4 changes: 4 additions & 0 deletions ext/redcloth_scan/redcloth_scan.java.rl
Expand Up @@ -242,6 +242,10 @@ public class RedclothScanService implements BasicLibraryService {
((RubyString)H).append(self.callMethod(runtime.getCurrentContext(), T, regs));
}

public void RSTRIP_BANG(IRubyObject H) {
((RubyString)H).callMethod(runtime.getCurrentContext(), "rstrip!");
}

public void DONE(IRubyObject H) {
((RubyString)html).append(H);
CLEAR(H);
Expand Down
1 change: 1 addition & 0 deletions ext/redcloth_scan/redcloth_scan.rl
Expand Up @@ -172,6 +172,7 @@
} else {
ADD_EXTENDED_BLOCKCODE();
CAT(html);
RSTRIP_BANG(html);
INLINE(html, "bc_close");
SET_PLAIN_BLOCK("p");
END_EXTENDED();
Expand Down
8 changes: 2 additions & 6 deletions test/code.yml
Expand Up @@ -143,9 +143,7 @@ html: |-
<pre><code>./foo.pl%
&lt;p&gt;foo outputs an HTML paragraph&lt;/p&gt;</code>
<code>&lt;p&gt;block of code keeps going until a different block signature is encountered&lt;/p&gt;</code>
</pre>
<code>&lt;p&gt;block of code keeps going until a different block signature is encountered&lt;/p&gt;</code></pre>
<p>And then go back with a normal paragraph.</p>
---
name: extended block code preserves leading whitespace after blank line
Expand All @@ -170,9 +168,7 @@ html: |-
<code> def baz
'baz'
end
end</code>
</pre>
end</code></pre>
<p>That&#8217;s it!</p>
---
name: block code containing code avoids nesting code tags
Expand Down
4 changes: 1 addition & 3 deletions test/threshold.yml
Expand Up @@ -373,9 +373,7 @@ html: |-
<code>print "Hello, World";
}
?&gt;</code>
</pre>
?&gt;</code></pre>
<p>Following paragraph.</p>
---
name: extended block attributes
Expand Down

0 comments on commit 83b8382

Please sign in to comment.