Changeset 253

Show
Ignore:
Timestamp:
03/07/2008 15:23:23 (9 months ago)
Author:
jgarber
Message:

Allow "tight" links and images (no space surrounding) per Textile2. (Requires scanner leaving actions capability found in Ragel trunk, which will become 6.1 shortly)
Finally got rid of weird p++ and p-- in STORE_URL.

Location:
branches/superredcloth/ext/superredcloth_scan
Files:
2 modified

Legend:

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

    r247 r253  
    5353#define STORE_URL(T) \ 
    5454  if (p > reg && reg >= ts) { \ 
    55     p++; \ 
    5655    char punct = 1; \ 
    5756    while (p > reg && punct == 1) { \ 
     
    6766  } \ 
    6867  STORE(T); \ 
    69   p--; \ 
    7068  if ( !NIL_P(refs) && rb_funcall(refs, rb_intern("has_key?"), 1, rb_hash_aref(regs, ID2SYM(rb_intern(#T)))) ) { \ 
    7169    rb_hash_aset(regs, ID2SYM(rb_intern(#T)), rb_hash_aref(refs, rb_hash_aref(regs, ID2SYM(rb_intern(#T))))); \ 
  • branches/superredcloth/ext/superredcloth_scan/superredcloth_inline.rl

    r247 r253  
    2323  # links 
    2424  link_says = ( mtext+ ) >A %{ STORE(name) } ; 
    25   link = ( '"' C "."* " "* link_says " "* :> title? :> '":' %A uri ) >X ; 
     25  link = ( "["? '"' C "."* " "* link_says " "* :> title? :> '":' %A uri %{ STORE_URL(href); } :> "]"? ) >X ; 
    2626 
    2727  # images 
    2828  image_src = ( uri ) >A %{ STORE(src) } ; 
    2929  image_is = ( A2 C "."* image_src :> title? ) ; 
    30   image_link = ( ":" uri ) ; 
    31   image = ( "!" image_is "!" %A image_link? ) >X ; 
     30  image_link = ( ":" uri >A %{ STORE_URL(href); } ) ; 
     31  image = ( "["? "!" image_is "!" %A image_link? "]"? ) >X ; 
    3232 
    3333  # footnotes 
     
    7474  main := |* 
    7575 
    76     image { if ( *reg == ':') { reg += 1; STORE_URL(href); } INLINE(block, image); }; 
    77  
    78     link { STORE_URL(href); PASS(block, name, link); }; 
     76    image { INLINE(block, image); }; 
     77 
     78    link { PASS(block, name, link); }; 
    7979 
    8080    code { PASS_CODE(block, text, code); };