seaofclouds / sass-textmate-bundle

enjoy the splendor of textmate bundles and sass.

This URL has Read+Write access

sass-textmate-bundle / Commands / Documentation for Property.tmCommand
100644 173 lines (167 sloc) 8.736 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?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
#
# Lookup current word as a CSS property on w3c.org
#
# The mapping below was generated using:
# echo '$props = {'; curl -s http://www.w3.org/TR/CSS2/propidx.html|egrep "(^|&lt;tr&gt;&lt;td&gt;)&lt;a href=\".*\" class=\"noxref\"&gt;&lt;span class=\".*\"&gt;'.*'&lt;/span&gt;&lt;/a&gt;"|perl -pe "s|(?:&lt;tr&gt;&lt;td&gt;)?&lt;a href=\"(.*)\" class=\"noxref\"&gt;&lt;span class=\".*\"&gt;'(.*)'&lt;/span&gt;&lt;/a&gt;|\t\"\$2\"\t=&gt; \"\$1\",|"; echo '}'
 
$props = {
"azimuth" =&gt; "aural.html#propdef-azimuth",
"background" =&gt; "colors.html#propdef-background",
"background-attachment" =&gt; "colors.html#propdef-background-attachment",
"background-color" =&gt; "colors.html#propdef-background-color",
"background-image" =&gt; "colors.html#propdef-background-image",
"background-position" =&gt; "colors.html#propdef-background-position",
"background-repeat" =&gt; "colors.html#propdef-background-repeat",
"border" =&gt; "box.html#propdef-border",
"border-collapse" =&gt; "tables.html#propdef-border-collapse",
"border-color" =&gt; "box.html#propdef-border-color",
"border-spacing" =&gt; "tables.html#propdef-border-spacing",
"border-style" =&gt; "box.html#propdef-border-style",
"border-top" =&gt; "box.html#propdef-border-top",
"border-right" =&gt; "box.html#propdef-border-right",
"border-bottom" =&gt; "box.html#propdef-border-bottom",
"border-left" =&gt; "box.html#propdef-border-left",
"border-top-color" =&gt; "box.html#propdef-border-top-color",
"border-right-color" =&gt; "box.html#propdef-border-right-color",
"border-bottom-color" =&gt; "box.html#propdef-border-bottom-color",
"border-left-color" =&gt; "box.html#propdef-border-left-color",
"border-top-style" =&gt; "box.html#propdef-border-top-style",
"border-right-style" =&gt; "box.html#propdef-border-right-style",
"border-bottom-style" =&gt; "box.html#propdef-border-bottom-style",
"border-left-style" =&gt; "box.html#propdef-border-left-style",
"border-top-width" =&gt; "box.html#propdef-border-top-width",
"border-right-width" =&gt; "box.html#propdef-border-right-width",
"border-bottom-width" =&gt; "box.html#propdef-border-bottom-width",
"border-left-width" =&gt; "box.html#propdef-border-left-width",
"border-width" =&gt; "box.html#propdef-border-width",
"bottom" =&gt; "visuren.html#propdef-bottom",
"caption-side" =&gt; "tables.html#propdef-caption-side",
"clear" =&gt; "visuren.html#propdef-clear",
"clip" =&gt; "visufx.html#propdef-clip",
"color" =&gt; "colors.html#propdef-color",
"content" =&gt; "generate.html#propdef-content",
"counter-increment" =&gt; "generate.html#propdef-counter-increment",
"counter-reset" =&gt; "generate.html#propdef-counter-reset",
"cue" =&gt; "aural.html#propdef-cue",
"cue-after" =&gt; "aural.html#propdef-cue-after",
"cue-before" =&gt; "aural.html#propdef-cue-before",
"cursor" =&gt; "ui.html#propdef-cursor",
"direction" =&gt; "visuren.html#propdef-direction",
"display" =&gt; "visuren.html#propdef-display",
"elevation" =&gt; "aural.html#propdef-elevation",
"empty-cells" =&gt; "tables.html#propdef-empty-cells",
"float" =&gt; "visuren.html#propdef-float",
"font" =&gt; "fonts.html#propdef-font",
"font-family" =&gt; "fonts.html#propdef-font-family",
"font-size" =&gt; "fonts.html#propdef-font-size",
"font-size-adjust" =&gt; "fonts.html#propdef-font-size-adjust",
"font-stretch" =&gt; "fonts.html#propdef-font-stretch",
"font-style" =&gt; "fonts.html#propdef-font-style",
"font-variant" =&gt; "fonts.html#propdef-font-variant",
"font-weight" =&gt; "fonts.html#propdef-font-weight",
"height" =&gt; "visudet.html#propdef-height",
"left" =&gt; "visuren.html#propdef-left",
"letter-spacing" =&gt; "text.html#propdef-letter-spacing",
"line-height" =&gt; "visudet.html#propdef-line-height",
"list-style" =&gt; "generate.html#propdef-list-style",
"list-style-image" =&gt; "generate.html#propdef-list-style-image",
"list-style-position" =&gt; "generate.html#propdef-list-style-position",
"list-style-type" =&gt; "generate.html#propdef-list-style-type",
"margin" =&gt; "box.html#propdef-margin",
"margin-top" =&gt; "box.html#propdef-margin-top",
"margin-right" =&gt; "box.html#propdef-margin-right",
"margin-bottom" =&gt; "box.html#propdef-margin-bottom",
"margin-left" =&gt; "box.html#propdef-margin-left",
"marker-offset" =&gt; "generate.html#propdef-marker-offset",
"marks" =&gt; "page.html#propdef-marks",
"max-height" =&gt; "visudet.html#propdef-max-height",
"max-width" =&gt; "visudet.html#propdef-max-width",
"min-height" =&gt; "visudet.html#propdef-min-height",
"min-width" =&gt; "visudet.html#propdef-min-width",
"orphans" =&gt; "page.html#propdef-orphans",
"outline" =&gt; "ui.html#propdef-outline",
"outline-color" =&gt; "ui.html#propdef-outline-color",
"outline-style" =&gt; "ui.html#propdef-outline-style",
"outline-width" =&gt; "ui.html#propdef-outline-width",
"overflow" =&gt; "visufx.html#propdef-overflow",
"padding" =&gt; "box.html#propdef-padding",
"padding-top" =&gt; "box.html#propdef-padding-top",
"padding-right" =&gt; "box.html#propdef-padding-right",
"padding-bottom" =&gt; "box.html#propdef-padding-bottom",
"padding-left" =&gt; "box.html#propdef-padding-left",
"page" =&gt; "page.html#propdef-page",
"page-break-after" =&gt; "page.html#propdef-page-break-after",
"page-break-before" =&gt; "page.html#propdef-page-break-before",
"page-break-inside" =&gt; "page.html#propdef-page-break-inside",
"pause" =&gt; "aural.html#propdef-pause",
"pause-after" =&gt; "aural.html#propdef-pause-after",
"pause-before" =&gt; "aural.html#propdef-pause-before",
"pitch" =&gt; "aural.html#propdef-pitch",
"pitch-range" =&gt; "aural.html#propdef-pitch-range",
"play-during" =&gt; "aural.html#propdef-play-during",
"position" =&gt; "visuren.html#propdef-position",
"quotes" =&gt; "generate.html#propdef-quotes",
"richness" =&gt; "aural.html#propdef-richness",
"right" =&gt; "visuren.html#propdef-right",
"size" =&gt; "page.html#propdef-size",
"speak" =&gt; "aural.html#propdef-speak",
"speak-header" =&gt; "tables.html#propdef-speak-header",
"speak-numeral" =&gt; "aural.html#propdef-speak-numeral",
"speak-punctuation" =&gt; "aural.html#propdef-speak-punctuation",
"speech-rate" =&gt; "aural.html#propdef-speech-rate",
"stress" =&gt; "aural.html#propdef-stress",
"table-layout" =&gt; "tables.html#propdef-table-layout",
"text-align" =&gt; "text.html#propdef-text-align",
"text-decoration" =&gt; "text.html#propdef-text-decoration",
"text-indent" =&gt; "text.html#propdef-text-indent",
"text-shadow" =&gt; "text.html#propdef-text-shadow",
"text-transform" =&gt; "text.html#propdef-text-transform",
"top" =&gt; "visuren.html#propdef-top",
"unicode-bidi" =&gt; "visuren.html#propdef-unicode-bidi",
"vertical-align" =&gt; "visudet.html#propdef-vertical-align",
"visibility" =&gt; "visufx.html#propdef-visibility",
"voice-family" =&gt; "aural.html#propdef-voice-family",
"volume" =&gt; "aural.html#propdef-volume",
"white-space" =&gt; "text.html#propdef-white-space",
"widows" =&gt; "page.html#propdef-widows",
"width" =&gt; "visudet.html#propdef-width",
"word-spacing" =&gt; "text.html#propdef-word-spacing",
"z-index" =&gt; "visuren.html#propdef-z-index",
}
 
