[TxMt] <img> & <css> drag commands

Michael michael at stoichiometry.net
Tue Mar 29 14:49:14 UTC 2005


I was wondering if anyone had got the built-in HTML drag commands for 
<img> and <css> to work in Textmate 1b5?

Currently if I drag a html  or PDF file from the project window into a 
HTML file I'm working on it will create a <a href=""> link, but if I 
drag an image file or css file onto the HTML file, Textmate will insert 
the raw source of the dragged file.

Any ideas where I am going wrong? I am using the following drag 
commands (built-in):

<img>
File Types: png, PNG, jpeg, JPEG, jpg, JPG, gif, GIF
Commands: img=$TM_DROPPED_FILE alt=`echo $img | perl -pe 
's/^(.*\/)?(.*?)(\..*)?$/$2/g' | tr '_-' ' '` sips -g pixelWidth -g 
pixelHeight $img | awk '/pixelWidth/ { w=$2 } /pixelHeight/ { h=$2 } 
END { printf("<img src=\"'"$img"'\" width=\"%d\" height=\"%d\" 
alt=\"${0:'"$alt"'}\" />", w, h) }'

<css>
File Types: css
echo "<link href=\"$TM_DROPPED_FILE\" rel=\"stylesheet\" 
type=\"text/css\" />"

Apologies if this has already been covered.

Mike




More information about the textmate mailing list