citeproc-ruby 0.0.1
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.
- data/README.md +78 -0
- data/lib/citeproc.rb +100 -0
- data/lib/citeproc/bibliography.rb +57 -0
- data/lib/citeproc/data.rb +149 -0
- data/lib/citeproc/date.rb +133 -0
- data/lib/citeproc/formatter.rb +38 -0
- data/lib/citeproc/item.rb +53 -0
- data/lib/citeproc/name.rb +284 -0
- data/lib/citeproc/processor.rb +166 -0
- data/lib/citeproc/selector.rb +61 -0
- data/lib/citeproc/variable.rb +82 -0
- data/lib/citeproc/version.rb +3 -0
- data/lib/csl/locale.rb +223 -0
- data/lib/csl/node.rb +72 -0
- data/lib/csl/nodes.rb +1364 -0
- data/lib/csl/renderer.rb +88 -0
- data/lib/csl/sort.rb +53 -0
- data/lib/csl/style.rb +110 -0
- data/lib/csl/term.rb +124 -0
- data/lib/extensions/core.rb +43 -0
- data/lib/plugins/filters/bibtex.rb +12 -0
- data/lib/plugins/formats/default.rb +134 -0
- data/lib/plugins/formats/html.rb +67 -0
- data/lib/support/attributes.rb +99 -0
- data/lib/support/tree.rb +80 -0
- data/resource/locale/locales-af-ZA.xml +304 -0
- data/resource/locale/locales-ar-AR.xml +304 -0
- data/resource/locale/locales-bg-BG.xml +304 -0
- data/resource/locale/locales-ca-AD.xml +304 -0
- data/resource/locale/locales-cs-CZ.xml +304 -0
- data/resource/locale/locales-da-DK.xml +304 -0
- data/resource/locale/locales-de-AT.xml +304 -0
- data/resource/locale/locales-de-CH.xml +304 -0
- data/resource/locale/locales-de-DE.xml +332 -0
- data/resource/locale/locales-el-GR.xml +303 -0
- data/resource/locale/locales-en-US.xml +313 -0
- data/resource/locale/locales-es-ES.xml +304 -0
- data/resource/locale/locales-et-EE.xml +304 -0
- data/resource/locale/locales-fr-FR.xml +304 -0
- data/resource/locale/locales-he-IL.xml +304 -0
- data/resource/locale/locales-hu-HU.xml +304 -0
- data/resource/locale/locales-is-IS.xml +304 -0
- data/resource/locale/locales-it-IT.xml +304 -0
- data/resource/locale/locales-ja-JP.xml +304 -0
- data/resource/locale/locales-kh-KH.xml +303 -0
- data/resource/locale/locales-ko-KR.xml +304 -0
- data/resource/locale/locales-mn-MN.xml +304 -0
- data/resource/locale/locales-nb-NO.xml +304 -0
- data/resource/locale/locales-nl-NL.xml +304 -0
- data/resource/locale/locales-nn-NO.xml +304 -0
- data/resource/locale/locales-pl-PL.xml +304 -0
- data/resource/locale/locales-pt-BR.xml +304 -0
- data/resource/locale/locales-pt-PT.xml +304 -0
- data/resource/locale/locales-ro-RO.xml +304 -0
- data/resource/locale/locales-ru-RU.xml +304 -0
- data/resource/locale/locales-sk-SK.xml +304 -0
- data/resource/locale/locales-sl-SI.xml +304 -0
- data/resource/locale/locales-sr-RS.xml +304 -0
- data/resource/locale/locales-sv-SE.xml +304 -0
- data/resource/locale/locales-th-TH.xml +304 -0
- data/resource/locale/locales-tr-TR.xml +304 -0
- data/resource/locale/locales-uk-UA.xml +304 -0
- data/resource/locale/locales-vi-VN.xml +304 -0
- data/resource/locale/locales-zh-CN.xml +304 -0
- data/resource/locale/locales-zh-TW.xml +304 -0
- data/resource/schema/csl-categories.rnc +39 -0
- data/resource/schema/csl-data.rnc +98 -0
- data/resource/schema/csl-terms.rnc +106 -0
- data/resource/schema/csl-types.rnc +39 -0
- data/resource/schema/csl-variables.rnc +182 -0
- data/resource/schema/csl.rnc +941 -0
- data/resource/style/acta-materialia-x.csl +128 -0
- data/resource/style/advanced-engineering-materials-x.csl +121 -0
- data/resource/style/ama.csl +185 -0
- data/resource/style/ama2-x.csl +179 -0
- data/resource/style/apa-x.csl +324 -0
- data/resource/style/apa.csl +254 -0
- data/resource/style/apsa-x.csl +163 -0
- data/resource/style/apsa.csl +176 -0
- data/resource/style/asa-x.csl +203 -0
- data/resource/style/asa.csl +216 -0
- data/resource/style/asm-journals-x.csl +131 -0
- data/resource/style/bibtex-x2.csl +175 -0
- data/resource/style/bluebook-demo-x.csl +392 -0
- data/resource/style/bluebook-demo.csl +942 -0
- data/resource/style/chicago-author-date-listing.csl +434 -0
- data/resource/style/chicago-author-date.csl +369 -0
- data/resource/style/chicago-fullnote-bibliography-bb.csl +928 -0
- data/resource/style/chicago-fullnote-bibliography.csl +695 -0
- data/resource/style/chicago-note-bibliography.csl +446 -0
- data/resource/style/chicago-note.csl +388 -0
- data/resource/style/greek-chicago-x.csl +1182 -0
- data/resource/style/harvard1-institution-italic.csl +190 -0
- data/resource/style/harvard1.csl +181 -0
- data/resource/style/ieee.csl +129 -0
- data/resource/style/mhra-x.csl +312 -0
- data/resource/style/mhra.csl +390 -0
- data/resource/style/mhra_note_without_bibliography-x.csl +330 -0
- data/resource/style/mhra_note_without_bibliography.csl +338 -0
- data/resource/style/mla-x.csl +178 -0
- data/resource/style/mla.csl +189 -0
- data/resource/style/nature-x.csl +81 -0
- data/resource/style/nature.csl +88 -0
- data/resource/style/nlm.csl +117 -0
- data/spec/citeproc/bibliography_spec.rb +45 -0
- data/spec/citeproc/citeproc_spec.rb +76 -0
- data/spec/citeproc/date_spec.rb +85 -0
- data/spec/citeproc/formatter_spec.rb +101 -0
- data/spec/citeproc/item_spec.rb +71 -0
- data/spec/citeproc/name_spec.rb +30 -0
- data/spec/citeproc/processor_spec.rb +61 -0
- data/spec/citeproc/selector_spec.rb +82 -0
- data/spec/citeproc/variable_spec.rb +69 -0
- data/spec/csl/locale_spec.rb +208 -0
- data/spec/csl/node_spec.rb +25 -0
- data/spec/csl/nodes_spec.rb +140 -0
- data/spec/csl/style_spec.rb +62 -0
- data/spec/csl/term_spec.rb +56 -0
- data/spec/fixtures/dates.yaml +80 -0
- data/spec/fixtures/names.yaml +115 -0
- data/spec/fixtures/nodes.yaml +245 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/attributes_spec.rb +39 -0
- data/spec/support/tree_spec.rb +163 -0
- metadata +264 -0
|
@@ -0,0 +1,25 @@
|
|
|
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
|
|
@@ -0,0 +1,140 @@
|
|
|
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 'pushes style to children' do
|
|
30
|
+
child = Node.new('<node><node/></node>', style)
|
|
31
|
+
child.children.first.style.should == style
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'supports a self yielding block' do
|
|
35
|
+
Node.new { |n| n.parent = node }.parent.should == node
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'accepts an attributes hash' do
|
|
39
|
+
Node.new('foo' => 'bar')['foo'].should == 'bar'
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
describe Text do
|
|
45
|
+
|
|
46
|
+
describe '#new' do
|
|
47
|
+
it 'parses an xml node' do
|
|
48
|
+
Text.new('<text/>', style).nil?.should_not be true
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe 'attributes' do
|
|
54
|
+
it 'are initialised correctly' do
|
|
55
|
+
xml = [
|
|
56
|
+
'<text term="editorial-director" plural="false" />',
|
|
57
|
+
'<text term="editorial-director" plural="true" />',
|
|
58
|
+
'<text term="section" form="symbol" plural="false" />',
|
|
59
|
+
'<text term="section" form="symbol" plural="true" />']
|
|
60
|
+
|
|
61
|
+
expected = [true, 'editorial-director', false, nil, false, 'false',
|
|
62
|
+
true, 'editorial-director', false, nil, true, 'true',
|
|
63
|
+
true, 'section', true, 'symbol', false, 'false',
|
|
64
|
+
true, 'section', true, 'symbol', true, 'true']
|
|
65
|
+
|
|
66
|
+
result = xml.map { |t|
|
|
67
|
+
item = CiteProc::Item.new
|
|
68
|
+
text = CSL::Nodes::Text.new(Nokogiri::XML(t).root, @style)
|
|
69
|
+
[text.term?, text.term, text.form?, text.form, text.plural?, text.plural]
|
|
70
|
+
}.flatten
|
|
71
|
+
|
|
72
|
+
result.should == expected
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
describe Number do
|
|
79
|
+
|
|
80
|
+
describe '#new' do
|
|
81
|
+
|
|
82
|
+
it { should_not be_nil }
|
|
83
|
+
|
|
84
|
+
it 'parses an XML node' do
|
|
85
|
+
number = Number.new('<number/>', style)
|
|
86
|
+
number.should_not be_nil
|
|
87
|
+
number.style.should_not be_nil
|
|
88
|
+
number.form?.should be false
|
|
89
|
+
number.variable?.should be false
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
describe Date do
|
|
96
|
+
let(:date) { Date.new }
|
|
97
|
+
|
|
98
|
+
describe '#new' do
|
|
99
|
+
it { should_not be_nil }
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
describe '#merge_parts' do
|
|
103
|
+
it 'merges two empty lists' do
|
|
104
|
+
date.merge_parts([], []).should be_empty
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it 'merges an empty list and a list of date-parts' do
|
|
108
|
+
date.merge_parts([], locale.date['text']).should be_empty
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it 'merges a list of date-parts and an empty list' do
|
|
112
|
+
date.merge_parts(locale.date['text'], []).map(&:to_s).should == locale.date['text'].map(&:to_s)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it 'merges a list of date-parts with itself' do
|
|
116
|
+
date.merge_parts(locale.date['text'], locale.date['text']).map(&:to_s).should == locale.date['text'].map(&:to_s)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
it 'filters according to the date-parts attribute' do
|
|
120
|
+
date.date_parts = 'year'
|
|
121
|
+
date.merge_parts(locale.date['text'], []).should have(1).part
|
|
122
|
+
date.date_parts = 'month-day'
|
|
123
|
+
date.merge_parts(locale.date['text'], []).should have(2).parts
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
it 'copies attribute values' do
|
|
127
|
+
date.merge_parts([DatePart.new({'name' => 'year'})], [DatePart.new({'name' => 'year', 'foo' => 'bar'})]).first['foo'].should == 'bar'
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
describe '#date_parts' do
|
|
132
|
+
it 'returns year-month-day by default' do
|
|
133
|
+
date.date_parts.should == 'year-month-day'
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
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 == ["access", "author", "author-short", "citation-locator", "container-contributors", "edition", "event", "issued", "issued-year", "locators", "publisher", "secondary-contributors", "title"]
|
|
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
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
|
@@ -0,0 +1,80 @@
|
|
|
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: {}
|
|
@@ -0,0 +1,115 @@
|
|
|
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"
|