jstgenerator 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,6 +35,7 @@ module JstGenerator
35
35
 
36
36
  def process_template(path)
37
37
  contents = IO.read(path).gsub("\n", "")
38
+ contents.gsub!('"', '\"')
38
39
  template_name = path.gsub(base_path, "").split(".").first
39
40
  "window.JST[\"#{template_name}\"] = #{method}(\"#{contents}\");"
40
41
  end
@@ -1,3 +1,3 @@
1
1
  module JstGenerator
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -0,0 +1 @@
1
+ I'm "doubled quoted"
@@ -45,6 +45,19 @@ EOS
45
45
  window.JST = {};
46
46
  window.JST["test/one"] = Handlebars.compile("{{title}}");
47
47
  window.JST["two"] = Handlebars.compile("<p>{{desc}}</p>");
48
+ EOS
49
+ end
50
+
51
+ it "escapes double quotes" do
52
+ hb = JstGenerator::Handlebars.new({
53
+ :dir_glob => "spec/fixtures/handlebars/quotes/*.hbs",
54
+ :jst_path => jst_path
55
+ }).generate
56
+
57
+ content = IO.read(jst_path)
58
+ expect(content).to eq(<<EOS)
59
+ window.JST = {};
60
+ window.JST["test"] = Handlebars.compile("I'm \\\"doubled quoted\\\"");
48
61
  EOS
49
62
 
50
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jstgenerator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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: 2013-07-31 00:00:00.000000000 Z
12
+ date: 2013-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -103,6 +103,7 @@ files:
103
103
  - spec/fixtures/handlebars/multiple/two.hb
104
104
  - spec/fixtures/handlebars/nested/test/one.hb
105
105
  - spec/fixtures/handlebars/nested/two.hb
106
+ - spec/fixtures/handlebars/quotes/test.hbs
106
107
  - spec/fixtures/handlebars/temp.hb
107
108
  - spec/fixtures/test.hb
108
109
  - spec/fixtures/underscore/test.us
@@ -139,6 +140,7 @@ test_files:
139
140
  - spec/fixtures/handlebars/multiple/two.hb
140
141
  - spec/fixtures/handlebars/nested/test/one.hb
141
142
  - spec/fixtures/handlebars/nested/two.hb
143
+ - spec/fixtures/handlebars/quotes/test.hbs
142
144
  - spec/fixtures/handlebars/temp.hb
143
145
  - spec/fixtures/test.hb
144
146
  - spec/fixtures/underscore/test.us