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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dd57180de9ed4d48bb5ce00393929be63df55fe
4
- data.tar.gz: c20b280f2e9ec6f596d0453fc4862e23cbf50dec
3
+ metadata.gz: 4ba697e8ee6beb0a5f0e7cb670c6e9e7310ef449
4
+ data.tar.gz: b533d511d930f657c16d33eb65514b740817559b
5
5
  SHA512:
6
- metadata.gz: 4d3ddca5ec5ab21e0d9e4ec973356e76f4abae8bf6b75868d7d4ffa7a10bd3853f510f280497302f3cc36f342a58f5238ab3650dc180085d36a595d21a2de4bc
7
- data.tar.gz: 2a6911020b2bedc729617cb95c88db7184c5447d897f52d8ebc6ac84dbfd5f92b12a6cba54f78fe871f361eb48b37b4abc3a44b379493c6cb99000595a6d04da
6
+ metadata.gz: bfe06f2128b18206ffa1cc3a201b04bc6e65f6ae6b84cad7314793914568ea25db42ec0e153ece3f2fdac7d20d00cc4b31faa2b33cd1fec6aed447bc9887b207
7
+ data.tar.gz: c4b0e5a5e26af8fe88d9ada3b7ac7aeb50ea4f3925fe835525e4c0fea427347dd78712d10f4da8913b08e14ad867b12e9fdc36b5862650321ffd8beab4c9fad9
@@ -11,7 +11,7 @@ When /^I ordinalize the number (\d+)(?: using the (long) form(?: and (feminine|m
11
11
  end
12
12
 
13
13
  Then /^the ordinal should (?:be|equal) "([^"]*)"$/ do |ord|
14
- @ordinal.should == ord
14
+ expect(@ordinal).to eq(ord)
15
15
  end
16
16
 
17
17
  When /^I ordinalize these numbers:?$/ do |table|
@@ -22,13 +22,15 @@ When /^I ordinalize these numbers:?$/ do |table|
22
22
  end
23
23
 
24
24
  Then /^the ordinals should (?:be|equal):?$/ do |table|
25
- @ordinals.join(' ').should == table.rows.flatten.join(' ')
25
+ expect(@ordinals.join(' ')).to eq(table.rows.flatten.join(' '))
26
26
  end
27
27
 
28
28
  Then /^the locale should should have (\d+) terms$/ do |num|
29
- @csl.terms.length.should == num.to_i
29
+ expect(@csl.terms.length).to eq(num.to_i)
30
30
  end
31
31
 
32
32
  Then /^the (\w+[\?!]?) of the term "([^"]*)" should be "([^"]*)"$/ do |method, name, expected|
33
- @csl.terms.detect { |t| t.name == name }.send(method).should == expected
34
- end
33
+ expect(
34
+ @csl.terms.detect { |t| t.name == name }.send(method)
35
+ ).to eq(expected)
36
+ end
@@ -6,35 +6,35 @@ end
6
6
  Then /^(?:the )?(\w+[\?!]?) should be "([^"]*)"$/ do |name, expected|
7
7
  actual = @csl.send(name)
8
8
  actual = !!actual if expected =~ /^true|false$/
9
- actual.to_s.should == expected
9
+ expect(actual.to_s).to eq(expected)
10
10
  end
11
11
 
12
12
  Then /^the (\w+) (\w+) should be "([^"]*)"$/ do |outer, inner, expected|
13
- @csl.send(outer).send(inner).to_s.should == expected
13
+ expect(@csl.send(outer).send(inner).to_s).to eq(expected)
14
14
  end
15
15
 
