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 +3 -0
- data/Rakefile +1 -1
- data/lib/merb_global/helpers/haml_gettext.rb +12 -3
- data/lib/merb_global/parsers/haml_parser.rb +26 -0
- metadata +1 -1
data/HISTORY
CHANGED
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.
|
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)
|