citeproc-ruby 0.0.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.document +4 -0
- data/.gitignore +10 -0
- data/.rspec +3 -0
- data/.simplecov +4 -0
- data/.travis.yml +17 -0
- data/.yardopts +2 -0
- data/AGPL +662 -0
- data/BSDL +29 -0
- data/Gemfile +42 -0
- data/Guardfile +14 -0
- data/README.md +32 -76
- data/Rakefile +60 -0
- data/citeproc-ruby.gemspec +46 -0
- data/cucumber.yml +1 -0
- data/features/bibliography.feature +25 -0
- data/features/name_options.feature +37 -0
- data/features/names.feature +192 -0
- data/features/renderer.feature +74 -0
- data/features/sort.feature +50 -0
- data/features/step_definitions/renderer.rb +80 -0
- data/features/support/env.rb +33 -0
- data/features/support/hooks.rb +10 -0
- data/lib/citeproc/ruby.rb +32 -0
- data/lib/citeproc/ruby/engine.rb +122 -0
- data/lib/citeproc/ruby/format.rb +303 -0
- data/lib/citeproc/ruby/formats/default.rb +25 -0
- data/lib/citeproc/ruby/formats/html.rb +221 -0
- data/lib/citeproc/ruby/renderer.rb +140 -0
- data/lib/citeproc/ruby/renderer/choose.rb +106 -0
- data/lib/citeproc/ruby/renderer/date.rb +90 -0
- data/lib/citeproc/ruby/renderer/format.rb +129 -0
- data/lib/citeproc/ruby/renderer/group.rb +34 -0
- data/lib/citeproc/ruby/renderer/history.rb +40 -0
- data/lib/citeproc/ruby/renderer/label.rb +66 -0
- data/lib/citeproc/ruby/renderer/layout.rb +20 -0
- data/lib/citeproc/ruby/renderer/locale.rb +26 -0
- data/lib/citeproc/ruby/renderer/macro.rb +20 -0
- data/lib/citeproc/ruby/renderer/names.rb +401 -0
- data/lib/citeproc/ruby/renderer/number.rb +41 -0
- data/lib/citeproc/ruby/renderer/observer.rb +44 -0
- data/lib/citeproc/ruby/renderer/state.rb +96 -0
- data/lib/citeproc/ruby/renderer/text.rb +62 -0
- data/lib/citeproc/ruby/sort.rb +82 -0
- data/lib/citeproc/ruby/version.rb +5 -0
- data/spec/citeproc/ruby/engine_spec.rb +94 -0
- data/spec/citeproc/ruby/formats/default_spec.rb +159 -0
- data/spec/citeproc/ruby/formats/html_spec.rb +162 -0
- data/spec/citeproc/ruby/renderer/choose_spec.rb +293 -0
- data/spec/citeproc/ruby/renderer/date_spec.rb +173 -0
- data/spec/citeproc/ruby/renderer/group_spec.rb +88 -0
- data/spec/citeproc/ruby/renderer/history_spec.rb +38 -0
- data/spec/citeproc/ruby/renderer/label_spec.rb +225 -0
- data/spec/citeproc/ruby/renderer/layout_spec.rb +41 -0
- data/spec/citeproc/ruby/renderer/macro_spec.rb +31 -0
- data/spec/citeproc/ruby/renderer/names_spec.rb +396 -0
- data/spec/citeproc/ruby/renderer/number_spec.rb +120 -0
- data/spec/citeproc/ruby/renderer/text_spec.rb +120 -0
- data/spec/citeproc/ruby/renderer_spec.rb +65 -0
- data/spec/fixtures/items.rb +80 -0
- data/{resource/locale → spec/fixtures/locales}/locales-en-US.xml +2 -11
- data/{resource/locale → spec/fixtures/locales}/locales-fr-FR.xml +77 -66
- data/{resource/style → spec/fixtures/styles}/apa.csl +5 -5
- data/spec/spec_helper.rb +67 -14
- metadata +121 -211
- data/lib/citeproc.rb +0 -100
- data/lib/citeproc/bibliography.rb +0 -57
- data/lib/citeproc/data.rb +0 -149
- data/lib/citeproc/date.rb +0 -133
- data/lib/citeproc/formatter.rb +0 -38
- data/lib/citeproc/item.rb +0 -53
- data/lib/citeproc/name.rb +0 -284
- data/lib/citeproc/processor.rb +0 -166
- data/lib/citeproc/selector.rb +0 -61
- data/lib/citeproc/variable.rb +0 -82
- data/lib/citeproc/version.rb +0 -3
- data/lib/csl/locale.rb +0 -223
- data/lib/csl/node.rb +0 -72
- data/lib/csl/nodes.rb +0 -1418
- data/lib/csl/renderer.rb +0 -88
- data/lib/csl/sort.rb +0 -61
- data/lib/csl/style.rb +0 -110
- data/lib/csl/term.rb +0 -124
- data/lib/extensions/core.rb +0 -43
- data/lib/plugins/filters/bibtex.rb +0 -12
- data/lib/plugins/formats/default.rb +0 -134
- data/lib/plugins/formats/html.rb +0 -67
- data/lib/support/attributes.rb +0 -99
- data/lib/support/compatibility.rb +0 -83
- data/lib/support/tree.rb +0 -80
- data/resource/locale/locales-af-ZA.xml +0 -305
- data/resource/locale/locales-ar-AR.xml +0 -306
- data/resource/locale/locales-bg-BG.xml +0 -305
- data/resource/locale/locales-ca-AD.xml +0 -305
- data/resource/locale/locales-cs-CZ.xml +0 -305
- data/resource/locale/locales-da-DK.xml +0 -305
- data/resource/locale/locales-de-AT.xml +0 -304
- data/resource/locale/locales-de-CH.xml +0 -304
- data/resource/locale/locales-de-DE.xml +0 -332
- data/resource/locale/locales-el-GR.xml +0 -305
- data/resource/locale/locales-en-GB.xml +0 -304
- data/resource/locale/locales-es-ES.xml +0 -305
- data/resource/locale/locales-et-EE.xml +0 -304
- data/resource/locale/locales-eu.xml +0 -305
- data/resource/locale/locales-fa-IR.xml +0 -304
- data/resource/locale/locales-fi-FI.xml +0 -304
- data/resource/locale/locales-fr-CA.xml +0 -306
- data/resource/locale/locales-he-IL.xml +0 -304
- data/resource/locale/locales-hu-HU.xml +0 -305
- data/resource/locale/locales-is-IS.xml +0 -304
- data/resource/locale/locales-it-IT.xml +0 -305
- data/resource/locale/locales-ja-JP.xml +0 -305
- data/resource/locale/locales-kh-KH.xml +0 -303
- data/resource/locale/locales-km-KH.xml +0 -304
- data/resource/locale/locales-ko-KR.xml +0 -305
- data/resource/locale/locales-mn-MN.xml +0 -306
- data/resource/locale/locales-nb-NO.xml +0 -304
- data/resource/locale/locales-nl-NL.xml +0 -304
- data/resource/locale/locales-nn-NO.xml +0 -304
- data/resource/locale/locales-pl-PL.xml +0 -305
- data/resource/locale/locales-pt-BR.xml +0 -304
- data/resource/locale/locales-pt-PT.xml +0 -305
- data/resource/locale/locales-ro-RO.xml +0 -305
- data/resource/locale/locales-ru-RU.xml +0 -306
- data/resource/locale/locales-sk-SK.xml +0 -304
- data/resource/locale/locales-sl-SI.xml +0 -305
- data/resource/locale/locales-sr-RS.xml +0 -305
- data/resource/locale/locales-sv-SE.xml +0 -305
- data/resource/locale/locales-th-TH.xml +0 -304
- data/resource/locale/locales-tr-TR.xml +0 -305
- data/resource/locale/locales-uk-UA.xml +0 -306
- data/resource/locale/locales-vi-VN.xml +0 -305
- data/resource/locale/locales-zh-CN.xml +0 -304
- data/resource/locale/locales-zh-TW.xml +0 -305
- data/resource/schema/csl-categories.rnc +0 -39
- data/resource/schema/csl-data.rnc +0 -98
- data/resource/schema/csl-terms.rnc +0 -106
- data/resource/schema/csl-types.rnc +0 -39
- data/resource/schema/csl-variables.rnc +0 -182
- data/resource/schema/csl.rnc +0 -941
- data/resource/style/bibtex.csl +0 -177
- data/resource/style/chicago-annotated-bibliography.csl +0 -513
- data/resource/style/chicago-author-date-basque.csl +0 -707
- data/resource/style/chicago-author-date-de.csl +0 -394
- data/resource/style/chicago-author-date-listing.csl +0 -434
- data/resource/style/chicago-author-date.csl +0 -425
- data/resource/style/chicago-dated-note-biblio-no-ibid.csl +0 -472
- data/resource/style/chicago-fullnote-bibliography-bb.csl +0 -928
- data/resource/style/chicago-fullnote-bibliography-delimiter-fixes.csl +0 -972
- data/resource/style/chicago-fullnote-bibliography-no-ibid-delimiter-fixes.csl +0 -963
- data/resource/style/chicago-fullnote-bibliography-no-ibid.csl +0 -785
- data/resource/style/chicago-fullnote-bibliography.csl +0 -803
- data/resource/style/chicago-library-list.csl +0 -511
- data/resource/style/chicago-note-biblio-no-ibid.csl +0 -514
- data/resource/style/chicago-note-bibliography.csl +0 -530
- data/resource/style/chicago-note.csl +0 -388
- data/resource/style/chicago-quick-copy.csl +0 -685
- data/resource/style/ieee.csl +0 -299
- data/resource/style/mla-notes.csl +0 -796
- data/resource/style/mla-underline.csl +0 -175
- data/resource/style/mla-url.csl +0 -214
- data/resource/style/mla.csl +0 -394
- data/resource/style/vancouver-brackets.csl +0 -256
- data/resource/style/vancouver-superscript-bracket-only-year.csl +0 -165
- data/resource/style/vancouver-superscript.csl +0 -256
- data/resource/style/vancouver.csl +0 -256
- data/spec/citeproc/bibliography_spec.rb +0 -45
- data/spec/citeproc/citeproc_spec.rb +0 -80
- data/spec/citeproc/date_spec.rb +0 -89
- data/spec/citeproc/formatter_spec.rb +0 -101
- data/spec/citeproc/item_spec.rb +0 -71
- data/spec/citeproc/name_spec.rb +0 -30
- data/spec/citeproc/processor_spec.rb +0 -61
- data/spec/citeproc/selector_spec.rb +0 -82
- data/spec/citeproc/variable_spec.rb +0 -69
- data/spec/csl/locale_spec.rb +0 -208
- data/spec/csl/node_spec.rb +0 -25
- data/spec/csl/nodes_spec.rb +0 -145
- data/spec/csl/style_spec.rb +0 -62
- data/spec/csl/term_spec.rb +0 -56
- data/spec/fixtures/dates.yaml +0 -80
- data/spec/fixtures/names.yaml +0 -115
- data/spec/fixtures/nodes.yaml +0 -245
- data/spec/support/attributes_spec.rb +0 -39
- data/spec/support/tree_spec.rb +0 -163
data/spec/csl/node_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module CSL
|
2
|
-
describe Node do
|
3
|
-
|
4
|
-
describe 'CSL.Node utility function' do
|
5
|
-
# it 'returns a new Node from an empty Hash' do
|
6
|
-
# CSL.Node({}).should_not be_nil
|
7
|
-
# end
|
8
|
-
end
|
9
|
-
|
10
|
-
describe '#new' do
|
11
|
-
it { should_not be_nil }
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '.create' do
|
15
|
-
it 'accepts an empty hash and returns a new Node' do
|
16
|
-
Node.create({}).is_a?(Node).should be true
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'creates a new node with the given parameters' do
|
20
|
-
Node.create(:foo => 'foo')[:foo].should == 'foo'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
data/spec/csl/nodes_spec.rb
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
module CSL
|
2
|
-
class Nodes
|
3
|
-
|
4
|
-
describe Nodes do
|
5
|
-
|
6
|
-
let(:style) { Style.new }
|
7
|
-
let(:locale) { CSL.default_locale }
|
8
|
-
|
9
|
-
let(:node) { Node.new('<node/>') }
|
10
|
-
|
11
|
-
describe '#new' do
|
12
|
-
it 'parses an xml node' do
|
13
|
-
node.nil?.should_not be true
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'supports multiple arguments' do
|
17
|
-
n = Node.new(node, style, '<node/>')
|
18
|
-
n.parent.should == node
|
19
|
-
n.style.should == style
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'parses child elements' do
|
23
|
-
child = Node.new('<node><node/></node>', node)
|
24
|
-
child.parent.should == node
|
25
|
-
child.children.length.should == 1
|
26
|
-
child.children.first.parent.should == child
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'parses comments and the comment node provides an evaluate method' do
|
30
|
-
child = Node.new('<node><!-- <node/> --></node>')
|
31
|
-
child.children.first.respond_to?(:evaluate).should be true
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'pushes style to children' do
|
35
|
-
child = Node.new('<node><node/></node>', style)
|
36
|
-
child.children.first.style.should == style
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'supports a self yielding block' do
|
40
|
-
Node.new { |n| n.parent = node }.parent.should == node
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'accepts an attributes hash' do
|
44
|
-
Node.new('foo' => 'bar')['foo'].should == 'bar'
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
describe Text do
|
50
|
-
|
51
|
-
describe '#new' do
|
52
|
-
it 'parses an xml node' do
|
53
|
-
Text.new('<text/>', style).nil?.should_not be true
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
describe 'attributes' do
|
59
|
-
it 'are initialised correctly' do
|
60
|
-
xml = [
|
61
|
-
'<text term="editorial-director" plural="false" />',
|
62
|
-
'<text term="editorial-director" plural="true" />',
|
63
|
-
'<text term="section" form="symbol" plural="false" />',
|
64
|
-
'<text term="section" form="symbol" plural="true" />']
|
65
|
-
|
66
|
-
expected = [true, 'editorial-director', false, nil, false, 'false',
|
67
|
-
true, 'editorial-director', false, nil, true, 'true',
|
68
|
-
true, 'section', true, 'symbol', false, 'false',
|
69
|
-
true, 'section', true, 'symbol', true, 'true']
|
70
|
-
|
71
|
-
result = xml.map { |t|
|
72
|
-
item = CiteProc::Item.new
|
73
|
-
text = CSL::Nodes::Text.new(Nokogiri::XML(t).root, @style)
|
74
|
-
[text.term?, text.term, text.form?, text.form, text.plural?, text.plural]
|
75
|
-
}.flatten
|
76
|
-
|
77
|
-
result.should == expected
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
describe Number do
|
84
|
-
|
85
|
-
describe '#new' do
|
86
|
-
|
87
|
-
it { should_not be_nil }
|
88
|
-
|
89
|
-
it 'parses an XML node' do
|
90
|
-
number = Number.new('<number/>', style)
|
91
|
-
number.should_not be_nil
|
92
|
-
number.style.should_not be_nil
|
93
|
-
number.form?.should be false
|
94
|
-
number.variable?.should be false
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
|
100
|
-
describe Date do
|
101
|
-
let(:date) { Date.new }
|
102
|
-
|
103
|
-
describe '#new' do
|
104
|
-
it { should_not be_nil }
|
105
|
-
end
|
106
|
-
|
107
|
-
describe '#merge_parts' do
|
108
|
-
it 'merges two empty lists' do
|
109
|
-
date.merge_parts([], []).should be_empty
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'merges an empty list and a list of date-parts' do
|
113
|
-
date.merge_parts([], locale.date['text']).should be_empty
|
114
|
-
end
|
115
|
-
|
116
|
-
it 'merges a list of date-parts and an empty list' do
|
117
|
-
date.merge_parts(locale.date['text'], []).map(&:to_s).should == locale.date['text'].map(&:to_s)
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'merges a list of date-parts with itself' do
|
121
|
-
date.merge_parts(locale.date['text'], locale.date['text']).map(&:to_s).should == locale.date['text'].map(&:to_s)
|
122
|
-
end
|
123
|
-
|
124
|
-
it 'filters according to the date-parts attribute' do
|
125
|
-
date.date_parts = 'year'
|
126
|
-
date.merge_parts(locale.date['text'], []).should have(1).part
|
127
|
-
date.date_parts = 'month-day'
|
128
|
-
date.merge_parts(locale.date['text'], []).should have(2).parts
|
129
|
-
end
|
130
|
-
|
131
|
-
it 'copies attribute values' do
|
132
|
-
date.merge_parts([DatePart.new({'name' => 'year'})], [DatePart.new({'name' => 'year', 'foo' => 'bar'})]).first['foo'].should == 'bar'
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
describe '#date_parts' do
|
137
|
-
it 'returns year-month-day by default' do
|
138
|
-
date.date_parts.should == 'year-month-day'
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
data/spec/csl/style_spec.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
module CSL
|
2
|
-
|
3
|
-
describe Style do
|
4
|
-
|
5
|
-
let(:style) { Style.new }
|
6
|
-
let(:apa) { Style.new.open('apa') }
|
7
|
-
|
8
|
-
describe '#open' do
|
9
|
-
it 'accepts a style name' do
|
10
|
-
style.open('apa').id.should_not be_empty
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'accepts a filename' do
|
14
|
-
style.open(File.expand_path('../../../resource/style/apa.csl', __FILE__)).id.should_not be_empty
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'accepts an inline style' do
|
18
|
-
style.open(File.read(File.expand_path('../../../resource/style/apa.csl', __FILE__))).id.should_not be_empty
|
19
|
-
end
|
20
|
-
|
21
|
-
# -- requires internet connection
|
22
|
-
# it 'accepts an URI' do
|
23
|
-
# style.open 'http://www.zotero.org/styles/apa'
|
24
|
-
# style.id.should == 'http://www.zotero.org/styles/apa'
|
25
|
-
# end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
describe 'info' do
|
30
|
-
it 'returns id, title, and link information' do
|
31
|
-
# style.id.should == 'http://www.zotero.org/styles/apa'
|
32
|
-
# style.link.should == 'http://www.zotero.org/styles/apa'
|
33
|
-
apa.title.should =~ /American Psychological Association/
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe 'macros' do
|
38
|
-
it 'initialises a macros hash' do
|
39
|
-
apa.macros.keys.sort.should include("issued")
|
40
|
-
apa.macros.values.map(&:class).uniq.should == [CSL::Nodes::Macro]
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe 'citation renderer' do
|
45
|
-
it 'initialises the citation renderer' do
|
46
|
-
apa.citation.respond_to?(:process)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'contains a layout section' do
|
50
|
-
apa.citation.layout.should_not == nil
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
describe 'bibliography renderer' do
|
56
|
-
it 'initialises the bibliography renderer' do
|
57
|
-
apa.bibliography.should_not == nil
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
end
|
data/spec/csl/term_spec.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
module CSL
|
2
|
-
|
3
|
-
describe Term do
|
4
|
-
|
5
|
-
let(:xml) { '<term name="test" gender="neutral"><single>test</single><multiple>tests</multiple></term>' }
|
6
|
-
let(:hash) { { 'long' => { 'singular' => 'test', 'plural' => 'tests' } } }
|
7
|
-
|
8
|
-
describe '#new' do
|
9
|
-
it 'defaults to an empty string' do
|
10
|
-
Term.new.to_s.should be_empty
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'parses an XML string' do
|
14
|
-
Term.new(xml).to_s.should == 'test'
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'parses a hash' do
|
18
|
-
Term.new(hash).to_s.should == 'test'
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'supports a self yielding block' do
|
22
|
-
Term.new do |t|
|
23
|
-
t['long'] = { 'singular' => 'test', 'plural' => 'tests' }
|
24
|
-
end.to_s.should == 'test'
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#pluralize' do
|
29
|
-
it 'returns the terms plural form' do
|
30
|
-
Term.new(hash).pluralize.should == 'tests'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '#singularize' do
|
35
|
-
it 'returns the terms singular form' do
|
36
|
-
Term.new(hash).singularize.should == 'test'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe 'gender' do
|
41
|
-
it 'parses the gender attribute' do
|
42
|
-
Term.new(xml).should have_gender
|
43
|
-
Term.new(xml).should be_neutral
|
44
|
-
Term.new(xml).should_not be_masculine
|
45
|
-
Term.new(xml).should_not be_feminine
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'has no gender by default' do
|
49
|
-
Term.new.should_not have_gender
|
50
|
-
Term.new(hash).should_not have_gender
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
data/spec/fixtures/dates.yaml
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
---
|
2
|
-
display:
|
3
|
-
- it: returns an empty string by default
|
4
|
-
dates:
|
5
|
-
- {}
|
6
|
-
expected:
|
7
|
-
- ""
|
8
|
-
options: {}
|
9
|
-
json-api:
|
10
|
-
- it: supports simple parts
|
11
|
-
dates:
|
12
|
-
- date-parts:
|
13
|
-
- - "2000"
|
14
|
-
- "1"
|
15
|
-
- "15"
|
16
|
-
expected:
|
17
|
-
- '{"date-parts":[[2000,1,15]]}'
|
18
|
-
options: {}
|
19
|
-
- it: supports integers and strings parts
|
20
|
-
dates:
|
21
|
-
- date-parts:
|
22
|
-
- - "2000"
|
23
|
-
- "1"
|
24
|
-
- "15"
|
25
|
-
- date-parts:
|
26
|
-
- - 2000
|
27
|
-
- 1
|
28
|
-
- 15
|
29
|
-
- date-parts:
|
30
|
-
- - '2000'
|
31
|
-
- 1
|
32
|
-
- '15'
|
33
|
-
expected:
|
34
|
-
- '{"date-parts":[[2000,1,15]]}'
|
35
|
-
- '{"date-parts":[[2000,1,15]]}'
|
36
|
-
- '{"date-parts":[[2000,1,15]]}'
|
37
|
-
options: {}
|
38
|
-
- it: supports negative years
|
39
|
-
dates:
|
40
|
-
- date-parts:
|
41
|
-
- - -200
|
42
|
-
expected:
|
43
|
-
- '{"date-parts":[[-200]]}'
|
44
|
-
options: {}
|
45
|
-
- it: supports additional elements
|
46
|
-
dates:
|
47
|
-
- season: '1'
|
48
|
-
date-parts:
|
49
|
-
- - 1950
|
50
|
-
- season: 'Trinity'
|
51
|
-
date-parts:
|
52
|
-
- - 1975
|
53
|
-
expected:
|
54
|
-
- '{"season":"1","date-parts":[[1950]]}'
|
55
|
-
- '{"season":"Trinity","date-parts":[[1975]]}'
|
56
|
-
options: {}
|
57
|
-
- it: supports open and closed ranges
|
58
|
-
dates:
|
59
|
-
- date-parts:
|
60
|
-
- - 2000
|
61
|
-
- 11
|
62
|
-
- - 2000
|
63
|
-
- 12
|
64
|
-
- date-parts:
|
65
|
-
- - 2000
|
66
|
-
- 11
|
67
|
-
- - 0
|
68
|
-
- 0
|
69
|
-
expected:
|
70
|
-
- '{"date-parts":[[2000,11],[2000,12]]}'
|
71
|
-
- '{"date-parts":[[2000,11],[0,0]]}'
|
72
|
-
options: {}
|
73
|
-
- it: supports string literals and raw strings
|
74
|
-
dates:
|
75
|
-
- literal: 13th century
|
76
|
-
- raw: 23 May 1955
|
77
|
-
expected:
|
78
|
-
- '{"literal":"13th century"}'
|
79
|
-
- '{"date-parts":[[1955,5,23]]}'
|
80
|
-
options: {}
|
data/spec/fixtures/names.yaml
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
---
|
2
|
-
display:
|
3
|
-
- it: returns an empty string by default
|
4
|
-
names:
|
5
|
-
- {}
|
6
|
-
expected:
|
7
|
-
- ""
|
8
|
-
options: {}
|
9
|
-
- it: returns a name in the correct default order
|
10
|
-
names:
|
11
|
-
- given: John
|
12
|
-
- family: Plato
|
13
|
-
- given: Edgar Allen
|
14
|
-
family: Poe
|
15
|
-
- given: Gérard
|
16
|
-
dropping-particle: de
|
17
|
-
non-dropping-particle: la
|
18
|
-
family: Martinière
|
19
|
-
suffix: III
|
20
|
-
expected:
|
21
|
-
- "John"
|
22
|
-
- "Plato"
|
23
|
-
- "Edgar Allen Poe"
|
24
|
-
- "Gérard de la Martinière III"
|
25
|
-
options: {}
|
26
|
-
- it: returns a name in correct order
|
27
|
-
names:
|
28
|
-
- given: John
|
29
|
-
- family: Plato
|
30
|
-
suffix: II
|
31
|
-
- given: Edgar Allen
|
32
|
-
family: Poe
|
33
|
-
- given: Gérard
|
34
|
-
dropping-particle: de
|
35
|
-
non-dropping-particle: la
|
36
|
-
family: Martinière
|
37
|
-
suffix: III
|
38
|
-
expected:
|
39
|
-
- "John"
|
40
|
-
- "Plato, II"
|
41
|
-
- "Poe, Edgar Allen"
|
42
|
-
- "la Martinière, Gérard de, III"
|
43
|
-
options:
|
44
|
-
name-as-sort-order: "true"
|
45
|
-
demote-non-dropping-particle: "never"
|
46
|
-
sort:
|
47
|
-
- it: sorts an empty list
|
48
|
-
names: []
|
49
|
-
expected: []
|
50
|
-
options: {}
|
51
|
-
- it: sorts a list containing only a single element
|
52
|
-
names:
|
53
|
-
- {}
|
54
|
-
expected:
|
55
|
-
- ""
|
56
|
-
options: {}
|
57
|
-
- it: sorts a list containing multiple elements
|
58
|
-
names:
|
59
|
-
- given: John
|
60
|
-
- family: Plato
|
61
|
-
- given: Edgar Allen
|
62
|
-
family: Poe
|
63
|
-
- given: Gérard
|
64
|
-
dropping-particle: de
|
65
|
-
non-dropping-particle: la
|
66
|
-
family: Martinière
|
67
|
-
suffix: III
|
68
|
-
expected:
|
69
|
-
- "John"
|
70
|
-
- "Gérard de la Martinière III"
|
71
|
-
- "Plato"
|
72
|
-
- "Edgar Allen Poe"
|
73
|
-
options: {}
|
74
|
-
- it: parses names correctly
|
75
|
-
names:
|
76
|
-
- family: van Gogh
|
77
|
-
given: Vincent
|
78
|
-
parse-names: "true"
|
79
|
-
- family: van Gogh
|
80
|
-
given: Vincent
|
81
|
-
- family: Humbolt
|
82
|
-
given: Alexander von
|
83
|
-
parse-names: "true"
|
84
|
-
- family: King
|
85
|
-
given: "Martin Luther, Jr."
|
86
|
-
parse-names: "true"
|
87
|
-
- family: King
|
88
|
-
given: "Martin Luther, Jr."
|
89
|
-
- family: Gates
|
90
|
-
given: "William Henry, III"
|
91
|
-
parse-names: "true"
|
92
|
-
- family: Bennett
|
93
|
-
given: "Frank G.,! Jr."
|
94
|
-
parse-names: "true"
|
95
|
-
- family: '"van der Vlist"'
|
96
|
-
given: Eric
|
97
|
-
parse-names: "true"
|
98
|
-
- family: van der Vlist
|
99
|
-
given: Eric
|
100
|
-
- family: van der Vlist
|
101
|
-
given: Eric
|
102
|
-
parse-names: true
|
103
|
-
expected:
|
104
|
-
- "Frank G. Bennett, Jr."
|
105
|
-
- William Henry Gates III
|
106
|
-
- Vincent van Gogh
|
107
|
-
- Alexander von Humbolt
|
108
|
-
- Martin Luther King Jr.
|
109
|
-
- "Martin Luther, Jr. King"
|
110
|
-
- Eric van der Vlist
|
111
|
-
- Eric van der Vlist
|
112
|
-
- Vincent van Gogh
|
113
|
-
- Eric van der Vlist
|
114
|
-
options:
|
115
|
-
demote-non-dropping-particle: "always"
|