snipcheat 0.0.3 → 0.0.4

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.
@@ -8,27 +8,20 @@ module Snipcheat
8
8
  end
9
9
 
10
10
  def write
11
- f = File.open(@out_file, 'w') do |f|
11
+ File.open(@out_file, 'w') do |f|
12
12
  f.write(to_s)
13
13
  end
14
14
  end
15
15
 
16
16
  def to_s
17
- engine = Haml::Engine.new(template)
18
- out = engine.render(Object.new, snippets: @snippets, css: css)
17
+ engine = Haml::Engine.new(template('simple.html.haml'), escape_html: true)
18
+ engine.render(Object.new, snippets: @snippets, css: template('styles.css'))
19
19
  end
20
20
 
21
21
  private
22
22
 
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
31
- f = File.open(File.join(File.dirname(__FILE__), '..', 'templates', 'simple.html.haml'))
23
+ def template(filename)
24
+ f = File.open(File.join(File.dirname(__FILE__), '..', 'templates', filename))
32
25
  f.read
33
26
  ensure
34
27
  f.close
@@ -1,3 +1,3 @@
1
1
  module Snipcheat
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/spec/output_spec.rb CHANGED
@@ -12,6 +12,14 @@ module Snipcheat
12
12
  out.should match 'magic'
13
13
  out.should match 'all.files'
14
14
  end
15
+
16
+ it "escapes html" do
17
+ snippets = [double(content: '<trololo>', tab_trigger: 'ttr', description: '<trololo>', scope: 'all.files')]
18
+ out = Output.new(snippets, :path).to_s
19
+
20
+ out.should match '&lt;trololo&gt;'
21
+ out.should_not match '<trololo>'
22
+ end
15
23
  end
16
24
  end
17
25
  end
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.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-14 00:00:00.000000000 Z
12
+ date: 2013-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: crack