cur_line = ENV['TM_CURRENT_LINE']
cur_word = ENV['TM_CURRENT_WORD']
 
# since dash (‘-’) is not a word character, extend current word to neighboring word and dash characters
$prop_name = /[-\w]*#{Regexp.escape cur_word}[-\w]*/.match(cur_line)[0]
 
def request_prop_name
  s = `\"#{ENV['TM_SUPPORT_PATH']}/bin/CocoaDialog.app/Contents/MacOS/CocoaDialog\" inputbox --title 'Documentation for Property' --informative-text 'What property would you like to lookup?' --text '#{$prop_name}' --button1 'Lookup' --button2 'Cancel' --button3 'Show All Properties'`
  case (a = s.split("\n"))[0].to_i
    when 1 then $props[a[1].to_s] || "propidx.html"
    when 2 then abort "&lt;script&gt;window.close()&lt;/script&gt;"
    when 3 then "propidx.html"
  end
end
 
prop_url = $props[$prop_name] || request_prop_name
url = "http://www.w3.org/TR/CSS2/" + prop_url
puts "&lt;meta http-equiv='Refresh' content='0;URL=#{url}'&gt;"
</string>
<key>input</key>
<string>none</string>
<key>keyEquivalent</key>
<string>^h</string>
<key>name</key>
<string>Documentation for Property</string>
<key>output</key>
<string>showAsHTML</string>
<key>scope</key>
<string>source.sass</string>
<key>uuid</key>
<string>E2CC7D28-9F0B-4BBB-ACE0-E67682DF3889</string>
</dict>
</plist>