Changeset 261

Show
Ignore:
Timestamp:
03/10/2008 14:59:10 (8 months ago)
Author:
jgarber
Message:

Make image alignment trigger parent paragraph's float style.

Location:
branches/superredcloth
Files:
2 modified

Legend:

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

    r260 r261  
    4747  link_alias = ( "[" >{ ASET(type, ignore) } %A phrase %T "]" %A uri %{ STORE_URL(href); } ) ; 
    4848   
     49  # image lookahead 
     50  IMG_A_LEFT = "<" %{ ASET(float, left) } ; 
     51  IMG_A_RIGHT = ">" %{ ASET(float, right) } ; 
     52  aligned_image = ( "["? "!" (IMG_A_LEFT | IMG_A_RIGHT) ) >A @{ p = reg - 1; } ; 
     53   
    4954  # html blocks 
    5055  BlockTagName = Name* - ("pre" | "notextile" | "a" | "applet" | "basefont" | "bdo" | "br" | "font" | "iframe" | "img" | "map" | "object" | "param" | "q" | "script" | "span" | "sub" | "sup" | "abbr" | "acronym" | "cite" | "code" | "del" | "dfn" | "em" | "ins" | "kbd" | "samp" | "strong" | "var" | "b" | "big" | "i" | "s" | "small" | "strike" | "tt" | "u"); 
     
    152157    table           { INLINE(table, table_close); DONE(table); fgoto block; }; 
    153158    link_alias      { rb_hash_aset(refs_found, rb_hash_aref(regs, ID2SYM(rb_intern("text"))), rb_hash_aref(regs, ID2SYM(rb_intern("href")))); DONE(block); }; 
     159    aligned_image   { rb_hash_aset(regs, ID2SYM(rb_intern("type")), plain_block); fgoto block; }; 
    154160    blank_line => cat; 
    155161    default 
  • branches/superredcloth/lib/superredcloth.rb

    r251 r261  
    131131   
    132132  def image(opts) 
    133     p_opts = {:float => opts.delete(:align)} if opts[:align] 
     133    opts.delete(:align) 
    134134    opts[:alt] = opts[:title] 
    135135    img = "<img src=\"#{urlesc opts[:src]}\"#{pba(opts)} alt=\"#{opts[:alt]}\" />"   
    136136    img = "<a href=\"#{urlesc opts[:href]}\">#{img}</a>" if opts[:href] 
    137     img = "<p#{pba(p_opts)}>#{img}</p>" if p_opts 
    138137    img 
    139138  end