* Allan Odgaard <[EMAIL PROTECTED]> [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.
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:)?([EMAIL PROTECTED])\z}:        "mailto:#{$2}";
-  when 
%r{(http://www.amazon.co(?:m|.uk))/.+?/([A-Z0-9]{10})/[-a-zA-Z0-9_./%?=&amp;]+}:
 "#{$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_./%?=&amp;]+}:
 "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)
_______________________________________________
textmate-dev mailing list
[email protected]
http://lists.macromates.com/mailman/listinfo/textmate-dev

Reply via email to