snipcheat 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ cheatsheet.html
@@ -14,13 +14,20 @@ module Snipcheat
14
14
  end
15
15
 
16
16
  def to_s
17
- engine = Haml::Engine.new(template_string)
18
- out = engine.render(Object.new, snippets: @snippets)
17
+ engine = Haml::Engine.new(template)
18
+ out = engine.render(Object.new, snippets: @snippets, css: css)
19
19
  end
20
20
 
21
21
  private
22
22
 
23
- def template_string
23
+ def css
24
+ f = File.open(File.join(File.dirname(__FILE__), '..', 'templates', 'styles.css'))
25
+ f.read
26
+ ensure
27
+ f.close
28
+ end
29
+
30
+ def template
24
31
  f = File.open(File.join(File.dirname(__FILE__), '..', 'templates', 'simple.html.haml'))
25
32
  f.read
26
33
  ensure
@@ -1,3 +1,3 @@
1
1
  module Snipcheat
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,16 +1,29 @@
1
1
  !!!
2
2
  %head
3
+ %style
4
+ = css
3
5
  %body
4
- %table
5
- %tr
6
- %th Description
7
- %th Tab trigger
8
- %th Scope
9
- %th Content
10
- - snippets.each do |snippet|
11
- %tr
12
- %td= snippet.description
13
- %td= snippet.tab_trigger
14
- %td= snippet.scope
15
- %td= snippet.content
6
+ %nav
7
+ %h2.hpadded Scopes
8
+ %ul.scope_links
9
+ - snippets.map(&:scope).uniq.sort.each do |group|
10
+ %li
11
+ %a{href: "##{group.gsub(/\W/, '_')}"}= group
12
+ %small.padded
13
+ Generated with
14
+ %a{href: "https://github.com/tadast/snipcheat"} Snipcheat
15
+
16
+ - snippets.group_by(&:scope).sort_by{ |k,_| k }.each do |scope, snippets|
17
+ %section
18
+ %h2.hpadded{id: scope.gsub(/\W/, '_') }= scope
19
+ %table.snippets
20
+ %tr
21
+ %th Tab trigger
22
+ %th Description
23
+ - snippets.sort_by(&:tab_trigger).each do |snippet|
24
+ %tr{title: snippet.content}
25
+ %td= snippet.tab_trigger
26
+ %td= snippet.description
27
+
28
+
16
29
 