16
16
  Then /^the attribute "([^"]*)" should be "([^"]*)"$/ do |name, expected|
17
- @csl[name.to_sym].should == expected
17
+ expect(@csl[name.to_sym]).to eq(expected)
18
18
  end
19
19
 
20
20
  Then /^the node should have (\d+) (\w+)$/ do |length, name|
21
- @csl.send(name).length.should == length.to_i
21
+ expect(@csl.send(name).length).to eq(length.to_i)
22
22
  end
23
23
 
24
24
  Then /^the (\w+) number (\d+) should have the attribute "([^"]*)" set to "([^"]*)"$/ do |name, offset, attribute, expected|
25
- @csl.send("#{name}s")[offset.to_i - 1][attribute.to_sym].should == expected
25
+ expect(@csl.send("#{name}s")[offset.to_i - 1][attribute.to_sym]).to eq(expected)
26
26
  end
27
27
 
28
28
  Then /^the (\w+) number (\d+) should( not)? be a (\w+)$/ do |name, offset, negate, predicate|
29
- @csl.send("#{name}s")[offset.to_i - 1].send("#{predicate}?").should == negate.nil?
29
+ expect(@csl.send("#{name}s")[offset.to_i - 1].send("#{predicate}?")).to eq(negate.nil?)
30
30
  end
31
31
 
32
32
  Then /^the (\w+) number (\d+)'s (\w+) should( not)? be "([^"]*)"$/ do |name, offset, method, negate, expected|
33
33
  actual = @csl.send("#{name}s")[offset.to_i - 1].send(method).to_s
34
34
 
35
35
  if negate.nil?
36
- actual.should == expected
36
+ expect(actual).to eq(expected)
37
37
  else
38
- actual.should_not == expected
38
+ expect(actual).not_to eq(expected)
39
39
  end
40
40
  end
@@ -4,13 +4,13 @@ When /^I load the style from the string$/ do |string|
4
4
  end
5
5
 
6
6
  Then /^the locale (\d+) should should have (\d+) terms?$/ do |locale, term|
7
- @csl.locales[locale.to_i - 1].terms.length.should == term.to_i
7
+ expect(@csl.locales[locale.to_i - 1].terms.length).to eq(term.to_i)
8
8
  end
9
9
 
10
10
  Then /^the locale (\d+) (\w+\??) should be "([^"]*)"$/ do |locale, method, expected|
11
- @csl.locales[locale.to_i - 1].send(method).to_s.should == expected
11
+ expect(@csl.locales[locale.to_i - 1].send(method).to_s).to eq(expected)
12
12
  end
13
13
 
14
14
  Then /^the style should have (\d+) contributors$/ do |num|
15
- @csl.info.contributors.length.should == num.to_i
15
+ expect(@csl.info.contributors.length).to eq(num.to_i)
16
16
  end
@@ -72,11 +72,11 @@ module CSL
72
72
  input = input.to_s
73
73
 
74
74
  case
75
- when File.exists?(input)
75
+ when File.exist?(input)
76
76
  location = input
77
- when File.exists?(extend_name(input))
77
+ when File.exist?(extend_name(input))
78
78
  location = extend_name(input)
79
- when File.exists?(extend_path(input))
79
+ when File.exist?(extend_path(input))
80
80
  location = extend_path(input)
81
81
  else
82
82
  location = input
@@ -433,6 +433,11 @@ module CSL
433
433
  end
434
434
 
435
435
 
436
+ # The node's formatting options. If the node's parent responds
437
+ # to `inheritable_formatting_options`, these will be included
438
+ # in the result. This makes it easy for nodes to push formatting
439
+ # options to their child nodes.
440
+ #
436
441
  # @return [Hash] the node's formatting options
437
442
  def formatting_options
438
443
  options = attributes_for Schema.attr(:formatting)
@@ -5,8 +5,7 @@ module CSL
5
5
  # element (with the exception of {Layout}). Group nodes may carry the
6
6
  # delimiter attribute to separate their child elements, as well as
7
7
  # affixes and display attributes (applied to the output of the group
8
- # as a whole) and formatting attributes (transmitted to the enclosed
9
- # elements).
8
+ # as a whole).
10
9
  #
11
10
  # Groups implicitly act as a conditionals: a Group and its child
12
11
  # elements are suppressed if a) at least one rendering element in
@@ -27,10 +26,6 @@ module CSL
27
26
  def formatting_options
28
27
  attributes_for :display, *Schema.attr(:affixes)
29
28
  end
30
-
31
- def inheritable_formatting_options
32
- attributes_for :'text-case', *Schema.attr(:font)
33
- end
34
29
  end
