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 +8 -8
- data/README.rdoc +2 -1
- data/VERSION +1 -1
- data/lib/stringex/localization/conversion_expressions.rb +1 -0
- data/lib/stringex/localization/default_conversions.rb +1 -0
- data/lib/stringex/unidecoder_data/x00.yml +1 -1
- data/locales/da.yml +2 -1
- data/locales/de.yml +1 -0
- data/locales/en.yml +1 -0
- data/locales/nl.yml +69 -0
- data/locales/pt-BR.yml +1 -0
- data/locales/ru.yml +1 -0
- data/stringex.gemspec +5 -3
- data/test/unit/localization/da_test.rb +2 -1
- data/test/unit/localization/de_test.rb +1 -0
- data/test/unit/localization/default_test.rb +2 -0
- data/test/unit/localization/en_test.rb +1 -0
- data/test/unit/localization/nl_test.rb +118 -0
- data/test/unit/localization/pt_br_test.rb +118 -0
- data/test/unit/localization/ru_test.rb +1 -0
- data/test/unit/string_extensions_test.rb +33 -2
- metadata +5 -3
- data/test/unit/redcloth_to_html_test.rb +0 -37
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2E3OGEzOWQzMzM2YTFiZWY2YzliZTJjM2MyMDFmODAxMjQ2YWZmZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODY3ZjFjMDIxNjJjMTk3OTI3NzM1YzQwODQ3YjMzODgwNDU1Nzk5Mg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzA1OTg0MTdjZWZkNzkwOGU3YTcxMmM0N2ZiYWU0NDk3NWU0YWZlN2YxMDQz
|
10
|
+
ZDUyNjk0MDZjNTEwOWI0ZTMxNjY1NWZiNzhkYmVhOWVmMGEwMDQwYzM1MDQ1
|
11
|
+
OTEzNGRmNDc3ZDk4NmM2ZjdhZWI2N2RmMDAzMGIzN2JiMGNiN2Q=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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-
|
132
|
+
copyright (c) 2008-2013 Lucky Sneaks, released under the MIT license
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0
|
1
|
+
2.1.0
|
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:
|
33
|
+
amp: og
|
33
34
|
cent: " cents"
|
34
35
|
copy: (c)
|
35
36
|
deg: " grader "
|
data/locales/de.yml
CHANGED
data/locales/en.yml
CHANGED
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
data/locales/ru.yml
CHANGED
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
|
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-
|
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 & Sympathy" => "Tea
|
51
|
+
"Tea & Sympathy" => "Tea og Sympathy",
|
51
52
|
"10¢" => "10 cents",
|
52
53
|
"©2000" => "(c)2000",
|
53
54
|
"98° is fine" => "98 grader is fine",
|
@@ -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",
|
@@ -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 & peren" => "Appels en peren",
|
52
|
+
"10¢" => "10 cent",
|
53
|
+
"©2000" => "(c)2000",
|
54
|
+
"98° is acceptabel" => "98 graden is acceptabel",
|
55
|
+
"10÷5" => "10 gedeeld door 5",
|
56
|
+
""tussen aanhalingstekens"" => '"tussen aanhalingstekens"',
|
57
|
+
"wordt vervolgd…" => "wordt vervolgd...",
|
58
|
+
"2000–2004" => "2000-2004",
|
59
|
+
"Ik wil—oh, laat maar" => "Ik wil--oh, laat maar",
|
60
|
+
"½ ons goud" => "half ons goud",
|
61
|
+
"1 en ¼ ons zilver" => "1 en eenvierde ons zilver",
|
62
|
+
"9 en ¾ ons platina" => "9 en drievierde ons platina",
|
63
|
+
"3>2" => "3>2",
|
64
|
+
"2<3" => "2<3",
|
65
|
+
"twee woorden" => "twee woorden",
|
66
|
+
"100£" => "100 pond",
|
67
|
+
"Walmart®" => "Walmart(r)",
|
68
|
+
"'enkele aanhalingstekens'" => "'enkele aanhalingstekens'",
|
69
|
+
"2×4" => "2x4",
|
70
|
+
"Programming™" => "Programming(tm)",
|
71
|
+
"20000¥" => "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
|
+
"½" => "half",
|
81
|
+
"½" => "half",
|
82
|
+
"½" => "half",
|
83
|
+
"⅓" => "eenderde",
|
84
|
+
"⅓" => "eenderde",
|
85
|
+
"⅔" => "tweederde",
|
86
|
+
"⅔" => "tweederde",
|
87
|
+
"¼" => "eenvierde",
|
88
|
+
"¼" => "eenvierde",
|
89
|
+
"¼" => "eenvierde",
|
90
|
+
"¾" => "drievierde",
|
91
|
+
"¾" => "drievierde",
|
92
|
+
"¾" => "drievierde",
|
93
|
+
"⅕" => "eenvijfde",
|
94
|
+
"⅕" => "eenvijfde",
|
95
|
+
"⅖" => "tweevijfde",
|
96
|
+
"⅖" => "tweevijfde",
|
97
|
+
"⅗" => "drievijfde",
|
98
|
+
"⅗" => "drievijfde",
|
99
|
+
"⅘" => "viervijfde",
|
100
|
+
"⅘" => "viervijfde",
|
101
|
+
"⅙" => "eenzesde",
|
102
|
+
"⅙" => "eenzesde",
|
103
|
+
"⅚" => "vijfzesde",
|
104
|
+
"⅚" => "vijfzesde",
|
105
|
+
"⅛" => "eenachtste",
|
106
|
+
"⅛" => "eenachtste",
|
107
|
+
"⅜" => "drieachtste",
|
108
|
+
"⅜" => "drieachtste",
|
109
|
+
"⅝" => "vijfachtste",
|
110
|
+
"⅝" => "vijfachtste",
|
111
|
+
"⅞" => "zevenachtste",
|
112
|
+
"⅞" => "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 & Sympathy" => "Tea e Sympathy",
|
52
|
+
"10¢" => "10 centavos",
|
53
|
+
"©2000" => "(c)2000",
|
54
|
+
"98° is fine" => "98 graus is fine",
|
55
|
+
"10÷5" => "10 dividido por 5",
|
56
|
+
""quoted"" => '"quoted"',
|
57
|
+
"to be continued…" => "to be continued...",
|
58
|
+
"2000–2004" => "2000-2004",
|
59
|
+
"I wish—oh, never mind" => "I wish--oh, never mind",
|
60
|
+
"½ ounce of gold" => "metade ounce of gold",
|
61
|
+
"1 and ¼ ounces of silver" => "1 and um quarto ounces of silver",
|
62
|
+
"9 and ¾ ounces of platinum" => "9 and três quartos ounces of platinum",
|
63
|
+
"3>2" => "3>2",
|
64
|
+
"2<3" => "2<3",
|
65
|
+
"two words" => "two words",
|
66
|
+
"£100" => "libras 100",
|
67
|
+
"Walmart®" => "Walmart(r)",
|
68
|
+
"'single quoted'" => "'single quoted'",
|
69
|
+
"2×4" => "2x4",
|
70
|
+
"Programming™" => "Programming(tm)",
|
71
|
+
"¥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
|
+
"½" => "metade",
|
81
|
+
"½" => "metade",
|
82
|
+
"½" => "metade",
|
83
|
+
"⅓" => "um terço",
|
84
|
+
"⅓" => "um terço",
|
85
|
+
"⅔" => "dois terços",
|
86
|
+
"⅔" => "dois terços",
|
87
|
+
"¼" => "um quarto",
|
88
|
+
"¼" => "um quarto",
|
89
|
+
"¼" => "um quarto",
|
90
|
+
"¾" => "três quartos",
|
91
|
+
"¾" => "três quartos",
|
92
|
+
"¾" => "três quartos",
|
93
|
+
"⅕" => "um quinto",
|
94
|
+
"⅕" => "um quinto",
|
95
|
+
"⅖" => "dois quintos",
|
96
|
+
"⅖" => "dois quintos",
|
97
|
+
"⅗" => "três quintos",
|
98
|
+
"⅗" => "três quintos",
|
99
|
+
"⅘" => "quatro quintos",
|
100
|
+
"⅘" => "quatro quintos",
|
101
|
+
"⅙" => "um sexto",
|
102
|
+
"⅙" => "um sexto",
|
103
|
+
"⅚" => "cinco sextos",
|
104
|
+
"⅚" => "cinco sextos",
|
105
|
+
"⅛" => "um oitavo",
|
106
|
+
"⅛" => "um oitavo",
|
107
|
+
"⅜" => "três oitavos",
|
108
|
+
"⅜" => "três oitavos",
|
109
|
+
"⅝" => "cinco oitavos",
|
110
|
+
"⅝" => "cinco oitavos",
|
111
|
+
"⅞" => "sete oitavos",
|
112
|
+
"⅞" => "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
|
@@ -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… <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
|
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-
|
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… <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
|