csl 1.0.0.pre4 → 1.0.0.pre5
Sign up to get free protection for your applications and to get access to all the features.
- data/features/locales/ordinalize.feature +12 -9
- data/lib/csl/info.rb +9 -1
- data/lib/csl/style.rb +1 -1
- data/lib/csl/version.rb +1 -1
- data/spec/csl/info_spec.rb +46 -0
- metadata +8 -8
@@ -127,11 +127,11 @@ Feature: Converting numbers to ordinals using CSL locales
|
|
127
127
|
<term name="long-ordinal-01">erstes</term>
|
128
128
|
<term name="long-ordinal-01" gender-form="feminine">
|
129
129
|
<single>erste</single>
|
130
|
-
<multiple>ersten</multiple>
|
130
|
+
<multiple>ersten</multiple>
|
131
131
|
</term>
|
132
132
|
<term name="long-ordinal-01" gender-form="masculine">
|
133
133
|
<single>erster</single>
|
134
|
-
<multiple>ersten</multiple>
|
134
|
+
<multiple>ersten</multiple>
|
135
135
|
</term>
|
136
136
|
<term name="long-ordinal-02">zweites</term>
|
137
137
|
<term name="long-ordinal-02" gender-form="feminine">zweite</term>
|
@@ -187,17 +187,20 @@ Feature: Converting numbers to ordinals using CSL locales
|
|
187
187
|
<single>e</single>
|
188
188
|
<multiple>es</multiple>
|
189
189
|
</term>
|
190
|
-
|
191
|
-
<term name="ordinal-01">
|
192
|
-
|
190
|
+
|
191
|
+
<term name="ordinal-01" modulo="1">
|
192
|
+
<single>re</single>
|
193
|
+
<multiple>res</multiple>
|
194
|
+
</term>
|
195
|
+
<term name="ordinal-01" gender-form="feminine" modulo="1">
|
193
196
|
<single>re</single>
|
194
197
|
<multiple>res</multiple>
|
195
198
|
</term>
|
196
|
-
<term name="ordinal-01" gender-form="masculine">
|
199
|
+
<term name="ordinal-01" gender-form="masculine" modulo="1">
|
197
200
|
<single>er</single>
|
198
201
|
<multiple>ers</multiple>
|
199
202
|
</term>
|
200
|
-
|
203
|
+
|
201
204
|
</terms>
|
202
205
|
</locale>
|
203
206
|
"""
|
@@ -439,7 +442,7 @@ Feature: Converting numbers to ordinals using CSL locales
|
|
439
442
|
<term name="ordinal-17">de</term>
|
440
443
|
<term name="ordinal-18">de</term>
|
441
444
|
<term name="ordinal-19">de</term>
|
442
|
-
|
445
|
+
|
443
446
|
<term name="ordinal-22">ste</term>
|
444
447
|
<term name="ordinal-23">ste</term>
|
445
448
|
<term name="ordinal-24">ste</term>
|
@@ -503,7 +506,7 @@ Feature: Converting numbers to ordinals using CSL locales
|
|
503
506
|
<term name="ordinal-96">ste</term>
|
504
507
|
<term name="ordinal-97">ste</term>
|
505
508
|
<term name="ordinal-99">ste</term>
|
506
|
-
|
509
|
+
|
507
510
|
</terms>
|
508
511
|
</locale>
|
509
512
|
"""
|
data/lib/csl/info.rb
CHANGED
@@ -139,9 +139,17 @@ module CSL
|
|
139
139
|
def citation_format
|
140
140
|
return unless has_categories?
|
141
141
|
|
142
|
+
cat = categories.detect { |c| c.attribute? :'citation-format' }
|
143
|
+
return if cat.nil?
|
144
|
+
|
145
|
+
cat[:'citation-format'].to_sym
|
142
146
|
end
|
143
147
|
|
144
|
-
def
|
148
|
+
def citation_format=(new_format)
|
149
|
+
cat = categories.detect { |c| c.attribute? :'citation-format' }
|
150
|
+
cat = add_child Info::Category.new if cat.nil?
|
151
|
+
|
152
|
+
cat[:'citation-format'] = new_format.to_s
|
145
153
|
end
|
146
154
|
|
147
155
|
#
|
data/lib/csl/style.rb
CHANGED
@@ -46,7 +46,7 @@ module CSL
|
|
46
46
|
:documentation_link, :documentation_link=, :has_documentation_link?,
|
47
47
|
:independent_parent_link, :independent_parent_link=,
|
48
48
|
:has_independent_parent_link?, :title=, :id=, :has_title?, :has_id?,
|
49
|
-
:published_at, :updated_at
|
49
|
+
:published_at, :updated_at, :citation_format, :citation_format=
|
50
50
|
|
51
51
|
def initialize(attributes = {})
|
52
52
|
super(attributes, &nil)
|
data/lib/csl/version.rb
CHANGED
data/spec/csl/info_spec.rb
CHANGED
@@ -31,6 +31,52 @@ module CSL
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
describe 'citation-format' do
|
35
|
+
it 'has no citation-format by default' do
|
36
|
+
Info.new.citation_format.should be_nil
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'setting a citation-format creates a new category node' do
|
40
|
+
expect { info.citation_format = 'foo' }.to change { info.has_categories? }
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'setting a citation-format actually sets the citation-format' do
|
44
|
+
expect { info.citation_format = 'bar' }.to change { info.citation_format }.to(:bar)
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'given a category node with the citation-attribute set' do
|
48
|
+
before(:all) { info.add_child Info::Category.new(:'citation-format' => 'author') }
|
49
|
+
|
50
|
+
it 'has a citation format' do
|
51
|
+
info.citation_format.should == :author
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'setting a citation-format does not create a new category node' do
|
55
|
+
expect { info.citation_format = 'foo' }.not_to change { info.categories.length }
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'setting a citation-format actually sets the citation-format' do
|
59
|
+
expect { info.citation_format = 'bar' }.to change { info.citation_format }.to(:bar)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe 'given a category node without the citation-attribute set' do
|
64
|
+
before(:all) { info.add_child Info::Category.new(:field => 'literature') }
|
65
|
+
|
66
|
+
it 'has no citation-format by default' do
|
67
|
+
info.citation_format.should be_nil
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'setting a citation-format creates a new category node' do
|
71
|
+
expect { info.citation_format = 'foo' }.to change { info.categories.length }.from(1).to(2)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'setting a citation-format actually sets the citation-format' do
|
75
|
+
expect { info.citation_format = 'bar' }.to change { info.citation_format }.to(:bar)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
34
80
|
describe 'link accessors' do
|
35
81
|
it { should_not have_self_link }
|
36
82
|
it { should_not have_documentation_link }
|
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.pre5
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|
16
|
-
requirement: &
|
16
|
+
requirement: &70119062651280 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.1'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70119062651280
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70119062664520 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '2.7'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70119062664520
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70119062661920 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0.9'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70119062661920
|
47
47
|
description: ! "\n\t\tA Ruby parser and library for the Citation Style Language (CSL),
|
48
48
|
an open\n\t\tXML-based language to describe the formatting of citations and\n\t\tbibliographies.\n\t\t"
|
49
49
|
email:
|