35
30
 
36
31
  end
@@ -1,3 +1,3 @@
1
1
  module CSL
2
- VERSION = '1.2.1'.freeze
2
+ VERSION = '1.2.2'.freeze
3
3
  end
@@ -4,23 +4,23 @@ module CSL
4
4
 
5
5
  describe Info do
6
6
 
7
- it { should_not be_nil }
8
- it { should_not have_children }
7
+ it { is_expected.not_to be_nil }
8
+ it { is_expected.not_to have_children }
9
9
 
10
10
  before { @info = Info.new }
11
11
 
12
12
  describe '#nodename' do
13
13
  it 'returns "info"' do
14
- subject.nodename.should == 'info'
14
+ expect(subject.nodename).to eq('info')
15
15
  end
16
16
  end
17
17
 
18
18
  describe 'license' do
19
- it { should_not have_rights }
20
- it { should_not be_default_license }
19
+ it { is_expected.not_to have_rights }
20
+ it { is_expected.not_to be_default_license }
21
21
 
22
22
  it 'has no license by default' do
23
- @info.license.should be_nil
23
+ expect(@info.license).to be_nil
24
24
  end
25
25
 
26
26
  it 'setting a license adds a rights node' do
@@ -29,36 +29,36 @@ module CSL
29
29
 
30
30
  it 'setting the default license creates the default rights node' do
31
31
  @info.default_license!
32
- @info.should have_rights
33
- @info.should be_default_license
32
+ expect(@info).to have_rights
33
+ expect(@info).to be_default_license
34
34
 
35
35
  @info.rights.text = 'cc'
36
- @info.should_not be_default_license
36
+ expect(@info).not_to be_default_license
37
37
 
38
38
  @info.default_license!
39
- @info.should be_default_license
39
+ expect(@info).to be_default_license
40
40
  end
41
41
  end
42
42
 
43
43
  describe '#children' do
44
44
  it 'returns a Info::Children instance' do
45
- @info.children.should be_a(Info::Children)
45
+ expect(@info.children).to be_a(Info::Children)
46
46
  end
47
47
 
48
48
  it 'allows to set the id by array accessor' do
49
- lambda { Info.new.children[:id] = 'foo' }.should_not raise_error
49
+ expect { Info.new.children[:id] = 'foo' }.not_to raise_error
50
50
  end
51
51
  end
52
52
 
53
53
  describe '#category' do
54
54
  it 'returns an empty list by default' do
55
- @info.category.should be_empty
55
+ expect(@info.category).to be_empty
56
56
  end
57
57
  end
58
58
 
59
59
  describe 'citation-format' do
60
60
  it 'has no citation-format by default' do
61
- @info.citation_format.should be_nil
61
+ expect(@info.citation_format).to be_nil
62
62
  end
63
63
 
64
64
  it 'setting a citation-format creates a new category node' do
@@ -73,7 +73,7 @@ module CSL
73
73
  before { @info.add_child Info::Category.new(:'citation-format' => 'author') }
74
74
 
75
75
  it 'has a citation format' do
76
- @info.citation_format.should == :author
76
+ expect(@info.citation_format).to eq(:author)
77
77
  end
78
78
 
79
79
  it 'setting a citation-format does not create a new category node' do
@@ -89,7 +89,7 @@ module CSL
89
89
  before { @info.add_child Info::Category.new(:field => 'literature') }
90
90
 
91
91
  it 'has no citation-format by default' do
92
- @info.citation_format.should be_nil
92
+ expect(@info.citation_format).to be_nil
93
93
  end
94
94
 
95
95
  it 'setting a citation-format creates a new category node' do
@@ -103,20 +103,20 @@ module CSL
103
103
  end
104
104
 
105
105
  describe 'link accessors' do
106
- it { should_not have_self_link }
107
- it { should_not have_documentation_link }
108
- it { should_not have_template_link }
106
+ it { is_expected.not_to have_self_link }
107
+ it { is_expected.not_to have_documentation_link }
108
+ it { is_expected.not_to have_template_link }
109
109
 
110
110
  it 'self_link is nil by default' do
