csl 1.0.0.pre5 → 1.0.0.pre6
Sign up to get free protection for your applications and to get access to all the features.
- data/csl.gemspec +3 -0
- data/features/locales/ordinalize.feature +288 -399
- data/lib/csl.rb +3 -0
- data/lib/csl/info.rb +31 -18
- data/lib/csl/locale.rb +64 -168
- data/lib/csl/locale/ordinalize.rb +130 -0
- data/lib/csl/locale/term.rb +67 -30
- data/lib/csl/node.rb +44 -2
- data/lib/csl/schema.rb +4 -0
- data/lib/csl/style/number.rb +2 -1
- data/lib/csl/style/text.rb +6 -4
- data/lib/csl/version.rb +1 -1
- data/spec/csl/info_spec.rb +7 -1
- data/spec/csl/locale/term_spec.rb +1 -1
- data/spec/csl/node_spec.rb +40 -0
- metadata +23 -8
data/lib/csl/version.rb
CHANGED
data/spec/csl/info_spec.rb
CHANGED
@@ -159,7 +159,13 @@ module CSL
|
|
159
159
|
|
160
160
|
it 'returns the name if set' do
|
161
161
|
poe.name.to_s.should == 'E. A. Poe'
|
162
|
-
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe '#family' do
|
166
|
+
it "returns the author's family name" do
|
167
|
+
poe.family.should == 'Poe'
|
168
|
+
end
|
163
169
|
end
|
164
170
|
|
165
171
|
describe '#email' do
|
@@ -85,7 +85,7 @@ module CSL
|
|
85
85
|
|
86
86
|
describe 'attributes#to_a' do
|
87
87
|
it 'returns an array of all attribute values of underlying struct' do
|
88
|
-
f.attributes.to_a.should == ['edition', nil, 'feminine', nil]
|
88
|
+
f.attributes.to_a.should == ['edition', nil, 'feminine', nil, nil]
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
data/spec/csl/node_spec.rb
CHANGED
@@ -33,6 +33,46 @@ module CSL
|
|
33
33
|
FooBarNode.new.attributes.should be_a(Struct)
|
34
34
|
end
|
35
35
|
|
36
|
+
describe '#attributes_for' do
|
37
|
+
it 'returns an empty hash when there no attributes are set' do
|
38
|
+
TestNode.new.attributes_for.should be_empty
|
39
|
+
TestNode.new.attributes_for(:x, :y).should be_empty
|
40
|
+
|
41
|
+
FooBarNode.new.attributes_for.should be_empty
|
42
|
+
FooBarNode.new.attributes_for(:x, :y).should be_empty
|
43
|
+
FooBarNode.new.attributes_for(:foo, :bar).should be_empty
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'returns an empty hash when no attributes match the filter' do
|
47
|
+
TestNode.new(:foo => 'foo').attributes_for.should be_empty
|
48
|
+
TestNode.new(:foo => 'foo').attributes_for(:x, :y).should be_empty
|
49
|
+
|
50
|
+
FooBarNode.new(:foo => 'foo').attributes_for.should be_empty
|
51
|
+
FooBarNode.new(:foo => 'foo').attributes_for(:x, :y).should be_empty
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'returns a hash of all set attributes that match the filter' do
|
55
|
+
TestNode.new(:foo => 'foo', :bar => 'bar').attributes_for(:x, :foo).should == { :foo => 'foo' }
|
56
|
+
FooBarNode.new(:foo => 'foo', :bar => 'bar').attributes_for(:x, :foo).should == { :foo => 'foo' }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#formatting_options' do
|
61
|
+
it 'returns an empty hash by default' do
|
62
|
+
TestNode.new.formatting_options.should be_empty
|
63
|
+
FooBarNode.new.formatting_options.should be_empty
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'returns an empty hash if there are no formatting attributes' do
|
67
|
+
TestNode.new(:foo => 'foo', :bar => 'bar').formatting_options.should be_empty
|
68
|
+
FooBarNode.new(:foo => 'foo', :bar => 'bar').formatting_options.should be_empty
|
69
|
+
end
|
70
|
+
|
71
|
+
it "returns a hash of the node's formatting attributes" do
|
72
|
+
TestNode.new(:foo => 'foo', :'font-style' => 'italic').formatting_options.should == { :'font-style' => 'italic' }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
36
76
|
describe '#values_at' do
|
37
77
|
it 'FooBarNode accepts attribute names' do
|
38
78
|
FooBarNode.new(:foo => 'Foo', :bar => 'Bar').values_at(:bar, :foo).should == %w{ Bar Foo }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.pre6
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: namae
|
16
|
+
requirement: &70235476097460 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.3'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70235476097460
|
14
25
|
- !ruby/object:Gem::Dependency
|
15
26
|
name: cucumber
|
16
|
-
requirement: &
|
27
|
+
requirement: &70235476095920 !ruby/object:Gem::Requirement
|
17
28
|
none: false
|
18
29
|
requirements:
|
19
30
|
- - ~>
|
@@ -21,10 +32,10 @@ dependencies:
|
|
21
32
|
version: '1.1'
|
22
33
|
type: :development
|
23
34
|
prerelease: false
|
24
|
-
version_requirements: *
|
35
|
+
version_requirements: *70235476095920
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: rspec
|
27
|
-
requirement: &
|
38
|
+
requirement: &70235476095040 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ~>
|
@@ -32,10 +43,10 @@ dependencies:
|
|
32
43
|
version: '2.7'
|
33
44
|
type: :development
|
34
45
|
prerelease: false
|
35
|
-
version_requirements: *
|
46
|
+
version_requirements: *70235476095040
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: rake
|
38
|
-
requirement: &
|
49
|
+
requirement: &70235476093880 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ~>
|
@@ -43,7 +54,7 @@ dependencies:
|
|
43
54
|
version: '0.9'
|
44
55
|
type: :development
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *70235476093880
|
47
58
|
description: ! "\n\t\tA Ruby parser and library for the Citation Style Language (CSL),
|
48
59
|
an open\n\t\tXML-based language to describe the formatting of citations and\n\t\tbibliographies.\n\t\t"
|
49
60
|
email:
|
@@ -85,6 +96,7 @@ files:
|
|
85
96
|
- lib/csl/loader.rb
|
86
97
|
- lib/csl/locale.rb
|
87
98
|
- lib/csl/locale/date.rb
|
99
|
+
- lib/csl/locale/ordinalize.rb
|
88
100
|
- lib/csl/locale/style_options.rb
|
89
101
|
- lib/csl/locale/term.rb
|
90
102
|
- lib/csl/node.rb
|
@@ -150,6 +162,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
162
|
- - ! '>='
|
151
163
|
- !ruby/object:Gem::Version
|
152
164
|
version: '0'
|
165
|
+
segments:
|
166
|
+
- 0
|
167
|
+
hash: -1174116000555446406
|
153
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
169
|
none: false
|
155
170
|
requirements:
|