stringex 2.0.11 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDc3OWVmOWMzZGQwOGRlZDI1YjRmYmNiYWJhZTkwOTFmNjAwZDQ1OQ==
4
+ Y2E3OGEzOWQzMzM2YTFiZWY2YzliZTJjM2MyMDFmODAxMjQ2YWZmZg==
5
5
  data.tar.gz: !binary |-
6
- ODdiMzBhMDM2ZjYwYjI5ZTI1OGJmYjZlYTlhZDdjMmRhN2FhZDE4YQ==
6
+ ODY3ZjFjMDIxNjJjMTk3OTI3NzM1YzQwODQ3YjMzODgwNDU1Nzk5Mg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YzcxMTU1MjUzMTg4OTVhNmRiMjYyNTAwNTllNTE4ODFlMThhMmYxYzkwZjAz
10
- NjEyYzg0ODhkYWUwOGQzYmVlMDBkYmQ3OWU3ZjE2NzQwOWRjYWY2NjZkNTYz
11
- NjM0ZDU1M2I0YzljZjQ5NmM2YzA2ZDRjMDYwOGEyYTgzNTQxODY=
9
+ NzA1OTg0MTdjZWZkNzkwOGU3YTcxMmM0N2ZiYWU0NDk3NWU0YWZlN2YxMDQz
10
+ ZDUyNjk0MDZjNTEwOWI0ZTMxNjY1NWZiNzhkYmVhOWVmMGEwMDQwYzM1MDQ1
11
+ OTEzNGRmNDc3ZDk4NmM2ZjdhZWI2N2RmMDAzMGIzN2JiMGNiN2Q=
12
12
  data.tar.gz: !binary |-
13
- ZjcwZTkzODcwNzA5OWJkZmU4ZjEzZDI5MjQ2YjgwYTMxYmM1YWIyOTkwNWEx
14
- ODZiOWUxMTQzZTkwMGVjNTlhN2I0Y2FmNTQ0ZWM1MWJhMzhmOWVmNjc3MDI4
15
- NTQxNzIzZTdkNjQ1OGFiODUyMTNjODE4MDI5Yjk5MWE1NmFjMTg=
13
+ OTE5NTdmZTUzNWZkMTU2NTRkZWE0MjQ4ZjI4MTIzY2VmNTBmODBmYTcyMDZj
14
+ Yjc3ZTllZWJhNmRjZjhiODgzNWJjZGVhMzllYzk1NWFkZTg0NjM3OTI1NDRl
15
+ NjdkZWQ2YmNkOTJjNDBmODBhYThmNTI4ODhkNWUzZGEzNDI1MWE=
data/README.rdoc CHANGED
@@ -105,6 +105,7 @@ Currently, built-in translations are available for the following languages:
105
105
 
106
106
  * English (en)
107
107
  * Danish (da)
108
+ * Dutch (nl)
108
109
  * German (de)
109
110
  * Portuguese Brazilian (pt-BR)
110
111
  * Russian (ru)
@@ -128,4 +129,4 @@ If it's not obvious, some of the code for ActsAsUrl is based on Rick Olsen's per
128
129
 
129
130
  GIANT thanks to the many contributors who have helped make Stringex better and better: http://github.com/rsl/stringex/contributors
130
131
 
131
- copyright (c) 2008-2012 Lucky Sneaks, released under the MIT license
132
+ copyright (c) 2008-2013 Lucky Sneaks, released under the MIT license
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.11
1
+ 2.1.0
@@ -29,6 +29,7 @@ module Stringex
29
29
  CLEANUP_HTML_ENTITIES = /&[^;]+;/
30
30
 
31
31
  CURRENCIES_SUPPORTED_SIMPLE = {
32
+ :generic => /¤/,
32
33
  :dollars => /\$/,
33
34
  :euros => /€/,
34
35
  :pounds => /£/,
@@ -19,6 +19,7 @@ module Stringex
19
19
  }
20
20
 