111
- @info.self_link.should be_nil
111
+ expect(@info.self_link).to be_nil
112
112
  end
113
113
 
114
114
  it 'returns nil if no suitable link is set' do
115
- Info.new {|i| i.link = {:href => 'foo', :rel => 'documentation'} }.self_link.should be_nil
115
+ expect(Info.new {|i| i.link = {:href => 'foo', :rel => 'documentation'} }.self_link).to be_nil
116
116
  end
117
117
 
118
118
  it 'returns the href value of the link if it is set' do
119
- Info.new {|i| i.link = {:href => 'foo', :rel => 'self'} }.self_link.should == 'foo'
119
+ expect(Info.new {|i| i.link = {:href => 'foo', :rel => 'self'} }.self_link).to eq('foo')
120
120
  end
121
121
 
122
122
  it 'setter changes the value of existing link' do
@@ -126,73 +126,73 @@ module CSL
126
126
 
127
127
  it 'setter creates new link node if link did not exist' do
128
128
  expect { @info.self_link = 'bar' }.to change { @info.has_self_link? }
129
- @info.links[0].should be_a(Info::Link)
129
+ expect(@info.links[0]).to be_a(Info::Link)
130
130
  end
131
131
 
132
132
  end
133
133
 
134
134
  describe '#to_xml' do
135
135
  it 'returns an empty info element by default' do
136
- subject.to_xml.should == '<info/>'
136
+ expect(subject.to_xml).to eq('<info/>')
137
137
  end
138
138
 
139
139
  it 'prints the id if present' do
140
- Info.new { |i| i.set_child_id 'apa' }.to_xml.should == '<info><id>apa</id></info>'
140
+ expect(Info.new { |i| i.set_child_id 'apa' }.to_xml).to eq('<info><id>apa</id></info>')
141
141
  end
142
142
 
143
143
  it 'prints the category if present' do
144
- Info.new { |i| i.category = {:'citation-format' => 'author'} }.to_xml.should == '<info><category citation-format="author"/></info>'
144
+ expect(Info.new { |i| i.category = {:'citation-format' => 'author'} }.to_xml).to eq('<info><category citation-format="author"/></info>')
145
145
  end
146
146
  end
147
147
 
148
148
  describe '#dup' do
149
149
  it 'does not copy ancestors' do
150
150
  apa = Style.load(:apa).info
151
- apa.should be_a(Info)
151
+ expect(apa).to be_a(Info)
152
152
 
153
- apa.should_not be_root
154
- apa.dup.should be_root
153
+ expect(apa).not_to be_root
154
+ expect(apa.dup).to be_root
155
155
  end
156
156
  end
157
157
 
158
158
  describe '#deep_copy' do
159
159
  it 'copies the full sub-tree' do
160
160
  apa = Style.load(:apa).info
161
- apa.should be_a(Info)
161
+ expect(apa).to be_a(Info)
162
162
 
163
163
  xml = apa.to_xml
164
164
 
165
165
  copy = apa.deep_copy
166
166
 
167
- apa.to_xml.should == xml # original unchanged!
168
- copy.to_xml.should == xml
167
+ expect(apa.to_xml).to eq(xml) # original unchanged!
168
+ expect(copy.to_xml).to eq(xml)
169
169
  end
170
170
  end
171
171
 
172
172
  describe '#pretty_print' do
173
173
  it 'returns an empty info element by default' do
174
- subject.pretty_print.should == '<info/>'
174
+ expect(subject.pretty_print).to eq('<info/>')
175
175
  end
176
176
 
177
177
  it 'prints the id indented if present' do
178
- Info.new { |i| i.set_child_id 'apa' }.pretty_print.should == "<info>\n <id>apa</id>\n</info>"
178
+ expect(Info.new { |i| i.set_child_id 'apa' }.pretty_print).to eq("<info>\n <id>apa</id>\n</info>")
179
179
  end
180
180
  end
181
181
 
182
182
  describe '#tags' do
183
183
  it 'returns a list with an empty info element by default' do
