hogan_assets 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ ## 1.3.4 (2012-11-09)
2
+
3
+ * Use `HoganAssets::Config.haml_options` to set options for `haml` - @lautis
4
+
1
5
  ## 1.3.3 (2012-09-10)
2
6
 
3
7
  * Use `HoganAssets::Config.template_namespace` to use a custom namespace for your templates - @adamstrickland
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hogan_assets (1.3.3)
4
+ hogan_assets (1.3.4)
5
5
  execjs (>= 1.2.9)
6
6
  sprockets (>= 2.0.3)
7
7
  tilt (>= 1.3.3)
data/README.md CHANGED
@@ -57,6 +57,12 @@ And then execute:
57
57
 
58
58
  $ bundle
59
59
 
60
+ Hamstache compilation can be configured using [Haml options](http://haml.info/docs/yardoc/Haml/Options.html). For example:
61
+
62
+ HoganAssets::Config.configure do |config|
63
+ config.haml_options[:ugly] = true
64
+ end
65
+
60
66
  ## Configuration
61
67
 
62
68
  ### Lambda Support
@@ -121,6 +127,7 @@ I made this because I <3 **mustache** and want to use it in Rails. Follow me on
121
127
  * @gleuch (Greg Leuch) : Mustache lambdas
122
128
  * @lautis (Ville Lautanala) : hamstache fix
123
129
  * @adamstrickland (Adam Strickland) : Custom template namespace
130
+ * @lautis (Ville Lautanala) : haml_options configuration
124
131
 
125
132
  ## Contributing
126
133
 
@@ -9,12 +9,13 @@ module HoganAssets
9
9
  # config.lambda_support = false
10
10
  # config.path_prefix = 'templates'
11
11
  # config.template_extensions = ['mustache', 'hamstache']
12
+ # config.haml_options[:ugly] = true
12
13
  # end
13
14
  #
14
15
  module Config
15
16
  extend self
16
17
 
17
- attr_writer :lambda_support, :path_prefix, :template_extensions, :template_namespace
18
+ attr_writer :lambda_support, :path_prefix, :template_extensions, :template_namespace, :haml_options
18
19
 
19
20
  def configure
20
21
  yield self
@@ -43,5 +44,9 @@ module HoganAssets
43
44
  ['mustache']
44
45
  end
45
46
  end
47
+
48
+ def haml_options
49
+ @haml_options ||= {}
50
+ end
46
51
  end
47
52
  end
@@ -15,8 +15,8 @@ module HoganAssets
15
15
  template_namespace = HoganAssets::Config.template_namespace
16
16
 
17
17
  text = if template_path.is_hamstache?
18
- raise "Unable to complile #{template_path.full_path} because haml is not available. Did you add the haml gem?" unless HoganAssets::Config.haml_available?
19
- Haml::Engine.new(data, @options).render
18
+ raise "Unable to compile #{template_path.full_path} because haml is not available. Did you add the haml gem?" unless HoganAssets::Config.haml_available?
19
+ Haml::Engine.new(data, HoganAssets::Config.haml_options.merge(@options)).render
20
20
  else
21
21
  data
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module HoganAssets
2
- VERSION = "1.3.3"
2
+ VERSION = "1.3.4"
3
3
  end
@@ -90,5 +90,14 @@ module HoganAssets
90
90
  this.JST[\"path/to/template\"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||\"\");t.b(\"This is \");t.b(t.v(t.f(\"mustache\",c,p,0)));return t.fl(); },partials: {}, subs: { }}, "", Hogan, {});
91
91
  END_EXPECTED
92
92
  end
93
+
94
+ def test_haml_options
95
+ HoganAssets::Config.configure do |config|
96
+ config.haml_options[:ugly] = true
97
+ end
98
+ scope = make_scope '/myapp/app/assets/javascripts', 'path/to/template.hamstache'
99
+ template = HoganAssets::Tilt.new(scope.s_path) { "%p\n This is {{mustache}}" }
100
+ assert_match /\"This is "/, template.render(scope, {})
101
+ end
93
102
  end
94
103
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hogan_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.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-09-10 00:00:00.000000000 Z
12
+ date: 2012-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: execjs