[SVN] r6771 (HTML)
Grant Hollingworth
grant at antiflux.org
Mon Mar 12 16:27:05 UTC 2007
* Allan Odgaard <throw-away-1 at macromates.com> [2007-03-10 07:14]:
>• recognize Amazon book URLs (.com and .co.uk) and use their shorter form
The attached patch adds support for the remaining Amazon sites: amazon.(co.jp|ca|fr|de). It also makes the link even shorter: http://amazon.com/dp/097873923X instead of http://www.amazon.com/o/asin/097873923X.
-------------- next part --------------
Index: HTML.tmbundle/Snippets/Wrap selection as link.plist
===================================================================
--- HTML.tmbundle/Snippets/Wrap selection as link.plist (revision 6788)
+++ HTML.tmbundle/Snippets/Wrap selection as link.plist (working copy)
@@ -12,7 +12,7 @@
def make_link(text)
case text
when %r{\A(mailto:)?(.*?@.*\..*)\z}: "mailto:#{$2}"
- when %r{(http://www.amazon.co(?:m|.uk))/.+?/([A-Z0-9]{10})/[-a-zA-Z0-9_./%?=&]+}: "#{$1}/o/asin/#{$2}"
+ when %r{http://www.(amazon.(?:com|co.uk|co.jp|ca|fr|de))/.+?/([A-Z0-9]{10})/[-a-zA-Z0-9_./%?=&]+}: "http://#{$1}/dp/#{$2}"
when %r{\A[a-zA-Z][a-zA-Z0-9.+-]*://.*\z}: entity_escape(text)
when %r{\A.*\.(com|uk|net|org|info)\z}: "http://#{entity_escape text}"
when %r{\A\S+\z}: entity_escape(text)
More information about the textmate-dev
mailing list