Changeset 193
- Timestamp:
- 12/18/2007 07:22:19 (11 months ago)
- Location:
- branches/superredcloth
- Files:
-
- 4 modified
-
ext/superredcloth_scan/superredcloth.h (modified) (1 diff)
-
ext/superredcloth_scan/superredcloth_inline.rl (modified) (1 diff)
-
ext/superredcloth_scan/superredcloth_scan.rl (modified) (3 diffs)
-
test/code.yml (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/superredcloth/ext/superredcloth_scan/superredcloth.h
r190 r193 26 26 #define PASS2(H, A, T) rb_str_append(H, red_pass2(rb_formatter, regs, ID2SYM(rb_intern(#A)), ID2SYM(rb_intern(#T)))) 27 27 #define ADD_BLOCK() rb_str_append(html, red_block(rb_formatter, regs, block)); CLEAR(block); regs = rb_hash_new() 28 #define ADD_BLOCKCODE() rb_str_append(html, red_blockcode(rb_formatter, regs, block)); CLEAR(block); regs = rb_hash_new() 28 29 #define ASET(T, V) rb_hash_aset(regs, ID2SYM(rb_intern(#T)), rb_str_new2(#V)); 29 30 #define AINC(T) red_inc(regs, ID2SYM(rb_intern(#T))); -
branches/superredcloth/ext/superredcloth_scan/superredcloth_inline.rl
r176 r193 169 169 } 170 170 171 VALUE 172 red_blockcode(VALUE rb_formatter, VALUE regs, VALUE block) 173 { 174 VALUE btype = rb_hash_aref(regs, ID2SYM(rb_intern("type"))); 175 block = rb_funcall(block, rb_intern("strip"), 0); 176 if (RSTRING(block)->len > 0) 177 { 178 rb_hash_aset(regs, ID2SYM(rb_intern("text")), block); 179 block = rb_funcall(rb_formatter, rb_intern(RSTRING(btype)->ptr), 1, regs); 180 } 181 return block; 182 } 183 171 184 void 172 185 red_inc(VALUE regs, VALUE ref) -
branches/superredcloth/ext/superredcloth_scan/superredcloth_scan.rl
r190 r193 28 28 pre_start = "<pre" [^>]* ">" ; 29 29 pre_end = "</pre>" ; 30 bc_start = ( "bc" A C :> "." ( "." %extend | "" %no_extend ) " "+ ) ; 30 31 btype = ( "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "bq" | "bc" | "pre" | "notextile" | "div" ) >A %{ STORE(type) } ; 31 32 block_start = ( btype A C :> "." ( "." %extend | "" %no_extend ) " "+ ) ; … … 48 49 table = ( tdef? trows >{INLINE(table, table_open);} ) >{ reg = NULL; } ; 49 50 51 bc := |* 52 block_end { ADD_BLOCKCODE(); fgoto main; }; 53 default => cat; 54 *|; 55 50 56 pre := |* 51 pre_end { DONE(block); fgoto main; };57 pre_end { DONE(block); fgoto main; }; 52 58 default => cat; 53 59 *|; … … 76 82 main := |* 77 83 notextile_start { ASET(type, notextile); fgoto notextile; }; 84 bc_start { ASET(type, bc); fgoto bc; }; 78 85 block_start { fgoto block; }; 79 86 footnote_start { fgoto footnote; }; -
branches/superredcloth/test/code.yml
r180 r193 97 97 98 98 bc. __not italics__ 99 100 <pre><code>__also not italics__</code></pre> 99 101 out: |- 100 102 <p><i>italics</i></p> 101 103 102 104 <pre><code>__not italics__</code></pre> 105 106 <pre><code>__also not italics__</code></pre> 103 107 --- 104 108 in: |- … … 118 122 in: |- 119 123 bc. <hello> 124 120 125 <code> <hello> </code> 121 126 out: |- 122 <pre><code> <hello> </code></pre> 123 <code> <hello> </code> 127 <pre><code><hello></code></pre> 128 129 <p><code> <hello> </code></p> 124 130 --- 125 131 in: |- … … 154 160 out: |- 155 161 <ul> 156 <li>You can put <span class="caps">HTML</span>code</li>162 <li>You can put HTML code</li> 157 163 <li>right in Textile</li> 158 164 <li>and it will not put a break<br /> 159 between <span class="caps">HTML</span>elements</li>165 between HTML elements</li> 160 166 <li>or wrap it in a p tag</li> 161 167 </ul>