With a selection of "x.jpg", I'd like a snippet for the html context that can insert
<img src="x.jpg" alt=" x.jpg" width="164" height="234" border="0" class="box1">
I have a snippet that works:
<img src="${1:${TM_SELECTED_TEXT:TM_CURRENT_WORD}}" width="$2" height="$3" border="${4:0}" class="$5">
but it only uses default values for width and height. Are there shell options to get these?
Thanks for the help, tim
PS: if you find yourself making lists out of lines of text, this helps me
<${1:ol}> ${TM_SELECTED_TEXT/(^.+$)/\t<li>$1</li>/g} </$1>
The secret of success is constancy to purpose. Benjamin Disraeli
On 7/4/2006, at 19:05, Timothy Bates wrote:
With a selection of "x.jpg", I'd like a snippet for the html context that can insert
<img src="x.jpg" alt=" x.jpg" width="164" height="234" border="0" class="box1">
In the HTML bundle there is a drag command which is named “Insert Image With Dimensions”.
This does it, but for dropped images. You can create a new command (which has input set to none, and output set to discard), then copy the code from the drag command, but change the first line to:
img="${TM_SELECTED_TEXT}"
It may need a few more tweaks, but it basically does 99% of what you need. It also constructs the alt-text from the image name.
PS: if you find yourself making lists out of lines of text, this helps me
<${1:ol}> ${TM_SELECTED_TEXT/(^.+$)/\t<li>$1</li>/g} </$1>
On a related note, in addition to the Wrap Selection in Open/Close Tag (on ctrl-shift W) there is also Wrap Each Selected Line in Open/ Close Tag (on ctrl-shift-cmd W).
nope where is that?
On 07/04/2006, at 6:37 PM, Charilaos Skiadas wrote:
Have you seen the "lines to unnumbered list" command in the HTML bundle? On Apr 7, 2006, at 12:05 PM, Timothy Bates wrote:
PS: if you find yourself making lists out of lines of text, this helps me
<${1:ol}> ${TM_SELECTED_TEXT/(^.+$)/\t<li>$1</li>/g} </$1>
Haris
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Heh, that's what I get for saving my own custom commands in the HTML bundle. :) I've attached it to this email for those interested. You might want to customize the code a little bit. It's written in Ruby, but it's easy to customize I think.
On Apr 7, 2006, at 8:08 PM, Timothy Bates wrote:
nope where is that?
Haris