21
21
  CURRENCIES_SIMPLE = {
22
+ :generic => '\1 dollars',
22
23
  :dollars => '\1 dollars',
23
24
  :euros => '\1 euros',
24
25
  :pounds => '\1 pounds',
@@ -163,7 +163,7 @@
163
163
  - ''
164
164
  - C/
165
165
  - PS
166
- - $?
166
+ - $
167
167
  - Y=
168
168
  - '|'
169
169
  - SS
data/locales/da.yml CHANGED
@@ -19,6 +19,7 @@ da:
19
19
  slash: skråstreg
20
20
  star: stjerne
21
21
  currencies:
22
+ generic: \1 kroner
22
23
  dollars: \1 dollars
23
24
  dollars_cents: \1 dollars \2 cents
24
25
  pounds: \1 pund
@@ -29,7 +30,7 @@ da:
29
30
  reais: \1 reais
30
31
  reais_cents: \1 reais \2 cents
31
32
  html_entities:
32
- amp: and
33
+ amp: og
33
34
  cent: " cents"
34
35
  copy: (c)
35
36
  deg: " grader "
data/locales/de.yml CHANGED
@@ -19,6 +19,7 @@ de:
19
19
  slash: Strich
20
20
  star: Stern
21
21
  currencies:
22
+ generic: \1 Euro
22
23
  dollars: \1 Dollar
23
24
  dollars_cents: \1 Dollar \2 Cent
24
25
  pounds: \1 Pfund
data/locales/en.yml CHANGED
@@ -19,6 +19,7 @@ en:
19
19
  slash: slash
20
20
  star: star
21
21
  currencies:
22
+ generic: \1 pounds
22
23
  dollars: \1 dollars
23
24
  dollars_cents: \1 dollars \2 cents
24
25
  pounds: \1 pounds
data/locales/nl.yml ADDED
@@ -0,0 +1,69 @@
1
+ # NOTE: Some translation keys make use of matches from regular expressions
2
+ # to manipulate whitespace and order. Please consult the source code for
3
+ # Stringex::Localization::ConversionExpressions to see what those
4
+ # regular expressions look like if you need to manipulate the order
5
+ # differently than the usage below.
6
+ nl:
7
+ stringex:
8
+ characters:
9
+ and: en
10
+ at: op
11
+ divide: gedeeld door
12
+ degrees: graden
13
+ dot: \1 punt \2
14
+ ellipsis: punt punt punt
15
+ equals: is
16
+ number: nummer
17
+ percent: procent
18
+ plus: plus
19
+ slash: slash
20
+ star: ster
21
+ currencies:
22
+ generic: \1 euro
23
+ dollars: \1 dollar
24
+ dollars_cents: \1 dollar \2 cent
25
+ pounds: \1 pond
26
+ pounds_pence: \1 pond \2 pence
27
+ euros: \1 euro
28
+ euros_cents: \1 euro \2 cent
29
+ yen: \1 yen
30
+ reais: \1 reais
31
+ reais_cents: \1 reais \2 cents
32
+ html_entities:
33
+ amp: en
34
+ cent: " cent"
35
+ copy: (c)
36
+ deg: " graden "
37
+ divide: " gedeeld door "
38
+ double_quote: '"'
39
+ ellipsis: "..."
40
+ en_dash: "-"
41
+ em_dash: "--"
42
+ frac14: eenvierde
43
+ frac12: half
44
+ frac34: drievierde
45
+ gt: ">"
46
+ lt: <
47
+ nbsp: " "
48
+ pound: " pond "
49
+ reg: (r)
50
+ single_quote: "'"
51
+ times: x
52
+ trade: (tm)
53
+ yen: " yen "
54
+ vulgar_fractions:
55
+ half: half
56
+ one_third: eenderde
57
+ two_thirds: tweederde
58
+ one_fourth: eenvierde
59
+ three_fourths: drievierde
60
+ one_fifth: eenvijfde
61
+ two_fifths: tweevijfde
62
+ three_fifths: drievijfde
63
+ four_fifths: viervijfde
64
+ one_sixth: eenzesde
65
+ five_sixths: vijfzesde
66
+ one_eighth: eenachtste
67
+ three_eighths: drieachtste
68
+ five_eighths: vijfachtste
69
+ seven_eighths: zevenachtste
data/locales/pt-BR.yml CHANGED
@@ -19,6 +19,7 @@ pt-BR:
19
19
  slash: barra
20
20
  star: estrela
21
21
  currencies:
22
+ generic: \1 reais
22
23
  dollars: \1 dólares
23
24
  dollars_cents: \1 dólares \2 cents
24
25
  pounds: \1 libras
data/locales/ru.yml CHANGED
@@ -19,6 +19,7 @@ ru:
19
19
  slash: слеш
20
20
  star: звезда
21
21
  currencies:
22
+ generic: \1 рубль
22
23
  dollars: \1 долларов
23
24
  dollars_cents: \1 долларов \2 центов
24
25
  pounds: \1 фунтов
data/stringex.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "stringex"
8
- s.version = "2.0.11"
8
+ s.version = "2.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Russell Norris"]
12
- s.date = "2013-08-27"
12
+ s.date = "2013-09-17"
13
13
  s.description = "Some [hopefully] useful extensions to Ruby's String class. Stringex is made up of three libraries: ActsAsUrl [permalink solution with better character translation], Unidecoder [Unicode to ASCII transliteration], and StringExtensions [miscellaneous helper methods for the String class]."
