threedaymonk-l10nizer 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  grammar HtmlErb
2
2
  rule document
3
- (html_comment / javascript / erb_control / whitespace / just_erb_eval / text / tag)* <Document>
3
+ (html_comment / javascript / erb_control / whitespace / text / tag)* <Document>
4
4
  end
5
5
 
6
6
  rule html_comment
@@ -27,10 +27,6 @@ grammar HtmlErb
27
27
  [\s]*
28
28
  end
29
29
 
30
- rule just_erb_eval
31
- (optional_whitespace erb_eval)+
32
- end
33
-
34
30
  rule text
35
31
  (optional_whitespace (erb_eval / inline_markup / word))+ <Text>
36
32
  end
@@ -17,7 +17,13 @@ module L10nizer
17
17
  end
18
18
 
19
19
  def processed
20
- @processed ||= HtmlErbParser.new.parse(@html).elements.map{ |e| NodeWrapperFactory.wrap(e, @keygen) }
20
+ unless @processed
21
+ kcode = $KCODE
22
+ $KCODE = "n"
23
+ @processed = HtmlErbParser.new.parse(@html).elements.map{ |e| NodeWrapperFactory.wrap(e, @keygen) }
24
+ $KCODE = kcode
25
+ end
26
+ @processed
21
27
  end
22
28
  end
23
29
  end
@@ -2,7 +2,7 @@ module L10nizer #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 6
5
+ TINY = 7
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -131,4 +131,26 @@ class ProcessorTest < Test::Unit::TestCase
131
131
  end
132
132
  end
133
133
 
134
+ context "when $KCODE is 'UTF8'" do
135
+ setup do
136
+ @kcode = $KCODE
137
+ $KCODE = "UTF8"
138
+ end
139
+
140
+ teardown do
141
+ $KCODE = @kcode
142
+ end
143
+
144
+ should "parse multi-byte characters in strings" do
145
+ html = "<p>We’ve</p>"
146
+ l10nizer = L10nizer::Processor.new(html, DumbKeyGenerator.new)
147
+ assert_equal ["We’ve"], l10nizer.l10ns.values
148
+ end
149
+
150
+ should "not change $KCODE" do
151
+ l10nizer = L10nizer::Processor.new("", DumbKeyGenerator.new)
152
+ ignore = l10nizer.l10ns.values
153
+ assert_equal "UTF8", $KCODE
154
+ end
155
+ end
134
156
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: threedaymonk-l10nizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Battley
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-13 00:00:00 -07:00
12
+ date: 2009-07-17 00:00:00 -07:00
13
13
  default_executable: l10nizer
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency