lastobelus-merb_global 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.0.12
2
+ * supports HAML. adds :localize filter to haml
3
+
1
4
  === 0.0.7
2
5
  * More consistent configuration of supported languages
3
6
  * JRuby Numeric provider
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake/rdoctask'
4
4
 
5
5
  PLUGIN = "merb_global"
6
6
  NAME = "merb_global"
7
- GEM_VERSION = "0.0.11"
7
+ GEM_VERSION = "0.0.12"
8
8
  AUTHORS = ["Alex Coles", "Maciej Piechotka"]
9
9
  EMAIL = "merb_global@googlegroups.com"
10
10
  HOMEPAGE = "http://trac.ikonoklastik.com/merb_global/"
@@ -4,9 +4,6 @@ module Merb
4
4
  module HamlGettext
5
5
  # Inject _ gettext into plain text and tag plain text calls
6
6
  def push_plain(text)
7
- if text =~ /JOIN THE/
8
- Merb.logger.debug("push plain for #{text}")
9
- end
10
7
  super(_(text.strip))
11
8
  end
12
9
  def parse_tag(line)
@@ -21,5 +18,17 @@ module Merb
21
18
  end
22
19
  end
23
20
 
21
+ module Haml
22
+ module Filters
23
+ module Localize
24
+ include ::Haml::Filters::Base
25
+ extend Merb::Global
26
+ def render(text)
27
+ _(text.strip)
28
+ end
29
+ end
30
+ end
31
+ end
32
+
24
33
  Haml::Engine.send(:include, Merb::Global::Helpers::HamlGettext)
25
34
  Haml::Engine.send(:include, Merb::Global)
@@ -37,4 +37,30 @@ module HamlParser
37
37
  end
38
38
  end
39
39
 
40
+ module Haml
41
+ module Filters
42
+ module Localize
43
+ include Haml::Filters::Base
44
+ include Merb::Global
45
+ def render(text); text; end
46
+ def compile(precompiler, text)
47
+ resolve_lazy_requires
48
+ filter = self
49
+ precompiler.instance_eval do
50
+ if contains_interpolation?(text)
51
+ return if options[:suppress_eval]
52
+
53
+ push_script(<<RUBY, false)
54
+ find_and_preserve(#{filter.inspect}.render_with_options(#{unescape_interpolation(text)}, _hamlout.options))
55
+ RUBY
56
+ return
57
+ end
58
+
59
+ push_plain(text.strip)
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+
40
66
  GetText::RGetText.add_parser(HamlParser)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lastobelus-merb_global
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Coles