Changeset 261
- Timestamp:
- 03/10/2008 14:59:10 (8 months ago)
- Location:
- branches/superredcloth
- Files:
-
- 2 modified
-
ext/superredcloth_scan/superredcloth_scan.rl (modified) (2 diffs)
-
lib/superredcloth.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/superredcloth/ext/superredcloth_scan/superredcloth_scan.rl
r260 r261 47 47 link_alias = ( "[" >{ ASET(type, ignore) } %A phrase %T "]" %A uri %{ STORE_URL(href); } ) ; 48 48 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 49 54 # html blocks 50 55 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"); … … 152 157 table { INLINE(table, table_close); DONE(table); fgoto block; }; 153 158 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; }; 154 160 blank_line => cat; 155 161 default -
branches/superredcloth/lib/superredcloth.rb
r251 r261 131 131 132 132 def image(opts) 133 p_opts = {:float => opts.delete(:align)} if opts[:align]133 opts.delete(:align) 134 134 opts[:alt] = opts[:title] 135 135 img = "<img src=\"#{urlesc opts[:src]}\"#{pba(opts)} alt=\"#{opts[:alt]}\" />" 136 136 img = "<a href=\"#{urlesc opts[:href]}\">#{img}</a>" if opts[:href] 137 img = "<p#{pba(p_opts)}>#{img}</p>" if p_opts138 137 img 139 138 end