14
14
  s.email = "rsl@luckysneaks.com"
15
15
  s.extra_rdoc_files = [
@@ -231,6 +231,7 @@ Gem::Specification.new do |s|
231
231
  "locales/da.yml",
232
232
  "locales/de.yml",
233
233
  "locales/en.yml",
234
+ "locales/nl.yml",
234
235
  "locales/pt-BR.yml",
235
236
  "locales/ru.yml",
236
237
  "stringex.gemspec",
@@ -245,10 +246,11 @@ Gem::Specification.new do |s|
245
246
  "test/unit/localization/de_test.rb",
246
247
  "test/unit/localization/default_test.rb",
247
248
  "test/unit/localization/en_test.rb",
249
+ "test/unit/localization/nl_test.rb",
250
+ "test/unit/localization/pt_br_test.rb",
248
251
  "test/unit/localization/ru_test.rb",
249
252
  "test/unit/localization_18n_failure_test.rb",
250
253
  "test/unit/localization_test.rb",
251
- "test/unit/redcloth_to_html_test.rb",
252
254
  "test/unit/string_extensions_configuration_test.rb",
253
255
  "test/unit/string_extensions_test.rb",
254
256
  "test/unit/unicode_point_suite/basic_greek_test.rb",
@@ -33,6 +33,7 @@ class DanishYAMLLocalizationTest < Test::Unit::TestCase
33
33
  end
34
34
 
35
35
  {
36
+ "¤20" => "20 kroner",
36
37
  "$100" => "100 dollars",
37
38
  "$19.99" => "19 dollars 99 cents",
38
39
  "£100" => "100 pund",
@@ -47,7 +48,7 @@ class DanishYAMLLocalizationTest < Test::Unit::TestCase
47
48
  end
48
49
 
49
50
  {
50
- "Tea &amp; Sympathy" => "Tea and Sympathy",
51
+ "Tea &amp; Sympathy" => "Tea og Sympathy",
51
52
  "10&cent;" => "10 cents",
52
53
  "&copy;2000" => "(c)2000",
53
54
  "98&deg; is fine" => "98 grader is fine",
@@ -33,6 +33,7 @@ class GermanYAMLLocalizationTest < Test::Unit::TestCase
33
33
  end
34
34
 
35
35
  {
36
+ "¤20" => "20 Euro",
36
37
  "$100" => "100 Dollar",
37
38
  "$19.99" => "19 Dollar 99 Cent",
38
39
  "£100" => "100 Pfund",
@@ -8,6 +8,7 @@ class DefaultLocalizationTest < Test::Unit::TestCase
8
8
  Stringex::Localization.reset!
9
9
  Stringex::Localization.backend = :internal
10
10
  end
11
+
11
12
  {
12
13
  "foo & bar" => "foo and bar",
13
14
  "AT&T" => "AT and T",
@@ -29,6 +30,7 @@ class DefaultLocalizationTest < Test::Unit::TestCase
29
30
  end
30
31
 
31
32
  {
33
+ "¤20" => "20 dollars",
32
34
  "$100" => "100 dollars",
33
35
  "$19.99" => "19 dollars 99 cents",
34
36
  "£100" => "100 pounds",
@@ -33,6 +33,7 @@ class EnglishYAMLLocalizationTest < Test::Unit::TestCase
33
33
  end
34
34
 
35
35
  {
36
+ "¤20" => "20 pounds",
36
37
  "$100" => "100 dollars",
37
38
  "$19.99" => "19 dollars 99 cents",
38
39
  "£100" => "100 pounds",
@@ -0,0 +1,118 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'test_helper'
4
+ require 'i18n'
5
+ require 'stringex'
6
+
7
+ class DutchYAMLLocalizationTest < Test::Unit::TestCase
8
+ def setup
9
+ Stringex::Localization.reset!
10
+ Stringex::Localization.backend = :i18n
11
+ Stringex::Localization.backend.load_translations :nl
12
+ Stringex::Localization.locale = :nl
13
+ end
14
+
15
+ {
16
+ "foo & bar" => "foo en bar",
17
+ "AT&T" => "AT en T",
18
+ "99° is normaal" => "99 graden is normaal",
19
+ "4 ÷ 2 is 2" => "4 gedeeld door 2 is 2",
20
+ "webcrawler.com" => "webcrawler punt com",
21
+ "Dus..." => "Dus punt punt punt",
22
+ "x=1" => "x is 1",
23
+ "Een potlood #2" => "Een potlood nummer 2",
24
+ "100%" => "100 procent",
25
+ "prijs+belasting" => "prijs plus belasting",
26
+ "Batman/Robin fan fiction" => "Batman slash Robin fan fiction",
27
+ "bel *69" => "bel ster 69",
28
+ " i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged "
29
+ }.each do |original, converted|
30
+ define_method "test_character_conversion: '#{original}'" do
31
+ assert_equal converted, original.convert_miscellaneous_characters
32
+ end
33
+ end
34
+
35
+ {
36
+ "¤20" => "20 euro",
37
+ "$100" => "100 dollar",
38
+ "$19.99" => "19 dollar 99 cent",
39
+ "£100" => "100 pond",
40
+ "£19.99" => "19 pond 99 pence",
41
+ "€100" => "100 euro",
42
+ "€19.99" => "19 euro 99 cent",
43
+ "¥1000" => "1000 yen"
44
+ }.each do |original, converted|
45
+ define_method "test_currency_conversion: '#{original}'" do
46
+ assert_equal converted, original.convert_miscellaneous_characters
47
+ end
48
+ end
49
+
50
+ {
51
+ "Appels &amp; peren" => "Appels en peren",
52
+ "10&cent;" => "10 cent",
53
+ "&copy;2000" => "(c)2000",
54
+ "98&deg; is acceptabel" => "98 graden is acceptabel",
55
+ "10&divide;5" => "10 gedeeld door 5",
56
+ "&quot;tussen aanhalingstekens&quot;" => '"tussen aanhalingstekens"',
57
+ "wordt vervolgd&hellip;" => "wordt vervolgd...",
58
+ "2000&ndash;2004" => "2000-2004",
59
+ "Ik wil&mdash;oh, laat maar" => "Ik wil--oh, laat maar",
60
+ "&frac12; ons goud" => "half ons goud",
61
+ "1 en &frac14; ons zilver" => "1 en eenvierde ons zilver",
62
+ "9 en &frac34; ons platina" => "9 en drievierde ons platina",
63
+ "3&gt;2" => "3>2",
64
+ "2&lt;3" => "2<3",
65
+ "twee&nbsp;woorden" => "twee woorden",
66
+ "100&pound;" => "100 pond",
67
+ "Walmart&reg;" => "Walmart(r)",
68
+ "&apos;enkele aanhalingstekens&apos;" => "'enkele aanhalingstekens'",
69
+ "2&times;4" => "2x4",
70
+ "Programming&trade;" => "Programming(tm)",
71
+ "20000&yen;" => "20000 yen",
72
+ " i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged "
73
+ }.each do |original, converted|
74
+ define_method "test_html_entity_conversion: '#{original}'" do
75
+ assert_equal converted, original.convert_miscellaneous_html_entities
76
+ end
77
+ end
78
+
79
+ {
80
+ "&frac12;" => "half",
81
+ "½" => "half",
82
+ "&#189;" => "half",
83
+ "⅓" => "eenderde",
84
+ "&#8531;" => "eenderde",
85
+ "⅔" => "tweederde",
86
+ "&#8532;" => "tweederde",
87
+ "&frac14;" => "eenvierde",
88
+ "¼" => "eenvierde",
89
+ "&#188;" => "eenvierde",
90
+ "&frac34;" => "drievierde",
91
+ "¾" => "drievierde",
92
+ "&#190;" => "drievierde",
93
+ "⅕" => "eenvijfde",
94
+ "&#8533;" => "eenvijfde",
95
+ "⅖" => "tweevijfde",
96
+ "&#8534;" => "tweevijfde",
97
+ "⅗" => "drievijfde",
98
+ "&#8535;" => "drievijfde",
99
+ "⅘" => "viervijfde",
100
+ "&#8536;" => "viervijfde",
101
+ "⅙" => "eenzesde",
102
+ "&#8537;" => "eenzesde",
103
+ "⅚" => "vijfzesde",
104
+ "&#8538;" => "vijfzesde",
105
+ "⅛" => "eenachtste",
106
+ "&#8539;" => "eenachtste",
107
+ "⅜" => "drieachtste",
108
+ "&#8540;" => "drieachtste",
109
+ "⅝" => "vijfachtste",
110
+ "&#8541;" => "vijfachtste",
111
+ "⅞" => "zevenachtste",
112
+ "&#8542;" => "zevenachtste"
113
+ }.each do |original, converted|
114
+ define_method "test_vulgar_fractions_conversion: #{original}" do
115
+ assert_equal converted, original.convert_vulgar_fractions
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,118 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'test_helper'
4
+ require 'i18n'
5
+ require 'stringex'
6
+
7
+ class BrazilianYAMLLocalizationTest < Test::Unit::TestCase
8
+ def setup
9
+ Stringex::Localization.reset!
10
+ Stringex::Localization.backend = :i18n
11
+ Stringex::Localization.backend.load_translations :'pt-BR'
12
+ Stringex::Localization.locale = :'pt-BR'
13
+ end
14
+
15
+ {
16
+ "foo & bar" => "foo e bar",
17
+ "AT&T" => "AT e T",
18
+ "99° is normal" => "99 graus is normal",
19
+ "4 ÷ 2 is 2" => "4 dividido por 2 is 2",
20
+ "webcrawler.com" => "webcrawler ponto com",
21
+ "Well..." => "Well reticências",
22
+ "x=1" => "x igual à 1",
23
+ "a #2 pencil" => "a número 2 pencil",
24
+ "100%" => "100 porcento",
25
+ "cost+tax" => "cost mais tax",
26
+ "batman/robin fan fiction" => "batman barra robin fan fiction",
27
+ "dial *69" => "dial estrela 69",
28
+ " i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged "
29
+ }.each do |original, converted|
30
+ define_method "test_character_conversion: '#{original}'" do
31
+ assert_equal converted, original.convert_miscellaneous_characters
32
+ end
33
+ end
34
+
35
+ {
36
+ "¤20" => "20 reais",
37
+ "$100" => "100 dólares",
38
+ "$19.99" => "19 dólares 99 cents",
39
+ "£100" => "100 libras",
40
+ "£19.99" => "19 libras 99 centavos",
41
+ "€100" => "100 euros",
42
+ "€19.99" => "19 euros 99 cents",
43
+ "¥1000" => "1000 yen"
44
+ }.each do |original, converted|
45
+ define_method "test_currency_conversion: '#{original}'" do
46
+ assert_equal converted, original.convert_miscellaneous_characters
47
+ end
48
+ end
49
+
50
+ {
51
+ "Tea &amp; Sympathy" => "Tea e Sympathy",
52
+ "10&cent;" => "10 centavos",
53
+ "&copy;2000" => "(c)2000",
54
+ "98&deg; is fine" => "98 graus is fine",
55
+ "10&divide;5" => "10 dividido por 5",
56
+ "&quot;quoted&quot;" => '"quoted"',
57
+ "to be continued&hellip;" => "to be continued...",
58
+ "2000&ndash;2004" => "2000-2004",
59
+ "I wish&mdash;oh, never mind" => "I wish--oh, never mind",
60
+ "&frac12; ounce of gold" => "metade ounce of gold",
61
+ "1 and &frac14; ounces of silver" => "1 and um quarto ounces of silver",
62
+ "9 and &frac34; ounces of platinum" => "9 and três quartos ounces of platinum",
63
+ "3&gt;2" => "3>2",
64
+ "2&lt;3" => "2<3",
65
+ "two&nbsp;words" => "two words",
66
+ "&pound;100" => "libras 100",
67
+ "Walmart&reg;" => "Walmart(r)",
68
+ "&apos;single quoted&apos;" => "'single quoted'",
69
+ "2&times;4" => "2x4",
70
+ "Programming&trade;" => "Programming(tm)",
71
+ "&yen;20000" => "yen 20000",
72
+ " i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged "
73
+ }.each do |original, converted|
74
+ define_method "test_html_entity_conversion: '#{original}'" do
75
+ assert_equal converted, original.convert_miscellaneous_html_entities
76
+ end
77
+ end
78
+
79
+ {
80
+ "&frac12;" => "metade",
81
+ "½" => "metade",
82
+ "&#189;" => "metade",
83
+ "⅓" => "um terço",
84
+ "&#8531;" => "um terço",
85
+ "⅔" => "dois terços",
86
+ "&#8532;" => "dois terços",
87
+ "&frac14;" => "um quarto",
88
+ "¼" => "um quarto",
89
+ "&#188;" => "um quarto",
90
+ "&frac34;" => "três quartos",
91
+ "¾" => "três quartos",
92
+ "&#190;" => "três quartos",
93
+ "⅕" => "um quinto",
94
+ "&#8533;" => "um quinto",
95
+ "⅖" => "dois quintos",
96
+ "&#8534;" => "dois quintos",
97
+ "⅗" => "três quintos",
98
+ "&#8535;" => "três quintos",
99
+ "⅘" => "quatro quintos",
100
+ "&#8536;" => "quatro quintos",
101
+ "⅙" => "um sexto",
102
+ "&#8537;" => "um sexto",
103
+ "⅚" => "cinco sextos",
104
+ "&#8538;" => "cinco sextos",
105
+ "⅛" => "um oitavo",
106
+ "&#8539;" => "um oitavo",
107
+ "⅜" => "três oitavos",
108
+ "&#8540;" => "três oitavos",
109
+ "⅝" => "cinco oitavos",
110
+ "&#8541;" => "cinco oitavos",
111
+ "⅞" => "sete oitavos",
112
+ "&#8542;" => "sete oitavos"
113
+ }.each do |original, converted|
114
+ define_method "test_vulgar_fractions_conversion: #{original}" do
115
+ assert_equal converted, original.convert_vulgar_fractions
116
+ end
117
+ end
118
+ end
@@ -33,6 +33,7 @@ class RussianYAMLLocalizationTest < Test::Unit::TestCase
33
33
  end
34
34
 
35
35
  {
36
+ "¤20" => "20 рубль",
36
37
  "$100" => "100 долларов",
37
38
  "$19.99" => "19 долларов 99 центов",
38
39
  "£100" => "100 фунтов",
@@ -7,6 +7,16 @@ if RUBY_VERSION.to_f < 1.9
7
7
  $KCODE = "U"
8
8
  end
9
9
 
10
+ # Try loading RedCloth but it's okay if it's not there
11
+ begin
12
+ gem 'RedCloth'
13
+ rescue LoadError
14
+ puts
15
+ puts ">> Could not load RedCloth. String#to_html was not tested."
16
+ puts ">> Please gem install RedCloth if you'd like to use this functionality."
17
+ puts
18
+ end
19
+
10
20
  class StringExtensionsTest < Test::Unit::TestCase
11
21
  def setup
12
22
  Stringex::Localization.reset!
@@ -78,8 +88,6 @@ class StringExtensionsTest < Test::Unit::TestCase
78
88
  "zut-alors",
79
89
  "Rabbits aren't real" =>
80
90
  "rabbits-arent-real",
81
- "R" =>
82
- "r",
83
91
  "R$ isn't R" =>
84
92
  "reais-isnt-r"
85
93
  }.each do |html, plain|
@@ -264,4 +272,27 @@ class StringExtensionsTest < Test::Unit::TestCase
264
272
  end
265
273
  end
266
274
  end
275
+
276
+ if defined?(RedCloth)
277
+ def test_to_html
278
+ {
279
+ "h1. A Solution" => "<h1>A Solution</h1>",
280
+ "I hated wrapping textilize around a string.\n\nIt always felt dirty." =>
281
+ "<p>I hated wrapping textilize around a string.</p>\n<p>It always felt dirty.</p>",
282
+ "I think _this_ is awesome" => "<p>I think <em>this</em> is awesome</p>",
283
+ "Um... _*really*_, man" => "<p>Um&#8230; <em><strong>really</strong></em>, man</p>"
284
+ }.each do |plain, html|
285
+ assert_equal html, plain.to_html
286
+ end
287
+ end
288
+
289
+ def test_to_html_lite
290
+ {
291
+ "I have no pee on me" => "I have no pee on me",
292
+ "But I _do_ get Textile!" => "But I <em>do</em> get Textile!"
293
+ }.each do |plain, html|
294
+ assert_equal html, plain.to_html(:lite)
295
+ end
296
+ end
297
+ end
267
298
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stringex
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.11
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Norris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-27 00:00:00.000000000 Z
11
+ date: 2013-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -389,6 +389,7 @@ files:
389
389
  - locales/da.yml
390
390
  - locales/de.yml
391
391
  - locales/en.yml
392
+ - locales/nl.yml
392
393
  - locales/pt-BR.yml
393
394
  - locales/ru.yml
394
395
  - stringex.gemspec
@@ -403,10 +404,11 @@ files:
403
404
  - test/unit/localization/de_test.rb
404
405
  - test/unit/localization/default_test.rb
405
406
  - test/unit/localization/en_test.rb
407
+ - test/unit/localization/nl_test.rb
408
+ - test/unit/localization/pt_br_test.rb
406
409
  - test/unit/localization/ru_test.rb
407
410
  - test/unit/localization_18n_failure_test.rb
408
411
  - test/unit/localization_test.rb
409
- - test/unit/redcloth_to_html_test.rb
410
412
  - test/unit/string_extensions_configuration_test.rb
411
413
  - test/unit/string_extensions_test.rb
412
414
  - test/unit/unicode_point_suite/basic_greek_test.rb
@@ -1,37 +0,0 @@
1
- require 'test_helper'
2
- require 'stringex'
3
-
4
- begin
5
- require 'rubygems'
6
- require 'RedCloth'
7
- rescue LoadError
8
- puts
9
- puts ">> Could not load RedCloth. String#to_html was not tested."
10
- puts ">> Please gem install RedCloth if you'd like to use this functionality."
11
- puts
12
- end
13
-
14
- class RedclothToHTMLTest < Test::Unit::TestCase
15
- if defined?(RedCloth)
16
- def test_to_html
17
- {
18
- "h1. A Solution" => "<h1>A Solution</h1>",
19
- "I hated wrapping textilize around a string.\n\nIt always felt dirty." =>
20
- "<p>I hated wrapping textilize around a string.</p>\n<p>It always felt dirty.</p>",
21
- "I think _this_ is awesome" => "<p>I think <em>this</em> is awesome</p>",
22
- "Um... _*really*_, man" => "<p>Um&#8230; <em><strong>really</strong></em>, man</p>"
23
- }.each do |plain, html|
24
- assert_equal html, plain.to_html
25
- end
26
- end
27
-
28
- def test_to_html_lite
29
- {
30
- "I have no pee on me" => "I have no pee on me",
31
- "But I _do_ get Textile!" => "But I <em>do</em> get Textile!"
32
- }.each do |plain, html|
33
- assert_equal html, plain.to_html(:lite)
34
- end
35
- end
36
- end
37
- end