@@ -0,0 +1,357 @@
1
+ /*! normalize.css v2.0.1 | MIT License | git.io/normalize */
2
+ /* ==========================================================================
3
+ HTML5 display definitions
4
+ ========================================================================== */
5
+ /*
6
+ * Corrects `block` display not defined in IE 8/9.
7
+ */
8
+ article,
9
+ aside,
10
+ details,
11
+ figcaption,
12
+ figure,
13
+ footer,
14
+ header,
15
+ hgroup,
16
+ nav,
17
+ section,
18
+ summary {
19
+ display: block;
20
+ }
21
+ /*
22
+ * Corrects `inline-block` display not defined in IE 8/9.
23
+ */
24
+ audio,
25
+ canvas,
26
+ video {
27
+ display: inline-block;
28
+ }
29
+ /*
30
+ * Prevents modern browsers from displaying `audio` without controls.
31
+ * Remove excess height in iOS 5 devices.
32
+ */
33
+ audio:not([controls]) {
34
+ display: none;
35
+ height: 0;
36
+ }
37
+ /*
38
+ * Addresses styling for `hidden` attribute not present in IE 8/9.
39
+ */
40
+ [hidden] {
41
+ display: none;
42
+ }
43
+ /* ==========================================================================
44
+ Base
45
+ ========================================================================== */
46
+ /*
47
+ * 1. Sets default font family to sans-serif.
48
+ * 2. Prevents iOS text size adjust after orientation change, without disabling
49
+ * user zoom.
50
+ */
51
+ html {
52
+ font-family: sans-serif; /* 1 */
53
+ -webkit-text-size-adjust: 100%; /* 2 */
54
+ -ms-text-size-adjust: 100%; /* 2 */
55
+ }
56
+ /*
57
+ * Removes default margin.
58
+ */
59
+ body {
60
+ margin: 0;
61
+ }
62
+ /* ==========================================================================
63
+ Links
64
+ ========================================================================== */
65
+ /*
66
+ * Addresses `outline` inconsistency between Chrome and other browsers.
67
+ */
68
+ a:focus {
69
+ outline: thin dotted;
70
+ }
71
+ /*
72
+ * Improves readability when focused and also mouse hovered in all browsers.
73
+ */
74
+ a:active,
75
+ a:hover {
76
+ outline: 0;
77
+ }
78
+ /* ==========================================================================
79
+ Typography
80
+ ========================================================================== */
81
+ /*
82
+ * Addresses `h1` font sizes within `section` and `article` in Firefox 4+,
83
+ * Safari 5, and Chrome.
84
+ */
85
+ h1 {
86
+ font-size: 2em;
87
+ }
88
+ /*
89
+ * Addresses styling not present in IE 8/9, Safari 5, and Chrome.
90
+ */
91
+ abbr[title] {
92
+ border-bottom: 1px dotted;
93
+ }
94
+ /*
95
+ * Addresses style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
96
+ */
97
+ b,
98
+ strong {
99
+ font-weight: bold;
100
+ }
101
+ /*
102
+ * Addresses styling not present in Safari 5 and Chrome.
103
+ */
104
+ dfn {
105
+ font-style: italic;
106
+ }
107
+ /*
108
+ * Addresses styling not present in IE 8/9.
109
+ */
110
+ mark {
111
+ background: #ff0;
112
+ color: #000;
113
+ }
114
+
115
+ /*
116
+ * Corrects font family set oddly in Safari 5 and Chrome.
117
+ */
118
+ code,
119
+ kbd,
120
+ pre,
121
+ samp {
122
+ font-family: monospace, serif;
123
+ font-size: 1em;
124
+ }
125
+ /*
126
+ * Improves readability of pre-formatted text in all browsers.
127
+ */
128
+ pre {
129
+ white-space: pre;
130
+ white-space: pre-wrap;
131
+ word-wrap: break-word;
132
+ }
133
+ /*
134
+ * Sets consistent quote types.
135
+ */
136
+ q {
137
+ quotes: "\201C" "\201D" "\2018" "\2019";
138
+ }
139
+ /*
140
+ * Addresses inconsistent and variable font size in all browsers.
141
+ */
142
+ small {
143
+ font-size: 80%;
144
+ }
145
+ /*
146
+ * Prevents `sub` and `sup` affecting `line-height` in all browsers.
147
+ */
148
+ sub,
149
+ sup {
150
+ font-size: 75%;
151
+ line-height: 0;
152
+ position: relative;
153
+ vertical-align: baseline;
154
+ }
155
+ sup {
156
+ top: -0.5em;
157
+ }
158
+ sub {
159
+ bottom: -0.25em;
160
+ }
161
+ /* ==========================================================================
162
+ Embedded content
163
+ ========================================================================== */
164
+ /*
165
+ * Removes border when inside `a` element in IE 8/9.
166
+ */
167
+ img {
168
+ border: 0;
169
+ }
170
+ /*
171
+ * Corrects overflow displayed oddly in IE 9.
172
+ */
173
+ svg:not(:root) {
174
+ overflow: hidden;
175
+ }
176
+ /* ==========================================================================
177
+ Figures
178
+ ========================================================================== */
179
+ /*
180
+ * Addresses margin not present in IE 8/9 and Safari 5.
181
+ */
182
+ figure {
183
+ margin: 0;
184
+ }
185
+ /* ==========================================================================
186
+ Forms
187
+ ========================================================================== */
188
+ /*
189
+ * Define consistent border, margin, and padding.
190
+ */
191
+ fieldset {
192
+ border: 1px solid #c0c0c0;
193
+ margin: 0 2px;
194
+ padding: 0.35em 0.625em 0.75em;
195
+ }
196
+ /*
197
+ * 1. Corrects color not being inherited in IE 8/9.
198
+ * 2. Remove padding so people aren't caught out if they zero out fieldsets.
199
+ */
200
+ legend {
201
+ border: 0; /* 1 */
202
+ padding: 0; /* 2 */
203
+ }
204
+ /*
205
+ * 1. Corrects font family not being inherited in all browsers.
206
+ * 2. Corrects font size not being inherited in all browsers.
207
+ * 3. Addresses margins set differently in Firefox 4+, Safari 5, and Chrome
208
+ */
209
+ button,
210
+ input,
211
+ select,
212
+ textarea {
213
+ font-family: inherit; /* 1 */
214
+ font-size: 100%; /* 2 */
215
+ margin: 0; /* 3 */
216
+ }
217
+ /*
218
+ * Addresses Firefox 4+ setting `line-height` on `input` using `!important` in
219
+ * the UA stylesheet.
220
+ */
221
+ button,
222
+ input {
223
+ line-height: normal;
224
+ }
225
+ /*
226
+ * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
227
+ * and `video` controls.
228
+ * 2. Corrects inability to style clickable `input` types in iOS.
229
+ * 3. Improves usability and consistency of cursor style between image-type
230
+ * `input` and others.
231
+ */
232
+ button,
233
+ html input[type="button"], /* 1 */
234
+ input[type="reset"],
235
+ input[type="submit"] {
236
+ -webkit-appearance: button; /* 2 */
237
+ cursor: pointer; /* 3 */
238
+ }
239
+ /*
240
+ * Re-set default cursor for disabled elements.
241
+ */
242
+ button[disabled],
243
+ input[disabled] {
244
+ cursor: default;
245
+ }
246
+ /*
247
+ * 1. Addresses box sizing set to `content-box` in IE 8/9.
248
+ * 2. Removes excess padding in IE 8/9.
249
+ */
250
+ input[type="checkbox"],
251
+ input[type="radio"] {
252
+ box-sizing: border-box; /* 1 */
253
+ padding: 0; /* 2 */
254
+ }
255
+ /*
256
+ * 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome.
257
+ * 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome
258
+ * (include `-moz` to future-proof).
259
+ */
260
+ input[type="search"] {
261
+ -webkit-appearance: textfield; /* 1 */
262
+ -moz-box-sizing: content-box;
263
+ -webkit-box-sizing: content-box; /* 2 */
264
+ box-sizing: content-box;
265
+ }
266
+ /*
267
+ * Removes inner padding and search cancel button in Safari 5 and Chrome
268
+ * on OS X.
269
+ */
270
+ input[type="search"]::-webkit-search-cancel-button,
271
+ input[type="search"]::-webkit-search-decoration {
272
+ -webkit-appearance: none;
273
+ }
274
+ /*
275
+ * Removes inner padding and border in Firefox 4+.
276
+ */
277
+ button::-moz-focus-inner,
278
+ input::-moz-focus-inner {
279
+ border: 0;
280
+ padding: 0;
281
+ }
282
+ /*
283
+ * 1. Removes default vertical scrollbar in IE 8/9.
284
+ * 2. Improves readability and alignment in all browsers.
285
+ */
286
+ textarea {
287
+ overflow: auto; /* 1 */
288
+ vertical-align: top; /* 2 */
289
+ }
290
+ /* ==========================================================================
291
+ Tables
292
+ ========================================================================== */
293
+ /*
294
+ * Remove most spacing between table cells.
295
+ */
296
+ table {
297
+ border-collapse: collapse;
298
+ border-spacing: 0;
299
+ }
300
+
301
+ /* Table CSS */
302
+ table.snippets{
303
+ text-align: left;
304
+ width: 100%;
305
+ }
306
+ .snippets tr:nth-child(odd){
307
+ background: #e8edff;
308
+ }
309
+ .snippets td{
310
+ color: #669;
311
+ padding: 8px;
312
+ }
313
+ .snippets th{
314
+ color: #039;
315
+ padding: 10px 8px;
316
+ }
317
+
318
+ /* Custom styles */
319
+ body{
320
+ font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
321
+ width: 1152px;
322
+ }
323
+ .padded{
324
+ padding: 1em;
325
+ }
326
+ .hpadded{
327
+ padding-left: 1em;
328
+ padding-right: 1em;
329
+ }
330
+ nav{
331
+ position: fixed;
332
+ left: 0;
333
+ top: 0;
334
+ width: 252px;
335
+ max-height: 100%;
336
+ overflow: hidden;
337
+ overflow-y: scroll;
338
+ }
339
+ section{
340
+ float: left;
341
+ margin-left: 272px;
342
+ width: 880px;
343
+ }
344
+ .scope_links{
345
+ list-style: none;
346
+ padding: 0;
347
+ }
348
+ .scope_links li a{
349
+ display: block;
350
+ padding: 8px;
351
+ }
352
+ .scope_links li:nth-child(odd) a{
353
+ background: #e8edff;
354
+ }
355
+ .scope_links li a:hover{
356
+ background: #fffbc3;
357
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snipcheat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -96,6 +96,7 @@ files:
96
96
  - lib/snipcheat/task.rb
97
97
  - lib/snipcheat/version.rb
98
98
  - lib/templates/simple.html.haml
99
+ - lib/templates/styles.css
99
100
  - snipcheat.gemspec
100
101
  - spec/fixtures/no.snippet
101
102
  - spec/fixtures/sample.sublime-snippet