csl 1.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/.document +5 -0
  2. data/.gitignore +8 -0
  3. data/.gitmodules +6 -0
  4. data/.rspec +3 -0
  5. data/.simplecov +2 -0
  6. data/.travis.yml +13 -0
  7. data/.yardopts +2 -0
  8. data/AGPL +662 -0
  9. data/BSDL +29 -0
  10. data/Gemfile +24 -0
  11. data/Guardfile +14 -0
  12. data/README.md +39 -0
  13. data/Rakefile +45 -0
  14. data/csl.gemspec +36 -0
  15. data/cucumber.yml +1 -0
  16. data/features/locales/loading.feature +57 -0
  17. data/features/locales/ordinalize.feature +861 -0
  18. data/features/parser/info.feature +27 -0
  19. data/features/parser/localized_dates.feature +35 -0
  20. data/features/parser/terms.feature +28 -0
  21. data/features/step_definitions/locale_steps.rb +34 -0
  22. data/features/step_definitions/parser_steps.rb +28 -0
  23. data/features/step_definitions/style_steps.rb +16 -0
  24. data/features/style/loading.feature +53 -0
  25. data/features/support/env.rb +8 -0
  26. data/lib/csl.rb +54 -0
  27. data/lib/csl/compatibility.rb +19 -0
  28. data/lib/csl/errors.rb +15 -0
  29. data/lib/csl/extensions.rb +63 -0
  30. data/lib/csl/info.rb +40 -0
  31. data/lib/csl/loader.rb +78 -0
  32. data/lib/csl/locale.rb +393 -0
  33. data/lib/csl/locale/date.rb +48 -0
  34. data/lib/csl/locale/style_options.rb +10 -0
  35. data/lib/csl/locale/term.rb +185 -0
  36. data/lib/csl/node.rb +285 -0
  37. data/lib/csl/parser.rb +92 -0
  38. data/lib/csl/pretty_printer.rb +33 -0
  39. data/lib/csl/schema.rb +109 -0
  40. data/lib/csl/style.rb +53 -0
  41. data/lib/csl/style/bibliography.rb +15 -0
  42. data/lib/csl/style/citation.rb +17 -0
  43. data/lib/csl/style/conditional.rb +11 -0
  44. data/lib/csl/style/date.rb +16 -0
  45. data/lib/csl/style/group.rb +9 -0
  46. data/lib/csl/style/label.rb +14 -0
  47. data/lib/csl/style/layout.rb +10 -0
  48. data/lib/csl/style/macro.rb +9 -0
  49. data/lib/csl/style/names.rb +54 -0
  50. data/lib/csl/style/number.rb +33 -0
  51. data/lib/csl/style/sort.rb +21 -0
  52. data/lib/csl/style/text.rb +10 -0
  53. data/lib/csl/treelike.rb +442 -0
  54. data/lib/csl/version.rb +3 -0
  55. data/spec/csl/info_spec.rb +116 -0
  56. data/spec/csl/locale/date_spec.rb +63 -0
  57. data/spec/csl/locale/style_options_spec.rb +19 -0
  58. data/spec/csl/locale/term_spec.rb +96 -0
  59. data/spec/csl/locale_spec.rb +128 -0
  60. data/spec/csl/node_spec.rb +100 -0
  61. data/spec/csl/parser_spec.rb +92 -0
  62. data/spec/csl/schema_spec.rb +70 -0
  63. data/spec/csl/style/bibliography_spec.rb +7 -0
  64. data/spec/csl/style/citation_spec.rb +7 -0
  65. data/spec/csl/style/conditional_spec.rb +7 -0
  66. data/spec/csl/style/date_spec.rb +11 -0
  67. data/spec/csl/style/group_spec.rb +7 -0
  68. data/spec/csl/style/label_spec.rb +7 -0
  69. data/spec/csl/style/layout_spec.rb +7 -0
  70. data/spec/csl/style/macro_spec.rb +7 -0
  71. data/spec/csl/style/names_spec.rb +23 -0
  72. data/spec/csl/style/number_spec.rb +84 -0
  73. data/spec/csl/style/text_spec.rb +7 -0
  74. data/spec/csl/style_spec.rb +19 -0
  75. data/spec/csl/treelike_spec.rb +151 -0
  76. data/spec/spec_helper.rb +30 -0
  77. metadata +192 -0
