csl 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/features/step_definitions/locale_steps.rb +7 -5
- data/features/step_definitions/parser_steps.rb +8 -8
- data/features/step_definitions/style_steps.rb +3 -3
- data/lib/csl/loader.rb +3 -3
- data/lib/csl/node.rb +5 -0
- data/lib/csl/style/group.rb +1 -6
- data/lib/csl/version.rb +1 -1
- data/spec/csl/info_spec.rb +50 -50
- data/spec/csl/locale/date_spec.rb +13 -13
- data/spec/csl/locale/style_options_spec.rb +3 -3
- data/spec/csl/locale/term_spec.rb +51 -51
- data/spec/csl/locale_spec.rb +36 -36
- data/spec/csl/node_spec.rb +64 -62
- data/spec/csl/parser_spec.rb +19 -19
- data/spec/csl/schema_spec.rb +27 -26
- data/spec/csl/style/choose_spec.rb +8 -8
- data/spec/csl/style/date_spec.rb +2 -2
- data/spec/csl/style/label_spec.rb +8 -8
- data/spec/csl/style/names_spec.rb +2 -2
- data/spec/csl/style/number_spec.rb +17 -17
- data/spec/csl/style/sort_spec.rb +1 -1
- data/spec/csl/style_spec.rb +27 -27
- data/spec/csl/treelike_spec.rb +20 -20
- metadata +2 -2
@@ -6,15 +6,15 @@ module CSL
|
|
6
6
|
|
7
7
|
let(:date) { Locale::Date.new }
|
8
8
|
|
9
|
-
it {
|
9
|
+
it { is_expected.not_to be_nil }
|
10
10
|
|
11
|
-
it {
|
12
|
-
it {
|
11
|
+
it { is_expected.to be_text }
|
12
|
+
it { is_expected.not_to be_numeric }
|
13
13
|
|
14
14
|
describe '#parts' do
|
15
15
|
|
16
16
|
it 'returns nil by default' do
|
17
|
-
date.parts.
|
17
|
+
expect(date.parts).to be_empty
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
@@ -22,11 +22,11 @@ module CSL
|
|
22
22
|
describe '#to_xml' do
|
23
23
|
|
24
24
|
it 'returns <date/> by default' do
|
25
|
-
Locale::Date.new.to_xml.
|
25
|
+
expect(Locale::Date.new.to_xml).to eq('<date/>')
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'returns <date form="numeric"/> for an empty numeric date' do
|
29
|
-
Locale::Date.new(:form => 'numeric').to_xml.
|
29
|
+
expect(Locale::Date.new(:form => 'numeric').to_xml).to eq('<date form="numeric"/>')
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
@@ -35,24 +35,24 @@ module CSL
|
|
35
35
|
|
36
36
|
describe Locale::DatePart do
|
37
37
|
|
38
|
-
it {
|
38
|
+
it { is_expected.not_to be_nil }
|
39
39
|
|
40
|
-
it {
|
41
|
-
it {
|
42
|
-
it {
|
40
|
+
it { is_expected.not_to be_day }
|
41
|
+
it { is_expected.not_to be_month }
|
42
|
+
it { is_expected.not_to be_year }
|
43
43
|
|
44
44
|
describe '#to_xml' do
|
45
45
|
|
46
46
|
it 'returns <date-part/> by default' do
|
47
|
-
Locale::DatePart.new.to_xml.
|
47
|
+
expect(Locale::DatePart.new.to_xml).to eq("<date-part/>")
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'returns <date-part name="year"/> when the name is "year"' do
|
51
|
-
Locale::DatePart.new(:name => 'year').to_xml.
|
51
|
+
expect(Locale::DatePart.new(:name => 'year').to_xml).to eq('<date-part name="year"/>')
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'returns <date-part name="month" form="numeric" prefix="-"/> for a numeric month with prefix "-"' do
|
55
|
-
Locale::DatePart.new(:name => 'month', :form => 'numeric', :prefix => '-').to_xml.
|
55
|
+
expect(Locale::DatePart.new(:name => 'month', :form => 'numeric', :prefix => '-').to_xml).to match(/(\s(name|form|prefix)="[^"]+"){3}/)
|
56
56
|
end
|
57
57
|
|
58
58
|
end
|
@@ -3,15 +3,15 @@ require 'spec_helper'
|
|
3
3
|
module CSL
|
4
4
|
describe Locale::StyleOptions do
|
5
5
|
|
6
|
-
it {
|
6
|
+
it { is_expected.not_to be nil }
|
7
7
|
|
8
8
|
it 'punctuation-in-quote is false by default' do
|
9
|
-
subject[:'punctuation-in-quote'].
|
9
|
+
expect(subject[:'punctuation-in-quote']).to be false
|
10
10
|
end
|
11
11
|
|
12
12
|
describe '#to_xml' do
|
13
13
|
it 'returns <style-options punctuation-in-quote="false"/> by default' do
|
14
|
-
subject.to_xml.
|
14
|
+
expect(subject.to_xml).to match(/<style-options\/>/)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -4,17 +4,17 @@ require 'spec_helper'
|
|
4
4
|
module CSL
|
5
5
|
describe Locale::Terms do
|
6
6
|
|
7
|
-
it {
|
7
|
+
it { is_expected.not_to be nil }
|
8
8
|
|
9
9
|
describe '#to_xml' do
|
10
10
|
it 'returns <terms/> by default' do
|
11
|
-
subject.to_xml.
|
11
|
+
expect(subject.to_xml).to eq('<terms/>')
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
describe '.specialize' do
|
16
16
|
it 'filters the passed in hash to contain only match-able entries' do
|
17
|
-
Locale::Term.specialize({ :form => 'short', :foo => 'bar' }).
|
17
|
+
expect(Locale::Term.specialize({ :form => 'short', :foo => 'bar' })).to eq({ :form => 'short' })
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -39,7 +39,7 @@ module CSL
|
|
39
39
|
ordinal ordinal-01 ordinal-02 ordinal-03 ordinal
|
40
40
|
}.each_with_index do |ordinal, number|
|
41
41
|
it "returns #{ordinal.inspect} for #{number}" do
|
42
|
-
en.ordinalize(number)[:name].
|
42
|
+
expect(en.ordinalize(number)[:name]).to eq(ordinal)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -84,32 +84,32 @@ module CSL
|
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'returns nil if there is no matching term' do
|
87
|
-
en.lookup(:foo).
|
87
|
+
expect(en.lookup(:foo)).to be_nil
|
88
88
|
end
|
89
89
|
|
90
90
|
it 'returns the long form by default' do
|
91
|
-
en.lookup(:page).
|
91
|
+
expect(en.lookup(:page)).to be_long
|
92
92
|
end
|
93
93
|
|
94
94
|
it 'returns the term in the passed-in form if available' do
|
95
|
-
en.lookup(:section, :form => 'long').
|
96
|
-
en.lookup(:section, :form => 'short').
|
97
|
-
en.lookup(:section, :form => 'symbol').
|
95
|
+
expect(en.lookup(:section, :form => 'long')).to be_long
|
96
|
+
expect(en.lookup(:section, :form => 'short')).to be_short
|
97
|
+
expect(en.lookup(:section, :form => 'symbol')).to be_symbol
|
98
98
|
|
99
|
-
en.lookup(:editor).
|
100
|
-
en.lookup(:editor, :form => 'long').
|
101
|
-
en.lookup(:editor, :form => 'verb').
|
102
|
-
en.lookup(:editor, :form => 'verb-short').
|
99
|
+
expect(en.lookup(:editor)).to be_long
|
100
|
+
expect(en.lookup(:editor, :form => 'long')).to be_long
|
101
|
+
expect(en.lookup(:editor, :form => 'verb')).to be_verb
|
102
|
+
expect(en.lookup(:editor, :form => 'verb-short')).to be_verb_short
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'returns the right fallback form if the passed-in form is not available' do
|
106
|
-
en.lookup(:page, :form => 'verb').
|
107
|
-
en.lookup(:page, :form => 'verb-short').
|
108
|
-
en.lookup(:page, :form => 'symbol').
|
106
|
+
expect(en.lookup(:page, :form => 'verb')).to be_long
|
107
|
+
expect(en.lookup(:page, :form => 'verb-short')).to be_long
|
108
|
+
expect(en.lookup(:page, :form => 'symbol')).to be_short
|
109
109
|
end
|
110
110
|
|
111
111
|
it 'ignores irrelevant options' do
|
112
|
-
en.lookup(:page, :plural => true).
|
112
|
+
expect(en.lookup(:page, :plural => true)).not_to be_nil
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -118,23 +118,23 @@ module CSL
|
|
118
118
|
|
119
119
|
describe Locale::Term do
|
120
120
|
|
121
|
-
it {
|
121
|
+
it { is_expected.not_to be_nil }
|
122
122
|
|
123
|
-
it {
|
124
|
-
it {
|
123
|
+
it { is_expected.not_to be_gendered }
|
124
|
+
it { is_expected.to be_neutral }
|
125
125
|
|
126
|
-
it {
|
126
|
+
it { is_expected.to be_long }
|
127
127
|
|
128
|
-
it {
|
129
|
-
it {
|
130
|
-
it {
|
128
|
+
it { is_expected.not_to be_ordinal }
|
129
|
+
it { is_expected.not_to be_short_ordinal }
|
130
|
+
it { is_expected.not_to be_long_ordinal }
|
131
131
|
|
132
132
|
it 'is not a textnode by default' do
|
133
|
-
subject.
|
133
|
+
expect(subject).not_to be_textnode
|
134
134
|
end
|
135
135
|
|
136
136
|
it 'is a textnode when the text is "foo"' do
|
137
|
-
Locale::Term.new { |t| t.text = 'foo' }.
|
137
|
+
expect(Locale::Term.new { |t| t.text = 'foo' }).to be_textnode
|
138
138
|
end
|
139
139
|
|
140
140
|
describe 'gender attribute is set' do
|
@@ -142,72 +142,72 @@ module CSL
|
|
142
142
|
let(:f) { Locale::Term.new(:name => 'edition') { |t| t.feminine!; t.text = 'Ausgabe' } }
|
143
143
|
|
144
144
|
it 'is gendered' do
|
145
|
-
m.
|
146
|
-
f.
|
145
|
+
expect(m).to be_gendered
|
146
|
+
expect(f).to be_gendered
|
147
147
|
end
|
148
148
|
|
149
149
|
it 'is feminine or masculine' do
|
150
|
-
m.
|
151
|
-
f.
|
150
|
+
expect(m).to be_masculine
|
151
|
+
expect(f).to be_feminine
|
152
152
|
end
|
153
153
|
|
154
154
|
it 'is not neutral' do
|
155
|
-
m.
|
156
|
-
f.
|
155
|
+
expect(m).not_to be_neutral
|
156
|
+
expect(f).not_to be_neutral
|
157
157
|
end
|
158
158
|
|
159
159
|
describe '#to_xml' do
|
160
160
|
it 'contains the correct gender' do
|
161
|
-
m.to_xml.
|
162
|
-
f.to_xml.
|
161
|
+
expect(m.to_xml).to match(/gender="masculine"/)
|
162
|
+
expect(f.to_xml).to match(/gender="feminine"/)
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
166
|
describe '#match?' do
|
167
167
|
it 'matches the name when passed a string' do
|
168
|
-
m.
|
168
|
+
expect(m).to be_match(:name => 'month-05')
|
169
169
|
end
|
170
170
|
|
171
171
|
it 'matches the name when passed a pattern' do
|
172
|
-
m.
|
172
|
+
expect(m).to be_match(:name => /month-\d\d/)
|
173
173
|
end
|
174
174
|
|
175
175
|
it 'matches when passed a matching hash without gender' do
|
176
|
-
f.
|
176
|
+
expect(f).to be_match(:name => 'edition')
|
177
177
|
end
|
178
178
|
|
179
179
|
it 'does not match when passed a matching hash with wrong gender' do
|
180
|
-
f.matches?(:name => 'edition', :gender => 'masculine').
|
180
|
+
expect(f.matches?(:name => 'edition', :gender => 'masculine')).not_to be_truthy
|
181
181
|
end
|
182
182
|
|
183
183
|
it 'matches when passed a matching hash with matching gender' do
|
184
|
-
f.matches?(:name => 'edition', :gender => 'feminine').
|
184
|
+
expect(f.matches?(:name => 'edition', :gender => 'feminine')).to be_truthy
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
188
188
|
describe '#exact_match?' do
|
189
189
|
it 'does not match when passed a matching hash without gender' do
|
190
|
-
f.
|
190
|
+
expect(f).not_to be_exact_match(:name => 'edition')
|
191
191
|
end
|
192
192
|
end
|
193
193
|
|
194
194
|
describe 'attributes#to_a' do
|
195
195
|
it 'returns an array of all attribute values of underlying struct' do
|
196
|
-
f.attributes.to_a.
|
196
|
+
expect(f.attributes.to_a).to eq(['edition', 'long', 'feminine', nil, nil])
|
197
197
|
end
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|
201
201
|
describe '#to_s' do
|
202
202
|
it 'returns an empty string by default' do
|
203
|
-
Locale::Term.new.to_s.
|
203
|
+
expect(Locale::Term.new.to_s).to eq('')
|
204
204
|
end
|
205
205
|
|
206
206
|
describe 'given a simple term' do
|
207
207
|
let(:node) { Locale::Term.new { |t| t.text = 'foo' } }
|
208
208
|
|
209
209
|
it "returns the term's text" do
|
210
|
-
node.to_s.
|
210
|
+
expect(node.to_s).to eq(node.text)
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
@@ -215,23 +215,23 @@ module CSL
|
|
215
215
|
let(:node) { Locale::Term.new { |t| t.single = 'shoe'; t.multiple = 'shoes' } }
|
216
216
|
|
217
217
|
it "returns the term's singular form by default" do
|
218
|
-
node.to_s.
|
218
|
+
expect(node.to_s).to eq(node.singularize)
|
219
219
|
end
|
220
220
|
|
221
221
|
it "returns the term's plural form when passed :number => :plural" do
|
222
|
-
node.to_s(:number => :plural).
|
222
|
+
expect(node.to_s(:number => :plural)).to eq(node.pluralize)
|
223
223
|
end
|
224
224
|
|
225
225
|
it "returns the term's plural form when passed :number => 2" do
|
226
|
-
node.to_s(:number => 2).
|
226
|
+
expect(node.to_s(:number => 2)).to eq(node.pluralize)
|
227
227
|
end
|
228
228
|
|
229
229
|
it "returns the term's singular form when passed :number => 1" do
|
230
|
-
node.to_s(:number => 1).
|
230
|
+
expect(node.to_s(:number => 1)).to eq(node.singularize)
|
231
231
|
end
|
232
232
|
|
233
233
|
it "returns the term's plural form when passed :plural => true" do
|
234
|
-
node.to_s(:plural => true).
|
234
|
+
expect(node.to_s(:plural => true)).to eq(node.pluralize)
|
235
235
|
end
|
236
236
|
|
237
237
|
end
|
@@ -239,15 +239,15 @@ module CSL
|
|
239
239
|
|
240
240
|
describe '#to_xml' do
|
241
241
|
it 'returns <term/> by default' do
|
242
|
-
subject.to_xml.
|
242
|
+
expect(subject.to_xml).to eq('<term/>')
|
243
243
|
end
|
244
244
|
|
245
245
|
it 'returns <term>foo</term> when the text is "foo"' do
|
246
|
-
Locale::Term.new { |t| t.text = 'foo' }.to_xml.
|
246
|
+
expect(Locale::Term.new { |t| t.text = 'foo' }.to_xml).to eq('<term>foo</term>')
|
247
247
|
end
|
248
248
|
|
249
249
|
it 'returns <term><multiple>foo</multiple></term> when multiple is "foo"' do
|
250
|
-
Locale::Term.new { |t| t.multiple = 'foo' }.to_xml.
|
250
|
+
expect(Locale::Term.new { |t| t.multiple = 'foo' }.to_xml).to eq('<term><multiple>foo</multiple></term>')
|
251
251
|
end
|
252
252
|
|
253
253
|
end
|
data/spec/csl/locale_spec.rb
CHANGED
@@ -15,7 +15,7 @@ module CSL
|
|
15
15
|
describe '.regions' do
|
16
16
|
|
17
17
|
it 'returns the default region when passed a language symbol' do
|
18
|
-
Locale.regions[:en].
|
18
|
+
expect(Locale.regions[:en]).to eq(:US)
|
19
19
|
end
|
20
20
|
|
21
21
|
end
|
@@ -25,7 +25,7 @@ module CSL
|
|
25
25
|
describe 'the language hash' do
|
26
26
|
it 'returns the default language when passed a region string' do
|
27
27
|
%w{ US en GB en AT de DE de }.map(&:to_sym).each_slice(2) do |region, language|
|
28
|
-
Locale.languages[region].
|
28
|
+
expect(Locale.languages[region]).to eq(language)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -40,28 +40,28 @@ module CSL
|
|
40
40
|
'de-AT' => 'de-AT'
|
41
41
|
}.each_pair do |tag, expected|
|
42
42
|
it "converts #{tag.inspect} to #{expected.inspect}" do
|
43
|
-
Locale.normalize(tag).
|
43
|
+
expect(Locale.normalize(tag)).to eq(expected)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
describe '.new' do
|
49
|
-
it {
|
49
|
+
it { is_expected.not_to be_nil }
|
50
50
|
|
51
51
|
it 'defaults to default language' do
|
52
|
-
Locale.new.language.
|
52
|
+
expect(Locale.new.language).to eq(Locale.default.split(/-/)[0].to_sym)
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'defaults to default region' do
|
56
|
-
Locale.new.region.
|
56
|
+
expect(Locale.new.region).to eq(Locale.default.split(/-/)[1].to_sym)
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'contains no dates by default' do
|
60
|
-
Locale.new.dates.
|
60
|
+
expect(Locale.new.dates).to be_nil
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'contains no terms by default' do
|
64
|
-
Locale.new.terms.
|
64
|
+
expect(Locale.new.terms).to be_nil
|
65
65
|
end
|
66
66
|
|
67
67
|
end
|
@@ -72,15 +72,15 @@ module CSL
|
|
72
72
|
let(:locale) { Locale.load('en-GB') }
|
73
73
|
|
74
74
|
it 'the returned locale has the correct IETF tag' do
|
75
|
-
locale.to_s.
|
75
|
+
expect(locale.to_s).to eq('en-GB')
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'the locale has language :en' do
|
79
|
-
locale.language.
|
79
|
+
expect(locale.language).to eq(:en)
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'the locale has region :GB' do
|
83
|
-
locale.region.
|
83
|
+
expect(locale.region).to eq(:GB)
|
84
84
|
end
|
85
85
|
|
86
86
|
end
|
@@ -91,17 +91,17 @@ module CSL
|
|
91
91
|
|
92
92
|
it 'when passed "en-GB" sets language to :en and region to :GB' do
|
93
93
|
locale.set('en-GB')
|
94
|
-
[locale.language, locale.region].
|
94
|
+
expect([locale.language, locale.region]).to eq([:en, :GB])
|
95
95
|
end
|
96
96
|
|
97
97
|
it 'when passed "de" sets language to :de and region to :DE' do
|
98
98
|
locale.set('de')
|
99
|
-
[locale.language, locale.region].
|
99
|
+
expect([locale.language, locale.region]).to eq([:de, :DE])
|
100
100
|
end
|
101
101
|
|
102
102
|
it 'when passed "-AT" sets language to :de and region to :AT' do
|
103
103
|
locale.set('-AT')
|
104
|
-
[locale.language, locale.region].
|
104
|
+
expect([locale.language, locale.region]).to eq([:de, :AT])
|
105
105
|
end
|
106
106
|
|
107
107
|
end
|
@@ -115,11 +115,11 @@ module CSL
|
|
115
115
|
end
|
116
116
|
|
117
117
|
it 'creates a duplicate option element if the first locale has no options' do
|
118
|
-
locale.
|
118
|
+
expect(locale).not_to have_options
|
119
119
|
locale.merge!(locale_with_options)
|
120
|
-
locale.
|
121
|
-
locale.options[:foo].
|
122
|
-
locale.options.
|
120
|
+
expect(locale).to have_options
|
121
|
+
expect(locale.options[:foo]).to eq('bar')
|
122
|
+
expect(locale.options).not_to equal(locale_with_options.options)
|
123
123
|
end
|
124
124
|
|
125
125
|
it 'merges the options if both locales have options' do
|
@@ -127,15 +127,15 @@ module CSL
|
|
127
127
|
|
128
128
|
expect { locale.merge!(locale_with_options) }.not_to change { locale.options.object_id }
|
129
129
|
|
130
|
-
locale.options[:foo].
|
131
|
-
locale.options[:bar].
|
130
|
+
expect(locale.options[:foo]).to eq('bar')
|
131
|
+
expect(locale.options[:bar]).to eq('foo')
|
132
132
|
end
|
133
133
|
|
134
134
|
it 'overrides the options with those in the other locale' do
|
135
135
|
locale << Locale::StyleOptions.new(:bar => 'foo', :foo => 'foo')
|
136
136
|
locale.merge!(locale_with_options)
|
137
|
-
locale.options[:foo].
|
138
|
-
locale.options[:bar].
|
137
|
+
expect(locale.options[:foo]).to eq('bar')
|
138
|
+
expect(locale.options[:bar]).to eq('foo')
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
@@ -146,19 +146,19 @@ module CSL
|
|
146
146
|
|
147
147
|
it 'creates duplicate date elements if the first locale has no options' do
|
148
148
|
locale.merge!(Locale.load('en-US'))
|
149
|
-
locale.
|
149
|
+
expect(locale).to have_dates
|
150
150
|
end
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
154
|
describe '#legacy?' do
|
155
155
|
it 'returns false by default' do
|
156
|
-
locale.
|
156
|
+
expect(locale).not_to be_legacy
|
157
157
|
end
|
158
158
|
|
159
159
|
it 'returns true if the version is less than 1.0.1' do
|
160
160
|
locale.version = '0.8'
|
161
|
-
locale.
|
161
|
+
expect(locale).to be_legacy
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
@@ -168,30 +168,30 @@ module CSL
|
|
168
168
|
locale.store 'open-quote', '»'
|
169
169
|
locale.store 'close-quote', '«'
|
170
170
|
|
171
|
-
locale.quote('foo').
|
171
|
+
expect(locale.quote('foo')).to eq('»foo«')
|
172
172
|
end
|
173
173
|
|
174
174
|
it 'does not alter the string if there are no quotes in the locale' do
|
175
|
-
locale.quote('foo').
|
175
|
+
expect(locale.quote('foo')).to eq('foo')
|
176
176
|
end
|
177
177
|
|
178
178
|
it 'adds quotes inside final punctuation if punctuation-in-quote option is set' do
|
179
179
|
locale.store 'open-quote', '»'
|
180
180
|
locale.store 'close-quote', '«'
|
181
181
|
|
182
|
-
locale.quote('foo.').
|
183
|
-
locale.quote('foo,').
|
182
|
+
expect(locale.quote('foo.')).to eq('»foo«.')
|
183
|
+
expect(locale.quote('foo,')).to eq('»foo«,')
|
184
184
|
|
185
|
-
locale.quote('foo!').
|
186
|
-
locale.quote('foo?').
|
185
|
+
expect(locale.quote('foo!')).to eq('»foo!«')
|
186
|
+
expect(locale.quote('foo?')).to eq('»foo?«')
|
187
187
|
|
188
188
|
locale.punctuation_in_quotes!
|
189
189
|
|
190
|
-
locale.quote('foo.').
|
191
|
-
locale.quote('foo,').
|
190
|
+
expect(locale.quote('foo.')).to eq('»foo.«')
|
191
|
+
expect(locale.quote('foo,')).to eq('»foo,«')
|
192
192
|
|
193
|
-
locale.quote('foo!').
|
194
|
-
locale.quote('foo?').
|
193
|
+
expect(locale.quote('foo!')).to eq('»foo!«')
|
194
|
+
expect(locale.quote('foo?')).to eq('»foo?«')
|
195
195
|
end
|
196
196
|
|
197
197
|
it 'replaces existing quotes with inner quotes' do
|
@@ -200,7 +200,7 @@ module CSL
|
|
200
200
|
locale.store 'open-inner-quote', '‘'
|
201
201
|
locale.store 'close-inner-quote', '’'
|
202
202
|
|
203
|
-
locale.quote('“foo”').
|
203
|
+
expect(locale.quote('“foo”')).to eq('“‘foo’”')
|
204
204
|
end
|
205
205
|
end
|
206
206
|
end
|