Browse files

• change macro/script to command, requires next build for the selecti…

…on fallback

git-svn-id: http://svn.textmate.org/trunk/Bundles/HTML.tmbundle@2167 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
1 parent 8ebf95c commit a3702dc281d10acdc88d5f00ac08c470f7ec2e83 @sorbits sorbits committed Nov 17, 2005
Showing with 42 additions and 57 deletions.
  1. +40 −0 Commands/Insert Tag Pair.plist
  2. +0 −34 Macros/Insert Tag Pair.plist
  3. +0 −21 Support/insert_tag.rb
  4. +2 −2 info.plist
View
40 Commands/Insert Tag Pair.plist
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>#!/usr/bin/env ruby
+
+# single tags
+single = /^img|meta|link|input|base|area|col|frame|param$/i
+single_no_arguments = /^br|hr$/i
+
+tag = STDIN.read
+if(tag == '')
+ print("&lt;${1:p}&gt;$2&lt;/${1/\\s.*//}&gt;")
+elsif(single.match(tag))
+ print("&lt;#{tag} $1/&gt;")
+elsif(single_no_arguments.match(tag))
+ print("&lt;#{tag} /&gt;")
+else
+ print("&lt;#{tag}&gt;$1&lt;/#{tag.strip[/^\S+/]}&gt;")
+end
+</string>
+ <key>fallbackInput</key>
+ <string>word</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>keyEquivalent</key>
+ <string>^&lt;</string>
+ <key>name</key>
+ <string>Insert Tag Pair</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>scope</key>
+ <string>text.html</string>
+ <key>uuid</key>
+ <string>2ED44A32-C353-447F-BAE4-E3522DB6944D</string>
+</dict>
+</plist>
View
34 Macros/Insert Tag Pair.plist
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>commands</key>
- <array>
- <dict>
- <key>command</key>
- <string>selectWord:</string>
- </dict>
- <dict>
- <key>argument</key>
- <dict>
- <key>command</key>
- <string>"${TM_RUBY:-ruby}" "$TM_BUNDLE_SUPPORT/insert_tag.rb"</string>
- <key>input</key>
- <string>none</string>
- <key>output</key>
- <string>insertAsSnippet</string>
- </dict>
- <key>command</key>
- <string>executeCommandWithOptions:</string>
- </dict>
- </array>
- <key>keyEquivalent</key>
- <string>^&lt;</string>
- <key>name</key>
- <string>Insert Tag Pair</string>
- <key>scopeType</key>
- <string>local</string>
- <key>uuid</key>
- <string>00FE658C-A0EF-4068-BA4B-F8D679C4AC65</string>
-</dict>
-</plist>
View
21 Support/insert_tag.rb
@@ -1,21 +0,0 @@
-#!/usr/bin/env ruby
-
-# single tags
-single_no_arguments = /^br|hr$/i
-single = /^img|meta|link|input|base|area|col|frame|param$/i
-
-# if we have something selected, turn it into a tag,
-# if we are just in a word, use that, otherwise - a blank
-# tag
-if(ENV['TM_SELECTED_TEXT'].to_s.strip != '')
- tag = ENV['TM_SELECTED_TEXT'].strip[/^\S+/]
- if(single.match(tag))
- print("<#{tag}#{ENV['TM_SELECTED_TEXT'].strip[/^\S+(\s+.*)/, 1]} $1/>")
- elsif(single_no_arguments.match(tag))
- print("<#{tag}#{ENV['TM_SELECTED_TEXT'].strip[/^\S+(\s+.*)/, 1]} />")
- else
- print("<#{tag}#{ENV['TM_SELECTED_TEXT'].strip[/^\S+(\s+.*)/, 1]}>$1</#{tag}>")
- end
-else
- print("#{ENV['TM_SELECTED_TEXT']}<${1:p}>$2</${1/\\s.*//}>")
-end
View
4 info.plist
@@ -26,11 +26,11 @@
<string>45F92B81-6F0E-11D9-A1E4-000D9332809C</string>
<string>DDB00DAD-A796-42D5-88A2-DB892AD08F51</string>
<string>3F26240E-6E4A-11D9-B411-000D93589AF6</string>
+ <string>2ED44A32-C353-447F-BAE4-E3522DB6944D</string>
<string>B23D6E15-6B33-11D9-86C1-000D93589AF6</string>
<string>CD6D2CC6-6B33-11D9-BDFD-000D93589AF6</string>
<string>C8B717C2-6B33-11D9-BB47-000D93589AF6</string>
<string>7B7E945E-A112-11D9-A5A2-000D93C8BE28</string>
- <string>00FE658C-A0EF-4068-BA4B-F8D679C4AC65</string>
<string>BC8B8AE2-5F16-11D9-B9C3-000D93589AF6</string>
<string>44F60595-F6BC-42BB-94B8-DF0FE455A283</string>
<string>9CF008C4-A086-11D9-A5A2-000D93C8BE28</string>
@@ -75,14 +75,14 @@
<string>FC34BE82-69DC-47B0-997A-37A8763D4E69</string>
<string>73251DBE-EBD2-470F-8148-E6F2EC1A9641</string>
<string>6D6B631D-0D6C-413C-B4FA-1D535CBCE890</string>
+ <string>E7C5859E-122D-4382-84BE-5AB584DC2409</string>
<string>2D3C377E-6DFB-11D9-91EB-000D93589AF6</string>
<string>2D3C75BE-6DFB-11D9-91EB-000D93589AF6</string>
<string>2D3CAAC2-6DFB-11D9-91EB-000D93589AF6</string>
<string>2D3CE04D-6DFB-11D9-91EB-000D93589AF6</string>
<string>2D3D1461-6DFB-11D9-91EB-000D93589AF6</string>
<string>2D3D4A32-6DFB-11D9-91EB-000D93589AF6</string>
<string>2D3D7E18-6DFB-11D9-91EB-000D93589AF6</string>
- <string>E7C5859E-122D-4382-84BE-5AB584DC2409</string>
</array>
<key>uuid</key>
<string>4676FC6D-6227-11D9-BFB1-000D93589AF6</string>

0 comments on commit a3702dc

Please sign in to comment.