Changeset 193

Show
Ignore:
Timestamp:
12/18/2007 07:22:19 (11 months ago)
Author:
jgarber
Message:

Don't inline format contents of blockcode (bc.).

Location:
branches/superredcloth
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/superredcloth/ext/superredcloth_scan/superredcloth.h

    r190 r193  
    2626#define PASS2(H, A, T) rb_str_append(H, red_pass2(rb_formatter, regs, ID2SYM(rb_intern(#A)), ID2SYM(rb_intern(#T)))) 
    2727#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() 
    2829#define ASET(T, V)     rb_hash_aset(regs, ID2SYM(rb_intern(#T)), rb_str_new2(#V)); 
    2930#define AINC(T)        red_inc(regs, ID2SYM(rb_intern(#T))); 
  • branches/superredcloth/ext/superredcloth_scan/superredcloth_inline.rl

    r176 r193  
    169169} 
    170170 
     171VALUE 
     172red_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 
    171184void 
    172185red_inc(VALUE regs, VALUE ref) 
  • branches/superredcloth/ext/superredcloth_scan/superredcloth_scan.rl

    r190 r193  
    2828  pre_start = "<pre" [^>]* ">" ; 
    2929  pre_end = "</pre>" ; 
     30  bc_start = ( "bc" A C :> "." ( "." %extend | "" %no_extend ) " "+ ) ; 
    3031  btype = ( "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "bq" | "bc" | "pre" | "notextile" | "div" ) >A %{ STORE(type) } ; 
    3132  block_start = ( btype A C :> "." ( "." %extend | "" %no_extend ) " "+ ) ; 
     
    4849  table = ( tdef? trows >{INLINE(table, table_open);} ) >{ reg = NULL; } ; 
    4950 
     51  bc := |* 
     52    block_end       { ADD_BLOCKCODE(); fgoto main; }; 
     53    default => cat; 
     54  *|; 
     55 
    5056  pre := |* 
    51     pre_end        { DONE(block); fgoto main; }; 
     57    pre_end         { DONE(block); fgoto main; }; 
    5258    default => cat; 
    5359  *|; 
     
    7682  main := |* 
    7783    notextile_start { ASET(type, notextile); fgoto notextile; }; 
     84    bc_start        { ASET(type, bc); fgoto bc; }; 
    7885    block_start     { fgoto block; }; 
    7986    footnote_start  { fgoto footnote; }; 
  • branches/superredcloth/test/code.yml

    r180 r193  
    9797   
    9898  bc. __not italics__ 
     99   
     100  <pre><code>__also not italics__</code></pre> 
    99101out: |- 
    100102  <p><i>italics</i></p> 
    101103   
    102104  <pre><code>__not italics__</code></pre> 
     105   
     106  <pre><code>__also not italics__</code></pre> 
    103107--- 
    104108in: |- 
     
    118122in: |- 
    119123  bc. <hello> 
     124   
    120125  <code> <hello> </code> 
    121126out: |- 
    122   <pre><code> &lt;hello&gt; </code></pre> 
    123   <code> &lt;hello&gt; </code> 
     127  <pre><code>&lt;hello&gt;</code></pre> 
     128   
     129  <p><code> &lt;hello&gt; </code></p> 
    124130--- 
    125131in: |- 
     
    154160out: |- 
    155161  <ul> 
    156     <li>You can put <span class="caps">HTML</span> code</li> 
     162    <li>You can put HTML code</li> 
    157163    <li>right in Textile</li> 
    158164    <li>and it will not put a break<br /> 
    159     between <span class="caps">HTML</span> elements</li> 
     165    between HTML elements</li> 
    160166    <li>or wrap it in a p tag</li> 
    161167  </ul>