Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 64 lines (55 sloc) 1.613 kb
14ef5b7 initial import
niko authored
1 <?xml version="1.0" encoding="UTF-8"?>
3e9cd29 @drnic DRYML syntax activated on Sh+Ctrl+Alt+D not R
authored
2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
14ef5b7 initial import
niko authored
3 <plist version="1.0">
4 <dict>
5 <key>beforeRunningCommand</key>
6 <string>nop</string>
7 <key>command</key>
8 <string>#!/usr/bin/env ruby
9
10 doc = STDIN.read
11 line = ENV['TM_LINE_NUMBER'].to_i
12 line_index = ENV['TM_LINE_INDEX'].to_i
13
14 if ENV.has_key? 'TM_INPUT_START_LINE' then
15 line = ENV['TM_INPUT_START_LINE'].to_i
16 line_index = ENV['TM_INPUT_START_LINE_INDEX'].to_i
17 end
18
19 before = /(.*\n){#{line-1}}.{#{line_index}}/.match(doc)[0]
20
21 # remove all self-closing tags
22 if ENV.has_key? 'TM_HTML_EMPTY_TAGS' then
23 empty_tags = ENV['TM_HTML_EMPTY_TAGS']
24 before.gsub!(/&lt;(#{empty_tags})\b[^&gt;]*&gt;|&lt;[^&gt;]+\/\s*&gt;/i, '')
25 end
26
27 # remove all comments
28 before.gsub!(/&lt;!--.*?--&gt;/m, '')
29
30 # remove all erb-tags
31 before.gsub!(/&lt;%=.*?%&gt;/m, '')
32
33 stack = [ ]
34 before.scan(/&lt;\s*(\/)?\s*([\w:-]*)[^&gt;]*&gt;/) do |m|
35 if m[0].nil? then
36 stack &lt;&lt; m[1]
37 else
38 until stack.empty? do
39 close_tag = stack.pop
40 break if close_tag == m[1]
41 end
42 end
43 end
44
45 if stack.empty? then
46 %x{ osascript -e beep &amp;&gt;/dev/null &amp; }
47 else
48 print "&lt;/#{stack.pop}&gt;"
49 end</string>
50 <key>input</key>
51 <string>document</string>
52 <key>keyEquivalent</key>
53 <string>~@.</string>
54 <key>name</key>
3e9cd29 @drnic DRYML syntax activated on Sh+Ctrl+Alt+D not R
authored
55 <string>Insert close tag (⌘⌥.)</string>
14ef5b7 initial import
niko authored
56 <key>output</key>
57 <string>afterSelectedText</string>
58 <key>scope</key>
59 <string>text.html.ruby.dryml</string>
60 <key>uuid</key>
61 <string>21882A84-5563-48E6-AB53-6AA4C2C372BE</string>
62 </dict>
63 </plist>
Something went wrong with that request. Please try again.