data/BSDL ADDED
@@ -0,0 +1,29 @@
1
+ CSL-Ruby. A Ruby CSL parser and library.
2
+
3
+ Copyright 2012 President and Fellows of Harvard College.
4
+ Copyright 2009-2012 Sylvester Keil. All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS OR
17
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19
+ EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
20
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
25
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+
27
+ The views and conclusions contained in the software and documentation are
28
+ those of the authors and should not be interpreted as representing official
29
+ policies, either expressed or implied, of the copyright holder.
data/Gemfile ADDED
@@ -0,0 +1,24 @@
1
+ source :rubygems
2
+ gemspec
3
+
4
+ group :debug do
5
+ gem 'ruby-debug', :platforms => [:mri_18, :jruby]
6
+ gem 'debugger', :platforms => [:mri_19]
7
+ end
8
+
9
+ group :optional do
10
+ gem 'nokogiri', '~>1.5'
11
+ end
12
+
13
+ group :extra do
14
+ gem 'simplecov', '~>0.6'
15
+
16
+ gem 'guard', '~>1.2'
17
+ gem 'guard-rspec', '~>1.1'
18
+ gem 'guard-cucumber', '~>1.2'
19
+
20
+ gem 'yard', '~>0.8', :platforms => [:mri_19]
21
+ gem 'redcarpet', '~>2.1', :platforms => [:mri_19]
22
+ end
23
+
24
+ # vim: syntax=ruby
data/Guardfile ADDED
@@ -0,0 +1,14 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec' do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { 'spec' }
8
+ end
9
+
10
+ guard 'cucumber' do
11
+ watch(%r{^features/.+\.feature$})
12
+ watch(%r{^features/support/.+$}) { 'features' }
13
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
14
+ end
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ CSL-Ruby
2
+ ========
3
+ CSL-Ruby is a Ruby parser and library for the Citation Style Language (CSL),
4
+ an XML-based format to describe the formatting of citations, notes and
5
+ bibliographies.
6
+
7
+ [![Build Status](https://secure.travis-ci.org/berkmancenter/csl-ruby.png?branch=master)](http://travis-ci.org/berkmancenter/csl-ruby)
8
+
9
+ Development
10
+ -----------
11
+ The CSL-Ruby source code is [hosted on GitHub](https://github.com/berkmancenter/csl-ruby).
12
+ You can check out a copy of the latest code using Git:
13
+
14
+ $ git clone https://github.com/berkmancenter/csl-ruby.git
15
+
16
+ To get started, install the development dependencies, fetch the latest CSL
17
+ styles and locales, and run all tests:
18
+
19
+ $ cd csl-ruby
20
+ $ git submodule init
21
+ $ git submodule update
22
+ $ bundle install
23
+ $ rake
24
+
25
+ If you've found a bug or have a question, please open an issue on the
26
+ [issue tracker](https://github.com/berkmancenter/csl-ruby/issues).
27
+ Or, for extra credit, clone the CSL-Ruby repository, write a failing
28
+ example, fix the bug and submit a pull request.
29
+
30
+
31
+ Copyright
32
+ ---------
33
+ Copyright 2012 President and Fellows of Harvard College.
34
+
35
+ Copyright 2009-2012 Sylvester Keil. All rights reserved.
36
+
37
+ License
38
+ -------
39
+ CiteProc is dual licensed under the AGPL and the FreeBSD license.
data/Rakefile ADDED
@@ -0,0 +1,45 @@
1
+ # encoding: utf-8
2
+
3
+ require 'bundler'
4
+ begin
5
+ Bundler.setup
6
+ rescue Bundler::BundlerError => e
7
+ $stderr.puts e.message
8
+ $stderr.puts "Run `bundle install` to install missing gems"
9
+ exit e.status_code
10
+ end
11
+
12
+ $:.unshift(File.join(File.dirname(__FILE__), './lib'))
13
+ require 'csl/version'
14
+
15
+
16
+ desc 'Run an IRB session with CSL loaded'
17
+ task :console, [:script] do |t,args|
18
+ ARGV.clear
19
+
20
+ require 'irb'
21
+ require 'csl'
22
+
23
+ IRB.conf[:SCRIPT] = args.script
24
+ IRB.start
25
+ end
26
+
27
+ require 'rspec/core'
28
+ require 'rspec/core/rake_task'
29
+ RSpec::Core::RakeTask.new(:spec) do |spec|
30
+ spec.pattern = FileList['spec/**/*_spec.rb']
31
+ end
32
+
33
+ require 'cucumber/rake/task'
34
+ Cucumber::Rake::Task.new(:cucumber) do |t|
35
+ t.profile = 'default'
36
+ end
37
+
38
+ task :release do |t|
39
+ system "gem build csl.gemspec"
40
+ system "git tag #{CSL::VERSION}"
41
+ system "git push --tags"
42
+ system "gem push csl-#{CSL::VERSION}"
43
+ end
44
+
45
+ task :default => [:spec, :cucumber]
data/csl.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require 'csl/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'csl'
9
+ s.version = CSL::VERSION.dup
10
+ s.platform = Gem::Platform::RUBY
11
+ s.authors = ['Sylvester Keil']
12
+ s.email = ['http://sylvester.keil.or.at']
13
+ s.homepage = 'https://github.com/inukshuk/csl-ruby'
14
+ s.summary = 'A Ruby CSL parser and library'
15
+ s.description =
16
+ """
17
+ A Ruby parser and library for the Citation Style Language (CSL), an open
18
+ XML-based language to describe the formatting of citations and
19
+ bibliographies.
20
+ """
21
+ s.license = 'AGPL'
22
+ s.date = Time.now.strftime('%Y-%m-%d')
23
+
24
+ s.add_development_dependency('cucumber', ['~>1.1'])
25
+ s.add_development_dependency('rspec', ['~>2.7'])
26
+ s.add_development_dependency('rake', ['~>0.9'])
27
+
28
+ s.files = `git ls-files`.split("\n")
29
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
30
+ s.executables = []
31
+ s.require_path = 'lib'
32
+
33
+ s.has_rdoc = 'yard'
34
+ end
35
+
36
+ # vim: syntax=ruby
data/cucumber.yml ADDED
@@ -0,0 +1 @@
1
+ default: --format progress --require features --color
@@ -0,0 +1,57 @@
1
+ Feature: Loading CSL Locales
2
+ As a hacker of CSL styles
3
+ I want to be able to parse CSL locales
4
+
5
+ Scenario: Loading a locale from a string
6
+ When I load the locale from the string
7
+ """
8
+ <?xml version="1.0" encoding="utf-8"?>
9
+ <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0" xml:lang="de-AT">
10
+ <style-options punctuation-in-quote="false"/>
11
+ <date form="text">
12
+ <date-part name="day" suffix=". "/>
13
+ <date-part name="month" suffix=" "/>
14
+ <date-part name="year"/>
15
+ </date>
16
+ <date form="numeric">
17
+ <date-part name="day" form="numeric-leading-zeros" suffix="."/>
18
+ <date-part name="month" form="numeric-leading-zeros" suffix="."/>
19
+ <date-part name="year"/>
20
+ </date>
21
+ <terms>
22
+ <term name="accessed">zugegriffen</term>
23
+ <term name="and others">und andere</term>
24
+ <term name="edition">
25
+ <single>Auflage</single>
26
+ <multiple>Auflagen</multiple>
27
+ </term>
28
+ <term name="edition" form="short">Aufl.</term>
29
+ <term name="et-al">u. a.</term>
30
+ <term name="forthcoming">i. E.</term>
31
+ <term name="from">von</term>
32
+ <term name="ibid">ebd.</term>
33
+ <term name="in">in</term>
34
+ <term name="presented at">gehalten auf der</term>
35
+ <term name="reference">
36
+ <single>Referenz</single>
37
+ <multiple>Referenzen</multiple>
38
+ </term>
39
+ <term name="reference" form="short">
40
+ <single>Ref.</single>
41
+ <multiple>Ref.</multiple>
42
+ </term>
43
+ <term name="retrieved">abgerufen</term>
44
+
45
+ <!-- LONG ROLE FORMS -->
46
+ <term name="author">
47
+ <single/>
48
+ <multiple/>
49
+ </term>
50
+ </terms>
51
+ </locale>
52
+ """
53
+ Then the language should be "de"
54
+ And the region should be "AT"
55
+ And the attribute "version" should be "1.0"
56
+ And the locale should should have 14 terms
57
+ And the plural of the term "reference" should be "Referenzen"
@@ -0,0 +1,861 @@
1
+ Feature: Converting numbers to ordinals using CSL locales
2
+ In order to support the requirements of CSL styles that use ordinals
3
+ As a hacker of CSL styles
4
+ I want to be able to convert numbers to ordinals
5
+
6
+ @v1.0 @locale @ordinals @i18n @lang:en
7
+ Scenario: English CSL 1.0 locales
8
+ Given the locale:
9
+ """
10
+ <?xml version="1.0" encoding="utf-8"?>
11
+ <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0" xml:lang="en">
12
+ <terms>
13
+ <term name="ordinal-01">st</term>
14
+ <term name="ordinal-02">nd</term>
15
+ <term name="ordinal-03">rd</term>
16
+ <term name="ordinal-04">th</term>
17
+ </terms>
18
+ </locale>
19
+ """
20
+ When I ordinalize these numbers:
21
+ | number |
22
+ | 0 |
23
+ | 1 |
24
+ | 2 |
25
+ | 3 |
26
+ | 4 |
27
+ | 5 |
28
+ | 10 |
29
+ | 11 |
30
+ | 12 |
31
+ | 13 |
32
+ | 20 |
33
+ | 21 |
34
+ | 22 |
35
+ | 23 |
36
+ | 111 |
37
+ | 112 |
38
+ | 113 |
39
+ | -102 |
40
+ Then the ordinals should be:
41
+ | ordinal |
42
+ | 0th |
43
+ | 1st |
44
+ | 2nd |
45
+ | 3rd |
46
+ | 4th |
47
+ | 5th |
48
+ | 10th |
49
+ | 11th |
50
+ | 12th |
51
+ | 13th |
52
+ | 20th |
53
+ | 21st |
54
+ | 22nd |
55
+ | 23rd |
56
+ | 111th |
57
+ | 112th |
58
+ | 113th |
59
+ | -102nd |
60
+
61
+ @v1.0.1 @locale @ordinals @i18n @lang:en
62
+ Scenario: English CSL 1.0.1 locales
63
+ Given the locale:
64
+ """
65
+ <?xml version="1.0" encoding="utf-8"?>
66
+ <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0.1" xml:lang="en">
67
+ <terms>
68
+ <term name="ordinal-00">th</term>
69
+ <term name="ordinal-01">st</term>
70
+ <term name="ordinal-02">nd</term>
71
+ <term name="ordinal-03">rd</term>
72
+ <term name="ordinal-11">th</term>
73
+ <term name="ordinal-12">th</term>
74
+ <term name="ordinal-13">th</term>
75
+ </terms>
76
+ </locale>
77
+ """
78
+ When I ordinalize these numbers:
79
+ | number |
80
+ | 0 |
81
+ | 1 |
82
+ | 2 |
83
+ | 3 |
84
+ | 4 |
85
+ | 5 |
86
+ | 10 |
87
+ | 11 |
88
+ | 12 |
89
+ | 13 |
90
+ | 20 |
91
+ | 21 |
92
+ | 22 |
93
+ | 23 |
94
+ | 111 |
95
+ | 112 |
96
+ | 113 |
97
+ | -102 |
98
+ Then the ordinals should be:
99
+ | ordinal |
100
+ | 0th |
101
+ | 1st |
102
+ | 2nd |
103
+ | 3rd |
104
+ | 4th |
105
+ | 5th |
106
+ | 10th |
107
+ | 11th |
108
+ | 12th |
109
+ | 13th |
110
+ | 20th |
111
+ | 21st |
112
+ | 22nd |
113
+ | 23rd |
114
+ | 111th |
115
+ | 112th |
116
+ | 113th |
117
+ | -102nd |
118
+
119
+ @v1.0.1 @locale @ordinals @i18n @gender @lang:de
120
+ Scenario: Gendered German CSL 1.0.1 locales
121
+ Given the locale:
122
+ """
123
+ <?xml version="1.0" encoding="utf-8"?>
124
+ <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0.1" xml:lang="de">
125
+ <terms>
126
+ <term name="ordinal-00">.</term>
127
+ <term name="long-ordinal-01">erstes</term>
128
+ <term name="long-ordinal-01" gender-form="feminine">
129
+ <single>erste</single>
130
+ <multiple>ersten</multiple>
131
+ </term>
132
+ <term name="long-ordinal-01" gender-form="masculine">
133
+ <single>erster</single>
134
+ <multiple>ersten</multiple>
135
+ </term>
136
+ <term name="long-ordinal-02">zweites</term>
137
+ <term name="long-ordinal-02" gender-form="feminine">zweite</term>
138
+ <term name="long-ordinal-02" gender-form="masculine">zweiter</term>
139
+ </terms>
140
+ </locale>
141
+ """
142
+ When I ordinalize these numbers:
143
+ | num | form | gender | number |
144
+ | 0 | | | |
145
+ | 1 | | | |
146
+ | 2 | | | |
147
+ | 3 | | | |
148
+ | 101 | | | |
149
+ | 1 | long | | |
150
+ | 2 | long | | |
151
+ | 3 | long | | |
152
+ | 1 | long | feminine | |
153
+ | 1 | long | feminine | plural |
154
+ | 1 | long | feminine | singular |
155
+ | 2 | long | feminine | |
156
+ | 3 | long | feminine | |
157
+ | 1 | long | masculine | |
158
+ | 2 | long | masculine | |
159
+ | 3 | long | masculine | |
160
+ Then the ordinals should be:
161
+ | ordinal |
162
+ | 0. |
163
+ | 1. |
164
+ | 2. |
165
+ | 3. |
166
+ | 101. |
167
+ | erstes |
168
+ | zweites |
169
+ | 3. |
170
+ | erste |
171
+ | ersten |
172
+ | erste |
173
+ | zweite |
174
+ | 3. |
175
+ | erster |
176
+ | zweiter |
177
+ | 3. |
178
+
179
+ @v1.0.1 @locale @ordinals @i18n @gender @lang:fr
180
+ Scenario: Gendered French CSL 1.0.1 locales
181
+ Given the locale:
182
+ """
183
+ <?xml version="1.0" encoding="utf-8"?>
184
+ <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0.1" xml:lang="de">
185
+ <terms>
186
+ <term name="ordinal-00">
187
+ <single>e</single>
188
+ <multiple>es</multiple>
189
+ </term>
190
+
191
+ <term name="ordinal-01">e</term>
192
+ <term name="ordinal-01" gender-form="feminine">
193
+ <single>re</single>
194
+ <multiple>res</multiple>
195
+ </term>
196
+ <term name="ordinal-01" gender-form="masculine">
197
+ <single>er</single>
198
+ <multiple>ers</multiple>
199
+ </term>
200
+
201
+ </terms>
202
+ </locale>
203
+ """
204
+ When I ordinalize these numbers:
205
+ | num | form | gender | number |
206
+ | 0 | | | |
207
+ | 1 | | | |
208
+ | 1 | | feminine | |
209
+ | 1 | | masculine | |
210
+ | 1 | | neutral | |
211
+ | 1 | | feminine | plural |
212
+ | 1 | | masculine | plural |
213
+ | 2 | | | |
214
+ | 3 | | | |
215
+ | 3 | | | plural |
216
+ | 999 | | | |
217
+ | 11 | | | |
218
+ | 21 | | | |
219
+ | 101 | | | |
220
+ | 1001 | | | |
221
+ | 301 | | | |
222
+ # | 21 | | masculine |
223
+ # | 1001 | | masculine |
224
+ Then the ordinals should be:
225
+ | ordinal |
226
+ | 0e |
227
+ | 1e |
228
+ | 1re |
229
+ | 1er |
230
+ | 1e |
231
+ | 1res |
232
+ | 1ers |
233
+ | 2e |
234
+ | 3e |
235
+ | 3es |
236
+ | 999e |
237
+ | 11e |
238
+ | 21e |
239
+ | 101e |
240
+ | 1001e |
241
+ | 301e |
242
+ # These are currently incorrect:
243
+ # | 21e |
244
+ # | 1001e |
245
+
246
+ @v1.0.1 @locale @ordinals @i18n @lang:nl
247
+ Scenario: Dutch CSL 1.0.1 locales (nulde form)
248
+ Given the locale:
249
+ """
250
+ <?xml version="1.0" encoding="utf-8"?>
251
+ <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0.1" xml:lang="nl">
252
+ <terms>
253
+ <term name="ordinal-00">de</term>
254
+
255
+ <term name="ordinal-01">ste</term>
256
+ <term name="ordinal-08">ste</term>
257
+
258
+ <term name="ordinal-11">de</term>
259
+ <term name="ordinal-18">de</term>
260
+
261
+ <term name="ordinal-20">ste</term>
262
+ <term name="ordinal-22">ste</term>
263
+ <term name="ordinal-23">ste</term>
264
+ <term name="ordinal-24">ste</term>
265
+ <term name="ordinal-25">ste</term>
266
+ <term name="ordinal-26">ste</term>
267
+ <term name="ordinal-27">ste</term>
268
+ <term name="ordinal-29">ste</term>
269
+
270
+ <term name="ordinal-30">ste</term>
271
+ <term name="ordinal-32">ste</term>
272
+ <term name="ordinal-33">ste</term>
273
+ <term name="ordinal-34">ste</term>
274
+ <term name="ordinal-35">ste</term>
275
+ <term name="ordinal-36">ste</term>
276
+ <term name="ordinal-37">ste</term>
277
+ <term name="ordinal-39">ste</term>
278
+
279
+ <term name="ordinal-40">ste</term>
280
+ <term name="ordinal-42">ste</term>
281
+ <term name="ordinal-43">ste</term>
282
+ <term name="ordinal-44">ste</term>
283
+ <term name="ordinal-45">ste</term>
284
+ <term name="ordinal-46">ste</term>
285
+ <term name="ordinal-47">ste</term>
286
+ <term name="ordinal-49">ste</term>
287
+
288
+ <term name="ordinal-50">ste</term>
289
+ <term name="ordinal-52">ste</term>
290
+ <term name="ordinal-53">ste</term>
291
+ <term name="ordinal-54">ste</term>
292
+ <term name="ordinal-55">ste</term>
293
+ <term name="ordinal-56">ste</term>
294
+ <term name="ordinal-57">ste</term>
295
+ <term name="ordinal-59">ste</term>
296
+
297
+ <term name="ordinal-60">ste</term>
298
+ <term name="ordinal-62">ste</term>
299
+ <term name="ordinal-63">ste</term>
300
+ <term name="ordinal-64">ste</term>
301
+ <term name="ordinal-65">ste</term>
302
+ <term name="ordinal-66">ste</term>
303
+ <term name="ordinal-67">ste</term>
304
+ <term name="ordinal-69">ste</term>
305
+
306
+ <term name="ordinal-70">ste</term>
307
+ <term name="ordinal-72">ste</term>
308
+ <term name="ordinal-73">ste</term>
309
+ <term name="ordinal-74">ste</term>
310
+ <term name="ordinal-75">ste</term>
311
+ <term name="ordinal-76">ste</term>
312
+ <term name="ordinal-77">ste</term>
313
+ <term name="ordinal-79">ste</term>
314
+
315
+ <term name="ordinal-80">ste</term>
316
+ <term name="ordinal-82">ste</term>
317
+ <term name="ordinal-83">ste</term>
318
+ <term name="ordinal-84">ste</term>
319
+ <term name="ordinal-85">ste</term>
320
+ <term name="ordinal-86">ste</term>
321
+ <term name="ordinal-87">ste</term>
322
+ <term name="ordinal-89">ste</term>
323
+
324
+ <term name="ordinal-90">ste</term>
325
+ <term name="ordinal-92">ste</term>
326
+ <term name="ordinal-93">ste</term>
327
+ <term name="ordinal-94">ste</term>
328
+ <term name="ordinal-95">ste</term>
329
+ <term name="ordinal-96">ste</term>
330
+ <term name="ordinal-97">ste</term>
331
+ <term name="ordinal-99">ste</term>
332
+ </terms>
333
+ </locale>
334
+ """
335
+ When I ordinalize these numbers:
336
+ | number |
337
+ | 0 |
338
+ | 1 |
339
+ | 2 |
340
+ | 3 |
341
+ | 4 |
342
+ | 5 |
343
+ | 6 |
344
+ | 7 |
345
+ | 8 |
346
+ | 9 |
347
+ | 10 |
348
+ | 11 |
349
+ | 12 |
350
+ | 13 |
351
+ | 14 |
352
+ | 15 |
353
+ | 16 |
354
+ | 17 |
355
+ | 18 |
356
+ | 19 |
357
+ | 20 |
358
+ | 21 |
359
+ | 22 |
360
+ | 23 |
361
+ | 41 |
362
+ | 52 |
363
+ | 63 |
364
+ | 74 |
365
+ | 88 |
366
+ | 99 |
367
+ | 101 |
368
+ | 102 |
369
+ | 108 |
370
+ | 111 |
371
+ | 112 |
372
+ | 113 |
373
+ Then the ordinals should be:
374
+ | ordinal |
375
+ | 0de |
376
+ | 1ste |
377
+ | 2de |
378
+ | 3de |
379
+ | 4de |
380
+ | 5de |
381
+ | 6de |
382
+ | 7de |
383
+ | 8ste |
384
+ | 9de |
385
+ | 10de |
386
+ | 11de |
387
+ | 12de |
388
+ | 13de |
389
+ | 14de |
390
+ | 15de |
391
+ | 16de |
392
+ | 17de |
393
+ | 18de |
394
+ | 19de |
395
+ | 20ste |
396
+ | 21ste |
397
+ | 22ste |
398
+ | 23ste |
399
+ | 41ste |
400
+ | 52ste |
401
+ | 63ste |
402
+ | 74ste |
403
+ | 88ste |
404
+ | 99ste |
405
+ | 101ste |
406
+ | 102de |
407
+ | 108ste |
408
+ | 111de |
409
+ | 112de |
410
+ | 113de |
411
+
412
+ @v1.0.1 @locale @ordinals @i18n @lang:nl
413
+ Scenario: Dutch CSL 1.0.1 locales (nulste form)
414
+ Given the locale:
415
+ """
416
+ <?xml version="1.0" encoding="utf-8"?>
417
+ <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0.1" xml:lang="nl">
418
+ <terms>
419
+ <term name="ordinal-00">ste</term>
420
+
421
+ <term name="ordinal-01">ste</term>
422
+ <term name="ordinal-08">ste</term>
423
+
424
+ <term name="ordinal-02">de</term>
425
+ <term name="ordinal-03">de</term>
426
+ <term name="ordinal-04">de</term>
427
+ <term name="ordinal-05">de</term>
428
+ <term name="ordinal-06">de</term>
429
+ <term name="ordinal-07">de</term>
430
+ <term name="ordinal-09">de</term>
431
+
432
+ <term name="ordinal-10">de</term>
433
+ <term name="ordinal-11">de</term>
434
+ <term name="ordinal-12">de</term>
435
+ <term name="ordinal-13">de</term>
436
+ <term name="ordinal-14">de</term>
437
+ <term name="ordinal-15">de</term>
438
+ <term name="ordinal-16">de</term>
439
+ <term name="ordinal-17">de</term>
440
+ <term name="ordinal-18">de</term>
441
+ <term name="ordinal-19">de</term>
442
+
443
+ <term name="ordinal-22">ste</term>
444
+ <term name="ordinal-23">ste</term>
445
+ <term name="ordinal-24">ste</term>
446
+ <term name="ordinal-25">ste</term>
447
+ <term name="ordinal-26">ste</term>
448
+ <term name="ordinal-27">ste</term>
449
+ <term name="ordinal-29">ste</term>
450
+
451
+ <term name="ordinal-32">ste</term>
452
+ <term name="ordinal-33">ste</term>
453
+ <term name="ordinal-34">ste</term>
454
+ <term name="ordinal-35">ste</term>
455
+ <term name="ordinal-36">ste</term>
456
+ <term name="ordinal-37">ste</term>
457
+ <term name="ordinal-39">ste</term>
458
+
459
+ <term name="ordinal-42">ste</term>
460
+ <term name="ordinal-43">ste</term>
461
+ <term name="ordinal-44">ste</term>
462
+ <term name="ordinal-45">ste</term>
463
+ <term name="ordinal-46">ste</term>
464
+ <term name="ordinal-47">ste</term>
465
+ <term name="ordinal-49">ste</term>
466
+
467
+ <term name="ordinal-52">ste</term>
468
+ <term name="ordinal-53">ste</term>
469
+ <term name="ordinal-54">ste</term>
470
+ <term name="ordinal-55">ste</term>
471
+ <term name="ordinal-56">ste</term>
472
+ <term name="ordinal-57">ste</term>
473
+ <term name="ordinal-59">ste</term>
474
+
475
+ <term name="ordinal-62">ste</term>
476
+ <term name="ordinal-63">ste</term>
477
+ <term name="ordinal-64">ste</term>
478
+ <term name="ordinal-65">ste</term>
479
+ <term name="ordinal-66">ste</term>
480
+ <term name="ordinal-67">ste</term>
481
+ <term name="ordinal-69">ste</term>
482
+
483
+ <term name="ordinal-72">ste</term>
484
+ <term name="ordinal-73">ste</term>
485
+ <term name="ordinal-74">ste</term>
486
+ <term name="ordinal-75">ste</term>
487
+ <term name="ordinal-76">ste</term>
488
+ <term name="ordinal-77">ste</term>
489
+ <term name="ordinal-79">ste</term>
490
+
491
+ <term name="ordinal-82">ste</term>
492
+ <term name="ordinal-83">ste</term>
493
+ <term name="ordinal-84">ste</term>
494
+ <term name="ordinal-85">ste</term>
495
+ <term name="ordinal-86">ste</term>
496
+ <term name="ordinal-87">ste</term>
497
+ <term name="ordinal-89">ste</term>
498
+
499
+ <term name="ordinal-92">ste</term>
500
+ <term name="ordinal-93">ste</term>
501
+ <term name="ordinal-94">ste</term>
502
+ <term name="ordinal-95">ste</term>
503
+ <term name="ordinal-96">ste</term>
504
+ <term name="ordinal-97">ste</term>
505
+ <term name="ordinal-99">ste</term>
506
+
507
+ </terms>
508
+ </locale>
509
+ """
510
+ When I ordinalize these numbers:
511
+ | number |
512
+ | 0 |
513
+ | 1 |
514
+ | 2 |
515
+ | 3 |
516
+ | 4 |
517
+ | 5 |
518
+ | 6 |
519
+ | 7 |
520
+ | 8 |
521
+ | 9 |
522
+ | 10 |
523
+ | 11 |
524
+ | 12 |
525
+ | 13 |
526
+ | 14 |
527
+ | 15 |
528
+ | 16 |
529
+ | 17 |
530
+ | 18 |
531
+ | 19 |
532
+ | 20 |
533
+ | 21 |
534
+ | 22 |
535
+ | 23 |
536
+ | 41 |
537
+ | 52 |
538
+ | 63 |
539
+ | 74 |
540
+ | 88 |
541
+ | 99 |
542
+ | 101 |
543
+ | 102 |
544
+ | 108 |
545
+ | 111 |
546
+ | 112 |
547
+ | 113 |
548
+ Then the ordinals should be:
549
+ | ordinal |
550
+ | 0ste |
551
+ | 1ste |
552
+ | 2de |
553
+ | 3de |
554
+ | 4de |
555
+ | 5de |
556
+ | 6de |
557
+ | 7de |
558
+ | 8ste |
559
+ | 9de |
560
+ | 10de |
561
+ | 11de |
562
+ | 12de |
563
+ | 13de |
564
+ | 14de |
565
+ | 15de |
566
+ | 16de |
567
+ | 17de |
568
+ | 18de |
569
+ | 19de |
570
+ | 20ste |
571
+ | 21ste |
572
+ | 22ste |
573
+ | 23ste |
574
+ | 41ste |
575
+ | 52ste |
576
+ | 63ste |
577
+ | 74ste |
578
+ | 88ste |
579
+ | 99ste |
580
+ | 101ste |
581
+ | 102de |
582
+ | 108ste |
583
+ | 111de |
584
+ | 112de |
585
+ | 113de |
586
+
587
+ @v1.0.1 @locale @ordinals @i18n @gender @lang:es
588
+ Scenario: Gendered Spanish CSL 1.0.1 locales
589
+ Given the locale:
590
+ """
591
+ <?xml version="1.0" encoding="utf-8"?>
592
+ <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0.1" xml:lang="es">
593
+ <terms>
594
+ <term name="ordinal-00">.º</term>
595
+ <term name="ordinal-00" gender-form="masculine">.º</term>
596
+ <term name="ordinal-00" gender-form="feminine">.ª</term>
597
+ </terms>
598
+ </locale>
599
+ """
600
+ When I ordinalize these numbers:
601
+ | num | form | gender | number |
602
+ | 0 | | | |
603
+ | 1 | | | |
604
+ | 2 | | | |
605
+ | 3 | | | |
606
+ | 4 | | | |
607
+ | 5 | | | |
608
+ | 6 | | | |
609
+ | 7 | | | |
610
+ | 8 | | | |
611
+ | 9 | | | |
612
+ | 10 | | | |
613
+ | 1 | | feminine | |
614
+ | 1 | | masculine | |
615
+ | 1 | | masculine | singular |
616
+ | 1 | | masculine | plural |
617
+ | 3 | | feminine | |
618
+ | 3 | | masculine | |
619
+ | 2 | | feminine | |
620
+ | 23 | | | |
621
+ | 999 | | | |
622
+ | 11 | | | |
623
+ | 11 | | feminine | |
624
+ | 11 | | masculine | |
625
+ | 21 | | | |
626
+ | 101 | | | |
627
+ | 1001 | | feminine | |
628
+ | 301 | | | |
629
+ | 21 | | masculine | singular |
630
+ | 21 | | masculine | plural |
631
+ | 1001 | | masculine | |
632
+ Then the ordinals should be:
633
+ | ordinal |
634
+ | 0.º |
635
+ | 1.º |
636
+ # | 1.er |
637
+ | 2.º |
638
+ | 3.º |
639
+ | 4.º |
640
+ | 5.º |
641
+ | 6.º |
642
+ | 7.º |
643
+ | 8.º |
644
+ | 9.º |
645
+ | 10.º |
646
+ | 1.ª |
647
+ | 1.º |
648
+ | 1.º |
649
+ # | 1.er |
650
+ # | 1.er |
651
+ | 1.º |
652
+ | 3.ª |
653
+ | 3.º |
654
+ # | 3.er |
655
+ | 2.ª |
656
+ | 23.º |
657
+ | 999.º |
658
+ | 11.º |
659
+ | 11.ª |
660
+ | 11.º |
661
+ | 21.º |
662
+ | 101.º |
663
+ # | 21.er |
664
+ # | 101.er |
665
+ | 1001.ª |
666
+ | 301.º |
667
+ # | 301.er |
668
+ | 21.º |
669
+ # | 21.er |
670
+ | 21.º |
671
+ | 1001.º |
672
+ # | 1001.er |
673
+
674
+
675
+ @v1.0.1 @locale @ordinals @i18n @gender @lang:it
676
+ Scenario: Gendered Italian CSL 1.0.1 locales
677
+ Given the locale:
678
+ """
679
+ <?xml version="1.0" encoding="utf-8"?>
680
+ <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0.1" xml:lang="it">
681
+ <terms>
682
+ <term name="ordinal-00">º</term>
683
+ <term name="ordinal-00" gender-form="masculine">º</term>
684
+ <term name="ordinal-00" gender-form="feminine">ª</term>
685
+ </terms>
686
+ </locale>
687
+ """
688
+ When I ordinalize these numbers:
689
+ | num | form | gender | number |
690
+ | 0 | | | |
691
+ | 1 | | | |
692
+ | 2 | | | |
693
+ | 3 | | | |
694
+ | 4 | | | |
695
+ | 5 | | | |
696
+ | 6 | | | |
697
+ | 7 | | | |
698
+ | 8 | | | |
699
+ | 9 | | | |
700
+ | 10 | | | |
701
+ | 1 | | feminine | |
702
+ | 1 | | masculine | |
703
+ | 1 | | masculine | singular |
704
+ | 1 | | masculine | plural |
705
+ | 3 | | feminine | |
706
+ | 3 | | masculine | |
707
+ | 2 | | feminine | |
708
+ | 23 | | | |
709
+ | 999 | | | |
710
+ | 11 | | | |
711
+ | 11 | | feminine | |
712
+ | 11 | | masculine | |
713
+ | 21 | | | |
714
+ | 101 | | | |
715
+ | 1001 | | feminine | |
716
+ | 301 | | | |
717
+ | 21 | | masculine | singular |
718
+ | 21 | | masculine | plural |
719
+ | 1001 | | masculine | |
720
+ Then the ordinals should be:
721
+ | ordinal |
722
+ | 0º |
723
+ | 1º |
724
+ | 2º |
725
+ | 3º |
726
+ | 4º |
727
+ | 5º |
728
+ | 6º |
729
+ | 7º |
730
+ | 8º |
731
+ | 9º |
732
+ | 10º |
733
+ | 1ª |
734
+ | 1º |
735
+ | 1º |
736
+ | 1º |
737
+ | 3ª |
738
+ | 3º |
739
+ | 2ª |
740
+ | 23º |
741
+ | 999º |
742
+ | 11º |
743
+ | 11ª |
744
+ | 11º |
745
+ | 21º |
746
+ | 101º |
747
+ | 1001ª |
748
+ | 301º |
749
+ | 21º |
750
+ | 21º |
751
+ | 1001º |
752
+
753
+ @v1.0.1 @locale @ordinals @i18n @gender @lang:sv
754
+ Scenario: Gendered Swedish CSL 1.0.1 locales
755
+ Given the locale:
756
+ """
757
+ <?xml version="1.0" encoding="utf-8"?>
758
+ <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0.1" xml:lang="sv">
759
+ <terms>
760
+ <term name="ordinal-00">:e</term>
761
+
762
+ <term name="ordinal-01">:a</term>
763
+ <term name="ordinal-01" gender-form="masculine">:e</term>
764
+ <term name="ordinal-01" gender-form="feminine">:a</term>
765
+
766
+ <term name="ordinal-02">:a</term>
767
+ <term name="ordinal-02" gender-form="masculine">:e</term>
768
+ <term name="ordinal-02" gender-form="feminine">:a</term>
769
+
770
+ <term name="ordinal-11">:e</term>
771
+ <term name="ordinal-11" gender-form="feminine">:e</term>
772
+ <term name="ordinal-12">:e</term>
773
+ <term name="ordinal-12" gender-form="feminine">:e</term>
774
+
775
+ <term name="ordinal-21">:e</term>
776
+ <term name="ordinal-21" gender-form="feminine">:e</term>
777
+ <term name="ordinal-22">:e</term>
778
+ <term name="ordinal-22" gender-form="feminine">:e</term>
779
+
780
+ <term name="ordinal-31">:e</term>
781
+ <term name="ordinal-32">:e</term>
782
+
783
+ <term name="ordinal-41">:e</term>
784
+ <term name="ordinal-42">:e</term>
785
+
786
+ <term name="ordinal-51">:e</term>
787
+ <term name="ordinal-52">:e</term>
788
+
789
+ <term name="ordinal-61">:e</term>
790
+ <term name="ordinal-62">:e</term>
791
+
792
+ <term name="ordinal-71">:e</term>
793
+ <term name="ordinal-72">:e</term>
794
+
795
+ <term name="ordinal-81">:e</term>
796
+ <term name="ordinal-82">:e</term>
797
+
798
+ <term name="ordinal-91">:e</term>
799
+ <term name="ordinal-92">:e</term>
800
+ </terms>
801
+ </locale>
802
+ """
803
+ When I ordinalize these numbers:
804
+ | num | form | gender | number |
805
+ | 0 | | | |
806
+ | 1 | | | |
807
+ | 2 | | | |
808
+ | 3 | | | |
809
+ | 4 | | | |
810
+ | 5 | | | |
811
+ | 6 | | | |
812
+ | 7 | | | |
813
+ | 8 | | | |
814
+ | 9 | | | |
815
+ | 10 | | | |
816
+ | 1 | | feminine | |
817
+ | 1 | | masculine | |
818
+ | 2 | | feminine | |
819
+ | 2 | | masculine | |
820
+ | 23 | | | |
821
+ | 999 | | | |
822
+ | 11 | | | |
823
+ | 11 | | feminine | |
824
+ | 11 | | masculine | |
825
+ | 21 | | | |
826
+ # | 101 | | | |
827
+ # | 1001 | | feminine | |
828
+ # | 301 | | | |
829
+ | 21 | | masculine | singular |
830
+ | 21 | | masculine | plural |
831
+ # | 1001 | | masculine | |
832
+ Then the ordinals should be:
833
+ | ordinal |
834
+ | 0:e |
835
+ | 1:a |
836
+ | 2:a |
837
+ | 3:e |
838
+ | 4:e |
839
+ | 5:e |
840
+ | 6:e |
841
+ | 7:e |
842
+ | 8:e |
843
+ | 9:e |
844
+ | 10:e |
845
+ | 1:a |
846
+ | 1:e |
847
+ | 2:a |
848
+ | 2:e |
849
+ | 23:e |
850
+ | 999:e |
851
+ | 11:e |
852
+ | 11:e |
853
+ | 11:e |
854
+ | 21:e |
855
+ # | 101:e |
856
+ # | 1001:e |
857
+ # | 301:e |
858
+ | 21:e |
859
+ | 21:e |
860
+ # | 1001:e |
861
+