184
- subject.tags.should == ['<info/>']
184
+ expect(subject.tags).to eq(['<info/>'])
185
185
  end
186
186
 
187
187
  it 'returns a nested list if id is present' do
188
- Info.new { |i| i.set_child_id 'apa' }.tags.should == ['<info>', ['<id>apa</id>'], '</info>']
188
+ expect(Info.new { |i| i.set_child_id 'apa' }.tags).to eq(['<info>', ['<id>apa</id>'], '</info>'])
189
189
  end
190
190
 
191
191
  end
192
192
  end
193
193
 
194
194
  describe Info::Author do
195
- it { should_not be_nil }
195
+ it { is_expected.not_to be_nil }
196
196
 
197
197
  let(:poe) {
198
198
  Info::Author.new { |a|
@@ -203,33 +203,33 @@ module CSL
203
203
 
204
204
  describe '#name' do
205
205
  it 'returns nil by default' do
206
- subject.name.should be nil
206
+ expect(subject.name).to be nil
207
207
  end
208
208
 
209
209
  it 'returns the name if set' do
210
- poe.name.to_s.should == 'E. A. Poe'
210
+ expect(poe.name.to_s).to eq('E. A. Poe')
211
211
  end
212
212
  end
213
213
 
214
214
  describe '#family' do
215
215
  it "returns the author's family name" do
216
- poe.family.should == 'Poe'
216
+ expect(poe.family).to eq('Poe')
217
217
  end
218
218
  end
219
219
 
220
220
  describe '#email' do
221
221
  it 'returns the email' do
222
- poe.email.to_s.should == 'poe@baltimore.com'
222
+ expect(poe.email.to_s).to eq('poe@baltimore.com')
223
223
  end
224
224
  end
225
225
 
226
226
  describe '#to_xml' do
227
227
  it 'returns an empty author by default' do
228
- subject.to_xml.should == '<author/>'
228
+ expect(subject.to_xml).to eq('<author/>')
229
229
  end
230
230
 
231
231
  it 'prints all children' do
232
- poe.to_xml.should == '<author><name>E. A. Poe</name><email>poe@baltimore.com</email></author>'
232
+ expect(poe.to_xml).to eq('<author><name>E. A. Poe</name><email>poe@baltimore.com</email></author>')
233
233
  end
234
234
  end
235
235
 
@@ -237,31 +237,31 @@ module CSL
237
237
 
238
238
  describe Info::Contributor do
239
239
 
240
- it { should_not be_nil }
240
+ it { is_expected.not_to be_nil }
241
241
 
242
242
  let(:bruce) { Info::Contributor.new { |c| c.name = "Bruce D'Arcus" } }
243
243
 
244
244
  describe '#name' do
245
245
  it 'returns the name' do
246
- bruce.name.to_s.should == "Bruce D'Arcus"
246
+ expect(bruce.name.to_s).to eq("Bruce D'Arcus")
247
247
  end
248
248
  end
249
249
 
250
250
 
251
251
  describe '#to_xml' do
252
252
  it 'returns an empty contributor by default' do
253
- subject.to_xml.should == '<contributor/>'
253
+ expect(subject.to_xml).to eq('<contributor/>')
254
254
  end
255
255
 
256
256
  it 'prints the name tag if present' do
257
- bruce.to_xml.should == "<contributor><name>Bruce D'Arcus</name></contributor>"
257
+ expect(bruce.to_xml).to eq("<contributor><name>Bruce D'Arcus</name></contributor>")
258
258
  end
259
259
  end
260
260
 
261
261
  end
262
262
 
263
263
  describe Info::Rights do
264
- it { should_not be_nil }
264
+ it { is_expected.not_to be_nil }
265
265
 
266
266
  describe '#dup' do
267
267
  it 'copies attributes and text' do
@@ -269,8 +269,8 @@ module CSL
269
269
  r[:license] = 'bar'
270
270
 
271
271
  c = r.dup
272
- c.text.should == 'foo'
273
- c[:license].should == 'bar'
272
+ expect(c.text).to eq('foo')
273
+ expect(c[:license]).to eq('bar')
274
274
  end
275
275
  end
276
276
  end