haml-i18n-extractor 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,6 @@
1
+ Encoding.default_internal = Encoding::UTF_8 if Encoding.respond_to?(:default_internal)
2
+ Encoding.default_external = Encoding::UTF_8 if Encoding.respond_to?(:default_external)
3
+
1
4
  require "trollop"
2
5
 
3
6
  require "haml-i18n-extractor/version"
@@ -6,7 +6,7 @@ module Haml
6
6
  module StringHelpers
7
7
 
8
8
  # do not pollute the key space it will make it invalid yaml
9
- NOT_ALLOWED_IN_KEYNAME = %w( ~ ` ! @ # $ % ^ & * - ( ) , ? { } = ' " : \ / . )
9
+ NOT_ALLOWED_IN_KEYNAME = %w( ~ ` ! @ # $ % ^ & * - ( ) , ? { } = ' " : ; \ / . )
10
10
  # limit the number of chars
11
11
  LIMIT_KEY_NAME = 30
12
12
 
@@ -1,7 +1,7 @@
1
1
  module Haml
2
2
  module I18n
3
3
  class Extractor
4
- VERSION = "0.5.1"
4
+ VERSION = "0.5.2"
5
5
  end
6
6
  end
7
7
  end
@@ -23,6 +23,11 @@ module Haml
23
23
  end
24
24
 
25
25
  ## EXAMPLES
26
+ #
27
+ def test_it_can_replace_a_string_body_and_have_expected_output_ex6
28
+ expected_output = File.read(file_path("ex6.output.haml"))
29
+ assert_equal Haml::I18n::Extractor.new(file_path("ex6.haml")).new_body, expected_output
30
+ end
26
31
 
27
32
  def test_it_can_replace_a_string_body_and_have_expected_output_ex5
28
33
  expected_output = File.read(file_path("ex5.output.haml"))
@@ -0,0 +1 @@
1
+ = "☃"
@@ -0,0 +1 @@
1
+ =t('.☃')
@@ -0,0 +1,5 @@
1
+ ---
2
+ en:
3
+ support:
4
+ ex6:
5
+ ☃: ! ' "☃"'
@@ -48,12 +48,22 @@ module Haml
48
48
  YAML.load File.read(file_path("ex5.yml"))
49
49
  end
50
50
 
51
+ def ex6_yaml_hash
52
+ YAML.load File.read(file_path("ex6.yml"))
53
+ end
54
+
51
55
  def test_it_can_deal_with_interpolated_vars
52
56
  @ex5 = Haml::I18n::Extractor.new(file_path("ex5.haml"))
53
57
  @ex5.run
54
58
  assert_equal @ex5.yaml_writer.yaml_hash, ex5_yaml_hash
55
59
  end
56
60
 
61
+ def test_it_can_deal_with_utf8_characters
62
+ @ex6 = Haml::I18n::Extractor.new(file_path("ex6.haml"))
63
+ @ex6.run
64
+ assert_equal @ex6.yaml_writer.yaml_hash, ex6_yaml_hash
65
+ end
66
+
57
67
  def test_defaults_for_empty_init
58
68
  yaml_writer = Haml::I18n::Extractor::YamlWriter.new
59
69
  assert_equal yaml_writer.yaml_file, "./config/locales/en.yml"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-i18n-extractor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 1
10
- version: 0.5.1
9
+ - 2
10
+ version: 0.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Shai Rosenfeld
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-09-08 00:00:00 Z
18
+ date: 2013-09-09 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: tilt
@@ -263,6 +263,9 @@ files:
263
263
  - test/support/ex5.haml
264
264
  - test/support/ex5.output.haml
265
265
  - test/support/ex5.yml
266
+ - test/support/ex6.haml
267
+ - test/support/ex6.output.haml
268
+ - test/support/ex6.yml
266
269
  - test/support/nothing_to_translate.haml
267
270
  - test/support/nothing_to_translate.i18n-extractor.haml
268
271
  - test/tagging_writer_test.rb
@@ -327,6 +330,9 @@ test_files:
327
330
  - test/support/ex5.haml
328
331
  - test/support/ex5.output.haml
329
332
  - test/support/ex5.yml
333
+ - test/support/ex6.haml
334
+ - test/support/ex6.output.haml
335
+ - test/support/ex6.yml
330
336
  - test/support/nothing_to_translate.haml
331
337
  - test/support/nothing_to_translate.i18n-extractor.haml
332
338
  - test/tagging_writer_test.rb