[TxMt] Filtering request for "Wrap Selection as Link" HTML command

Glenn Batuyong developer at 47ronin.com
Fri Sep 22 07:51:45 UTC 2006


When creating documents to validate with the XHTML doctype, the ampersand
character in any URL needs to be escaped as an HTML entity &
...TextMate will perform this automatic transformation on copied items
when you select text and use the "Wrap Selection as Link" command. It
takes the clipboard contents, filters it, and uses the result as the
default URL in the link. However, if the URL from the clipboard already
has escaped ampersands, TextMate will transform the entity as &

Clipboard Example: /some.php?option1=foo&option2=bar

When the Wrap Selection as Link command is issued wtih this URL stored in
memory, you get something like the following:

<a href="/some.php?option1=foo&amp;option2=bar" target="_blank">some
link</a>

TextMate's default behavior may need to be adjusted so it checks for
escaped ampersands in a URL before attempting to transform it.




More information about the textmate mailing list