Skip to content

Commit

Permalink
Final cleanup, got Insert Tag working in all three cases... dirty, bu…
Browse files Browse the repository at this point in the history
…t it works

git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/HTML.tmbundle@1968 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information
dpowers committed Oct 20, 2005
1 parent 06c648f commit 21eddfc
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 57 deletions.
6 changes: 3 additions & 3 deletions Commands/Insert Tag.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ if(ENV['TM_SELECTED_TEXT'].to_s.strip != '')
print("<#{tag}#{ENV['TM_SELECTED_TEXT'].strip[/^\S+(\s+.*)/, 1]}>$1</#{tag}>$0")
end
else
print("<${1:p}>$2</${1/\\s.*//}>$0")
print("#{ENV['TM_SELECTED_TEXT']}<${1:p}>$2</${1/\\s.*//}>$0")
end
</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
<string>^@ </string>
<string></string>
<key>name</key>
<string>Insert Tag</string>
<string>Insert Tag Macro Helper</string>
<key>output</key>
<string>insertAsSnippet</string>
<key>uuid</key>
Expand Down
60 changes: 60 additions & 0 deletions Macros/Insert Tag.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?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>beforeRunningCommand</key>
<string>nop</string>
<key>bundlePath</key>
<string>/Users/dpowers/Library/Application Support/TextMate/Bundles/HTML.tmbundle</string>
<key>command</key>
<string>#!/usr/bin/env ruby
# single tags
single = /^img|br|hr|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("&lt;#{tag}#{ENV['TM_SELECTED_TEXT'].strip[/^\S+(\s+.*)/, 1]} /&gt;$0")
else
print("&lt;#{tag}#{ENV['TM_SELECTED_TEXT'].strip[/^\S+(\s+.*)/, 1]}&gt;$1&lt;/#{tag}&gt;$0")
end
else
print("#{ENV['TM_SELECTED_TEXT']}&lt;${1:p}&gt;$2&lt;/${1/\\s.*//}&gt;$0")
end
</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
<string>^@ </string>
<key>output</key>
<string>insertAsSnippet</string>
<key>uuid</key>
<string>0F0A0BD7-EB83-48E7-95C9-42527498D5C1</string>
</dict>
<key>command</key>
<string>executeCommandWithOptions:</string>
</dict>
</array>
<key>keyEquivalent</key>
<string>^&lt;</string>
<key>name</key>
<string>Insert Tag</string>
<key>scopeType</key>
<string>local</string>
<key>uuid</key>
<string>E3F2FEB9-765E-4D13-A1BD-C0B639E9E400</string>
</dict>
</plist>
54 changes: 0 additions & 54 deletions Macros/Start:end tag from previous word.plist

This file was deleted.

2 changes: 2 additions & 0 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
<string>CB0784DB-A102-11D9-A5A2-000D93C8BE28</string>
<string>6A055C10-F8CF-4F90-9B43-0C3E2B7F2AD5</string>
<string>45F92B81-6F0E-11D9-A1E4-000D9332809C</string>
<string>5CAEF69B-48A6-4F45-9AAB-0E7BD41BA472</string>
<string>DDB00DAD-A796-42D5-88A2-DB892AD08F51</string>
<string>3F26240E-6E4A-11D9-B411-000D93589AF6</string>
<string>0F0A0BD7-EB83-48E7-95C9-42527498D5C1</string>
<string>B23D6E15-6B33-11D9-86C1-000D93589AF6</string>
<string>CD6D2CC6-6B33-11D9-BDFD-000D93589AF6</string>
<string>C8B717C2-6B33-11D9-BB47-000D93589AF6</string>
<string>E3F2FEB9-765E-4D13-A1BD-C0B639E9E400</string>
<string>7B7E945E-A112-11D9-A5A2-000D93C8BE28</string>
<string>BC8B8AE2-5F16-11D9-B9C3-000D93589AF6</string>
<string>44F60595-F6BC-42BB-94B8-DF0FE455A283</string>
Expand Down

0 comments on commit 21eddfc

Please sign in to comment.