diff --git a/CHANGELOG b/CHANGELOG index 9d55e883..d9ab7bc2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,6 +20,8 @@ * Fixed behavior of unclosed (multi-paragraph) quotes and incorrect handling of links inside double quotations. #59, #63 +* Fixed empty block HTML disappearing. #64 + *4.0.3 (August 18, 2008)* diff --git a/ext/redcloth_scan/redcloth_inline.rl b/ext/redcloth_scan/redcloth_inline.rl index bd912880..43db672d 100644 --- a/ext/redcloth_scan/redcloth_inline.rl +++ b/ext/redcloth_scan/redcloth_inline.rl @@ -206,7 +206,7 @@ red_block(VALUE self, VALUE regs, VALUE block, VALUE refs) VALUE sym_text = ID2SYM(rb_intern("text")); VALUE btype = rb_hash_aref(regs, ID2SYM(rb_intern("type"))); block = rb_funcall(block, rb_intern("strip"), 0); - if ((RSTRING_LEN(block) > 0) && !NIL_P(btype)) + if ((!NIL_P(block)) && !NIL_P(btype)) { method = rb_intern(RSTRING_PTR(btype)); if (method == rb_intern("notextile")) { diff --git a/ext/redcloth_scan/redcloth_scan.rl b/ext/redcloth_scan/redcloth_scan.rl index bde01673..c00f682d 100644 --- a/ext/redcloth_scan/redcloth_scan.rl +++ b/ext/redcloth_scan/redcloth_scan.rl @@ -296,7 +296,7 @@ int SYM_escape_preformatted, SYM_escape_attributes; dl := |* LF dt_start { ADD_BLOCK(); ASET(type, dt); }; dd_start { ADD_BLOCK(); ASET(type, dd); }; - long_dd { INLINE(html, dd); }; + long_dd { INLINE(html, dd); CLEAR_REGS(); }; block_end { ADD_BLOCK(); INLINE(html, dl_close); fgoto main; }; default => cat; *|; diff --git a/test/html.yml b/test/html.yml index 77e951c3..085a7379 100644 --- a/test/html.yml +++ b/test/html.yml @@ -296,4 +296,10 @@ html: |- --- name: tilde in innerHTML is not altered in: 'http://foo.com/bar?something=1~2~3' -html: '

http://foo.com/bar?something=1~2~3

' \ No newline at end of file +html: '

http://foo.com/bar?something=1~2~3

' +--- +name: empty block +in: |- + +html: |- +