citeproc-ruby 0.0.6 → 1.0.0
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.
- 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
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module CiteProc
|
|
4
|
+
module Ruby
|
|
5
|
+
|
|
6
|
+
describe "Renderer#render_number" do
|
|
7
|
+
let(:renderer) { Renderer.new }
|
|
8
|
+
|
|
9
|
+
let(:node) { CSL::Style::Number.new }
|
|
10
|
+
|
|
11
|
+
let(:item) {
|
|
12
|
+
i = CiteProc::CitationItem.new(:id => 'ID-1')
|
|
13
|
+
i.data = CiteProc::Item.new(:id => 'ID-1')
|
|
14
|
+
i
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
describe 'given an empty node' do
|
|
18
|
+
it 'returns an empty string for an empty item' do
|
|
19
|
+
renderer.render_number(item, node).should == ''
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'returns an empty string for an item with variables' do
|
|
23
|
+
item.data.edition = 'foo'
|
|
24
|
+
renderer.render_number(item, node).should == ''
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe 'given a node with a variable' do
|
|
29
|
+
before(:each) { node[:variable] = :edition }
|
|
30
|
+
|
|
31
|
+
it 'returns an empty string for an empty item' do
|
|
32
|
+
renderer.render_number(item, node).should == ''
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe 'and an item with a corresponding text value' do
|
|
36
|
+
before(:each) { item.data.edition = 'foo,bar' }
|
|
37
|
+
|
|
38
|
+
it 'returns the text value as is' do
|
|
39
|
+
renderer.render_number(item, node).should == 'foo,bar'
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe 'and an item with a simple number' do
|
|
44
|
+
before(:each) { item.data.edition = '42' }
|
|
45
|
+
|
|
46
|
+
it 'returns the number as a string' do
|
|
47
|
+
renderer.render_number(item, node).should == '42'
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
describe 'when the node is set to roman' do
|
|
51
|
+
before(:each) { node[:form] = :roman }
|
|
52
|
+
|
|
53
|
+
it 'returns the number romanized' do
|
|
54
|
+
renderer.render_number(item, node).should == 'xlii'
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
describe 'when the node is set to ordinal' do
|
|
59
|
+
before(:each) { node[:form] = :ordinal }
|
|
60
|
+
|
|
61
|
+
it 'returns the number ordinalized' do
|
|
62
|
+
renderer.render_number(item, node).should == '42nd'
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
describe 'and an item with a list of numbers' do
|
|
69
|
+
before(:each) { item.data.edition = '42, 43 , 44 ,45,46 , 47, 48' }
|
|
70
|
+
|
|
71
|
+
it 'returns the numbers as a normalized list' do
|
|
72
|
+
renderer.render_number(item, node).should == '42, 43, 44, 45, 46, 47, 48'
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
describe 'when the node is set to roman' do
|
|
76
|
+
before(:each) { node[:form] = :roman }
|
|
77
|
+
|
|
78
|
+
it 'returns the romanized list' do
|
|
79
|
+
renderer.render_number(item, node).should == 'xlii, xliii, xliv, xlv, xlvi, xlvii, xlviii'
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
describe 'when the node is set to ordinal' do
|
|
84
|
+
before(:each) { node[:form] = :ordinal }
|
|
85
|
+
|
|
86
|
+
it 'returns the ordinalized list' do
|
|
87
|
+
renderer.render_number(item, node).should == '42nd, 43rd, 44th, 45th, 46th, 47th, 48th'
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
describe 'and an item with a list of ranges' do
|
|
93
|
+
before(:each) { item.data.edition = '42-44, 46 -51 & 52 - 65& 66- 68' }
|
|
94
|
+
|
|
95
|
+
it 'returns the numbers as a normalized list' do
|
|
96
|
+
renderer.render_number(item, node).should == '42-44, 46-51 & 52-65 & 66-68'
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
describe 'and an item with complex numeric values' do
|
|
101
|
+
before(:each) { item.data.edition = 'A42 - B44, 46-51 & 52-65ff' }
|
|
102
|
+
|
|
103
|
+
it 'returns the numbers as a normalized list' do
|
|
104
|
+
renderer.render_number(item, node).should == 'A42-B44, 46-51 & 52-65ff'
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
describe 'when the node is set to roman' do
|
|
108
|
+
before(:each) { node[:form] = :roman }
|
|
109
|
+
|
|
110
|
+
it 'returns the list with only the simple numbers romanized' do
|
|
111
|
+
renderer.render_number(item, node).should == 'A42-B44, xlvi-li & lii-65ff'
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
end
|
|
120
|
+
end
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module CiteProc
|
|
4
|
+
module Ruby
|
|
5
|
+
|
|
6
|
+
describe 'Renderer#render_text' do
|
|
7
|
+
let(:renderer) { Renderer.new }
|
|
8
|
+
|
|
9
|
+
let(:item) {
|
|
10
|
+
i = CiteProc::CitationItem.new(:id => 'ID-1')
|
|
11
|
+
i.data = CiteProc::Item.new(:id => 'ID-1')
|
|
12
|
+
i
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
describe 'given an empty text node' do
|
|
16
|
+
let(:node) { CSL::Style::Text.new }
|
|
17
|
+
|
|
18
|
+
it 'returns an empty string for an empty item' do
|
|
19
|
+
renderer.render_text(item, node).should == ''
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'returns an empty string for an item with variables' do
|
|
23
|
+
item.data.title = 'foo'
|
|
24
|
+
renderer.render_text(item, node).should == ''
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe 'given a text node with a value' do
|
|
29
|
+
let(:node) { CSL::Style::Text.new(:value => 'foobar') }
|
|
30
|
+
|
|
31
|
+
it 'returns the value for an empty item' do
|
|
32
|
+
renderer.render_text(item, node).should == 'foobar'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'returns the value for an item with variables' do
|
|
36
|
+
item.data.title = 'foo'
|
|
37
|
+
renderer.render_text(item, node).should == 'foobar'
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe 'given a text node with a variable' do
|
|
42
|
+
let(:node) { CSL::Style::Text.new(:variable => 'title') }
|
|
43
|
+
|
|
44
|
+
it 'returns an empty strong for an empty item' do
|
|
45
|
+
renderer.render_text(item, node).should == ''
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'returns an empty strong for an item with no matching variable' do
|
|
49
|
+
item.data.publisher = 'the full title'
|
|
50
|
+
renderer.render_text(item, node).should == ''
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it "returns the variable's value for an item with a matching variable" do
|
|
54
|
+
item.data.title = 'the full title'
|
|
55
|
+
renderer.render_text(item, node).should == 'the full title'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
describe 'when the form attribute is set to :short' do
|
|
59
|
+
before(:each) {
|
|
60
|
+
item.data.title = 'the full title'
|
|
61
|
+
node[:form] = :short
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
it "prefers the short version if available" do
|
|
65
|
+
item.data.title_short = 'the short title'
|
|
66
|
+
renderer.render_text(item, node).should == 'the short title'
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "falls back to the variable if unavailable" do
|
|
70
|
+
renderer.render_text(item, node).should == 'the full title'
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
describe 'given a text node with a variable' do
|
|
76
|
+
let(:node) { CSL::Style::Text.new(:term => 'anonymous') }
|
|
77
|
+
|
|
78
|
+
it "returns the term's long form by default" do
|
|
79
|
+
renderer.render_text(item, node).should == 'anonymous'
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
describe 'when the form attribute is set to :short' do
|
|
83
|
+
before(:each) { node[:form] = 'short' }
|
|
84
|
+
|
|
85
|
+
it "returns the term's short form by default" do
|
|
86
|
+
renderer.render_text(item, node).should == 'anon.'
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it 'falls back to the long version if there is no short version' do
|
|
90
|
+
node[:term] = 'et-al'
|
|
91
|
+
renderer.render_text(item, node).should == 'et al.'
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
describe 'given a text node with a macro reference' do
|
|
97
|
+
let(:node) { CSL::Style::Text.new(:macro => 'foo') }
|
|
98
|
+
|
|
99
|
+
let(:macro) do
|
|
100
|
+
CSL::Style::Macro.new(:name => 'foo') do |m|
|
|
101
|
+
m << CSL::Style::Text.new(:value => 'foobar')
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it 'renders the macro' do
|
|
106
|
+
node.stub(:macro).and_return(macro)
|
|
107
|
+
renderer.render(item, node).should == 'foobar'
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
it 'applies formats to the result' do
|
|
111
|
+
node.stub(:macro).and_return(macro)
|
|
112
|
+
node[:prefix] = '('
|
|
113
|
+
node[:suffix] = ')'
|
|
114
|
+
renderer.render(item, node).should == '(foobar)'
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
end
|
|
120
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
module CiteProc
|
|
6
|
+
module Ruby
|
|
7
|
+
|
|
8
|
+
describe Renderer do
|
|
9
|
+
let(:renderer) { Renderer.new }
|
|
10
|
+
|
|
11
|
+
describe '#format_page_range' do
|
|
12
|
+
it 'supports "minimal" format' do
|
|
13
|
+
renderer.format_page_range('42-45', 'minimal').should == '42–5'
|
|
14
|
+
renderer.format_page_range('321-328', 'minimal').should == '321–8'
|
|
15
|
+
renderer.format_page_range('2787-2816', 'minimal').should == '2787–816'
|
|
16
|
+
renderer.format_page_range('8-45', 'minimal').should == '8–45'
|
|
17
|
+
|
|
18
|
+
renderer.format_page_range('42-5', 'minimal').should == '42–5'
|
|
19
|
+
renderer.format_page_range('321-28', 'minimal').should == '321–8'
|
|
20
|
+
renderer.format_page_range('321-8', 'minimal').should == '321–8'
|
|
21
|
+
renderer.format_page_range('2787-816', 'minimal').should == '2787–816'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'supports "minimal-two" format' do
|
|
25
|
+
renderer.format_page_range('42-45', 'minimal-two').should == '42–45'
|
|
26
|
+
renderer.format_page_range('321-328', 'minimal-two').should == '321–28'
|
|
27
|
+
renderer.format_page_range('2787-2816', 'minimal-two').should == '2787–816'
|
|
28
|
+
renderer.format_page_range('2-5', 'minimal-two').should == '2–5'
|
|
29
|
+
renderer.format_page_range('2-402', 'minimal-two').should == '2–402'
|
|
30
|
+
|
|
31
|
+
renderer.format_page_range('42-5', 'minimal-two').should == '42–45'
|
|
32
|
+
renderer.format_page_range('321-28', 'minimal-two').should == '321–28'
|
|
33
|
+
renderer.format_page_range('321-8', 'minimal-two').should == '321–28'
|
|
34
|
+
renderer.format_page_range('2787-816', 'minimal-two').should == '2787–816'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'supports "expanded" format' do
|
|
38
|
+
renderer.format_page_range('42-45', 'expanded').should == '42–45'
|
|
39
|
+
renderer.format_page_range('321-328', 'expanded').should == '321–328'
|
|
40
|
+
renderer.format_page_range('2787-2816', 'expanded').should == '2787–2816'
|
|
41
|
+
renderer.format_page_range('2-5', 'expanded').should == '2–5'
|
|
42
|
+
renderer.format_page_range('2-402', 'expanded').should == '2–402'
|
|
43
|
+
|
|
44
|
+
renderer.format_page_range('42-5', 'expanded').should == '42–45'
|
|
45
|
+
renderer.format_page_range('321 - 28', 'expanded').should == '321–328'
|
|
46
|
+
renderer.format_page_range('321 -8', 'expanded').should == '321–328'
|
|
47
|
+
renderer.format_page_range('2787- 816', 'expanded').should == '2787–2816'
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'supports "chicago" format' do
|
|
51
|
+
renderer.format_page_range('3-10; 71-72', 'chicago').should == '3–10; 71–72'
|
|
52
|
+
renderer.format_page_range('100-104; 600-613; 1100-23', 'chicago').should == '100–104; 600–613; 1100–1123'
|
|
53
|
+
renderer.format_page_range('107-08; 505-517; 1002-006', 'chicago').should == '107–8; 505–17; 1002–6'
|
|
54
|
+
renderer.format_page_range('321-325; 415-532; 11564-11568; 13792-803', 'chicago').should == '321–25; 415–532; 11564–68; 13792–803'
|
|
55
|
+
renderer.format_page_range('1496-504; 2787-2816', 'chicago').should == '1496–1504; 2787–2816'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'formats multiple page ranges' do
|
|
59
|
+
renderer.format_page_range('42-45 and 57; 81-3 & 123-4', 'minimal-two').should == '42–45 and 57; 81–83 & 123–24'
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
module Fixtures
|
|
4
|
+
|
|
5
|
+
module_function
|
|
6
|
+
|
|
7
|
+
def people(name)
|
|
8
|
+
DB.people[name.to_sym].dup
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def items(name)
|
|
12
|
+
item = CiteProc::CitationItem.new(:id => name)
|
|
13
|
+
item.data = DB.items[name.to_sym].dup
|
|
14
|
+
item
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class DB
|
|
18
|
+
class << self
|
|
19
|
+
attr_reader :people, :items
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
@people = {
|
|
23
|
+
:poe => CiteProc::Names.new(:family => 'Poe', :given => 'Edgar Allen'),
|
|
24
|
+
|
|
25
|
+
:plato => CiteProc::Names.new(:given => 'Plato'),
|
|
26
|
+
|
|
27
|
+
:japanese => CiteProc::Names.new(:family => '穂積', :given => '陳重'),
|
|
28
|
+
|
|
29
|
+
:humboldt => CiteProc::Names.new(:given => 'Alexander',
|
|
30
|
+
:dropping_particle => 'von', :family => 'Humboldt'),
|
|
31
|
+
|
|
32
|
+
:la_fontaine => CiteProc::Names.new(:family => 'Fontaine', :given => 'Jean',
|
|
33
|
+
:particle => 'La', :dropping_particle => 'de'),
|
|
34
|
+
|
|
35
|
+
:van_gogh => CiteProc::Names.new(:family => 'Gogh',
|
|
36
|
+
:given => 'Vincent', :particle => 'van'),
|
|
37
|
+
|
|
38
|
+
:derrida => CiteProc::Names.new(:given => 'Jacques', :family => 'Derrida')
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@items = {
|
|
42
|
+
:knuth1968 => CiteProc::Item.new(
|
|
43
|
+
:id => 'knuth1968',
|
|
44
|
+
:type => 'book',
|
|
45
|
+
:title => 'The art of computer programming',
|
|
46
|
+
:author => 'Donald Knuth',
|
|
47
|
+
:publisher => 'Addison-Wesley',
|
|
48
|
+
:volume => 1,
|
|
49
|
+
:issued => 1968,
|
|
50
|
+
:'publisher-place' => 'Boston'
|
|
51
|
+
),
|
|
52
|
+
|
|
53
|
+
:grammatology => CiteProc::Item.new(
|
|
54
|
+
:id => 'grammatology',
|
|
55
|
+
:type => 'book',
|
|
56
|
+
:title => 'Of Grammatology',
|
|
57
|
+
:author => @people[:derrida],
|
|
58
|
+
:edition => 'corrected ed',
|
|
59
|
+
:issued => 1976,
|
|
60
|
+
:publisher => 'Johns Hopkins University Press',
|
|
61
|
+
:'publisher-place' => 'Baltimore'
|
|
62
|
+
),
|
|
63
|
+
|
|
64
|
+
:difference => CiteProc::Item.new(
|
|
65
|
+
:id => 'difference',
|
|
66
|
+
:type => 'book',
|
|
67
|
+
:title => 'L’écriture et la différence',
|
|
68
|
+
:author => @people[:derrida],
|
|
69
|
+
:issued => 1967,
|
|
70
|
+
:edition => 1,
|
|
71
|
+
:pages => 446,
|
|
72
|
+
:language => 'fr',
|
|
73
|
+
:publisher => 'Éditions du Seuil',
|
|
74
|
+
:'publisher-place' => 'Paris'
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
end
|
|
@@ -61,19 +61,10 @@
|
|
|
61
61
|
<term name="close-inner-quote">’</term>
|
|
62
62
|
|
|
63
63
|
<!-- ORDINALS -->
|
|
64
|
-
<term name="ordinal-00">th</term>
|
|
65
64
|
<term name="ordinal-01">st</term>
|
|
66
65
|
<term name="ordinal-02">nd</term>
|
|
67
66
|
<term name="ordinal-03">rd</term>
|
|
68
67
|
<term name="ordinal-04">th</term>
|
|
69
|
-
<term name="ordinal-05">th</term>
|
|
70
|
-
<term name="ordinal-06">th</term>
|
|
71
|
-
<term name="ordinal-07">th</term>
|
|
72
|
-
<term name="ordinal-08">th</term>
|
|
73
|
-
<term name="ordinal-09">th</term>
|
|
74
|
-
<term name="ordinal-11">th</term>
|
|
75
|
-
<term name="ordinal-12">th</term>
|
|
76
|
-
<term name="ordinal-13">th</term>
|
|
77
68
|
|
|
78
69
|
<!-- LONG ORDINALS -->
|
|
79
70
|
<term name="long-ordinal-01">first</term>
|
|
@@ -219,8 +210,8 @@
|
|
|
219
210
|
|
|
220
211
|
<!-- LONG ROLE FORMS -->
|
|
221
212
|
<term name="author">
|
|
222
|
-
<single
|
|
223
|
-
<multiple
|
|
213
|
+
<single>author</single>
|
|
214
|
+
<multiple>authors</multiple>
|
|
224
215
|
</term>
|
|
225
216
|
<term name="editor">
|
|
226
217
|
<single>editor</single>
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0" xml:lang="fr-FR">
|
|
3
|
-
<
|
|
3
|
+
<info>
|
|
4
|
+
<translator>
|
|
5
|
+
<name>Grégoire Colly</name>
|
|
6
|
+
</translator>
|
|
7
|
+
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
|
|
8
|
+
<updated>2012-07-04T23:31:02+00:00</updated>
|
|
9
|
+
</info>
|
|
10
|
+
<style-options punctuation-in-quote="false" limit-day-ordinals-to-day-1="true"/>
|
|
4
11
|
<date form="text">
|
|
5
12
|
<date-part name="day" suffix=" "/>
|
|
6
13
|
<date-part name="month" suffix=" "/>
|
|
@@ -12,24 +19,25 @@
|
|
|
12
19
|
<date-part name="year"/>
|
|
13
20
|
</date>
|
|
14
21
|
<terms>
|
|
15
|
-
<term name="accessed">
|
|
22
|
+
<term name="accessed">consulté le</term>
|
|
16
23
|
<term name="and">et</term>
|
|
17
24
|
<term name="and others">et autres</term>
|
|
18
25
|
<term name="anonymous">anonyme</term>
|
|
19
26
|
<term name="anonymous" form="short">anon.</term>
|
|
20
|
-
<term name="at"
|
|
27
|
+
<term name="at">sur</term>
|
|
28
|
+
<term name="available at">disponible sur</term>
|
|
21
29
|
<term name="by">par</term>
|
|
22
30
|
<term name="circa">vers</term>
|
|
23
31
|
<term name="circa" form="short">v.</term>
|
|
24
32
|
<term name="cited">cité</term>
|
|
25
|
-
<term name="edition">
|
|
33
|
+
<term name="edition" gender="feminine">
|
|
26
34
|
<single>édition</single>
|
|
27
35
|
<multiple>éditions</multiple>
|
|
28
36
|
</term>
|
|
29
37
|
<term name="edition" form="short">éd.</term>
|
|
30
38
|
<term name="et-al">et al.</term>
|
|
31
39
|
<term name="forthcoming">à paraître</term>
|
|
32
|
-
<term name="from"
|
|
40
|
+
<term name="from">à l'adresse</term>
|
|
33
41
|
<term name="ibid">ibid.</term>
|
|
34
42
|
<term name="in">in</term>
|
|
35
43
|
<term name="in press">sous presse</term>
|
|
@@ -37,7 +45,7 @@
|
|
|
37
45
|
<term name="interview">entretien</term>
|
|
38
46
|
<term name="letter">lettre</term>
|
|
39
47
|
<term name="no date">sans date</term>
|
|
40
|
-
<term name="no date" form="short">s
|
|
48
|
+
<term name="no date" form="short">s. d.</term>
|
|
41
49
|
<term name="online">en ligne</term>
|
|
42
50
|
<term name="presented at">présenté à</term>
|
|
43
51
|
<term name="reference">
|
|
@@ -49,23 +57,25 @@
|
|
|
49
57
|
<multiple>réf.</multiple>
|
|
50
58
|
</term>
|
|
51
59
|
<term name="retrieved">consulté</term>
|
|
60
|
+
<term name="scale">échelle</term>
|
|
61
|
+
<term name="version">version</term>
|
|
52
62
|
|
|
53
63
|
<!-- ANNO DOMINI; BEFORE CHRIST -->
|
|
54
64
|
<term name="ad">apr. J.-C.</term>
|
|
55
65
|
<term name="bc">av. J.-C.</term>
|
|
56
66
|
|
|
57
|
-
<!--
|
|
58
|
-
<term name="open-quote"
|
|
59
|
-
<term name="close-quote"
|
|
67
|
+
<!-- PUNCTUATION -->
|
|
68
|
+
<term name="open-quote">« </term>
|
|
69
|
+
<term name="close-quote"> »</term>
|
|
60
70
|
<term name="open-inner-quote">“</term>
|
|
61
71
|
<term name="close-inner-quote">”</term>
|
|
72
|
+
<term name="page-range-delimiter">‑</term> <!-- non-breaking hyphen -->
|
|
62
73
|
|
|
63
74
|
<!-- ORDINALS -->
|
|
64
|
-
<term name="ordinal
|
|
65
|
-
<term name="ordinal-
|
|
66
|
-
<term name="ordinal-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
<term name="ordinal">ᵉ</term>
|
|
76
|
+
<term name="ordinal-01" gender-form="feminine" match="whole-number">ʳᵉ</term>
|
|
77
|
+
<term name="ordinal-01" gender-form="masculine" match="whole-number">ᵉʳ</term>
|
|
78
|
+
|
|
69
79
|
<!-- LONG ORDINALS -->
|
|
70
80
|
<term name="long-ordinal-01">premier</term>
|
|
71
81
|
<term name="long-ordinal-02">deuxième</term>
|
|
@@ -78,32 +88,6 @@
|
|
|
78
88
|
<term name="long-ordinal-09">neuvième</term>
|
|
79
89
|
<term name="long-ordinal-10">dixième</term>
|
|
80
90
|
|
|
81
|
-
<!-- CATEGORIES -->
|
|
82
|
-
<term name="anthropology">anthropologie</term>
|
|
83
|
-
<term name="astronomy">astronomie</term>
|
|
84
|
-
<term name="biology">biologie</term>
|
|
85
|
-
<term name="botany">botanique</term>
|
|
86
|
-
<term name="chemistry">chimie</term>
|
|
87
|
-
<term name="engineering">ingénierie</term>
|
|
88
|
-
<term name="generic-base">base générique</term>
|
|
89
|
-
<term name="geography">géographie</term>
|
|
90
|
-
<term name="geology">géologie</term>
|
|
91
|
-
<term name="history">histoire</term>
|
|
92
|
-
<term name="humanities">lettres et sciences humaines</term>
|
|
93
|
-
<term name="linguistics">linguistique</term>
|
|
94
|
-
<term name="literature">littérature</term>
|
|
95
|
-
<term name="math">mathématiques</term>
|
|
96
|
-
<term name="medicine">médecine</term>
|
|
97
|
-
<term name="philosophy">philosophie</term>
|
|
98
|
-
<term name="physics">physique</term>
|
|
99
|
-
<term name="psychology">psychologie</term>
|
|
100
|
-
<term name="sociology">sociologie</term>
|
|
101
|
-
<term name="science">sciences de la nature</term>
|
|
102
|
-
<term name="political_science">science politique</term>
|
|
103
|
-
<term name="social_science">sciences sociales</term>
|
|
104
|
-
<term name="theology">théologie</term>
|
|
105
|
-
<term name="zoology">zoologie</term>
|
|
106
|
-
|
|
107
91
|
<!-- LONG LOCATOR FORMS -->
|
|
108
92
|
<term name="book">
|
|
109
93
|
<single>livre</single>
|
|
@@ -125,7 +109,7 @@
|
|
|
125
109
|
<single>folio</single>
|
|
126
110
|
<multiple>folios</multiple>
|
|
127
111
|
</term>
|
|
128
|
-
<term name="issue">
|
|
112
|
+
<term name="issue" gender="masculine">
|
|
129
113
|
<single>numéro</single>
|
|
130
114
|
<multiple>numéros</multiple>
|
|
131
115
|
</term>
|
|
@@ -145,6 +129,10 @@
|
|
|
145
129
|
<single>page</single>
|
|
146
130
|
<multiple>pages</multiple>
|
|
147
131
|
</term>
|
|
132
|
+
<term name="number-of-pages">
|
|
133
|
+
<single>page</single>
|
|
134
|
+
<multiple>pages</multiple>
|
|
135
|
+
</term>
|
|
148
136
|
<term name="paragraph">
|
|
149
137
|
<single>paragraphe</single>
|
|
150
138
|
<multiple>paragraphes</multiple>
|
|
@@ -165,7 +153,7 @@
|
|
|
165
153
|
<single>verset</single>
|
|
166
154
|
<multiple>versets</multiple>
|
|
167
155
|
</term>
|
|
168
|
-
<term name="volume">
|
|
156
|
+
<term name="volume" gender="masculine">
|
|
169
157
|
<single>volume</single>
|
|
170
158
|
<multiple>volumes</multiple>
|
|
171
159
|
</term>
|
|
@@ -175,8 +163,14 @@
|
|
|
175
163
|
<term name="chapter" form="short">chap.</term>
|
|
176
164
|
<term name="column" form="short">col.</term>
|
|
177
165
|
<term name="figure" form="short">fig.</term>
|
|
178
|
-
<term name="folio" form="short">
|
|
179
|
-
|
|
166
|
+
<term name="folio" form="short">
|
|
167
|
+
<single>fᵒ</single>
|
|
168
|
+
<multiple>fᵒˢ</multiple>
|
|
169
|
+
</term>
|
|
170
|
+
<term name="issue" form="short">
|
|
171
|
+
<single>nᵒ</single>
|
|
172
|
+
<multiple>nᵒˢ</multiple>
|
|
173
|
+
</term>
|
|
180
174
|
<term name="line" form="short">l.</term>
|
|
181
175
|
<term name="note" form="short">n.</term>
|
|
182
176
|
<term name="opus" form="short">op.</term>
|
|
@@ -184,12 +178,16 @@
|
|
|
184
178
|
<single>p.</single>
|
|
185
179
|
<multiple>p.</multiple>
|
|
186
180
|
</term>
|
|
181
|
+
<term name="number-of-pages" form="short">
|
|
182
|
+
<single>p.</single>
|
|
183
|
+
<multiple>p.</multiple>
|
|
184
|
+
</term>
|
|
187
185
|
<term name="paragraph" form="short">paragr.</term>
|
|
188
186
|
<term name="part" form="short">part.</term>
|
|
189
187
|
<term name="section" form="short">sect.</term>
|
|
190
188
|
<term name="sub verbo" form="short">
|
|
191
|
-
<single>s
|
|
192
|
-
<multiple>s
|
|
189
|
+
<single>s. v.</single>
|
|
190
|
+
<multiple>s. vv.</multiple>
|
|
193
191
|
</term>
|
|
194
192
|
<term name="verse" form="short">
|
|
195
193
|
<single>v.</single>
|
|
@@ -211,9 +209,9 @@
|
|
|
211
209
|
</term>
|
|
212
210
|
|
|
213
211
|
<!-- LONG ROLE FORMS -->
|
|
214
|
-
<term name="
|
|
215
|
-
<single
|
|
216
|
-
<multiple
|
|
212
|
+
<term name="director">
|
|
213
|
+
<single>réalisateur</single>
|
|
214
|
+
<multiple>réalisateurs</multiple>
|
|
217
215
|
</term>
|
|
218
216
|
<term name="editor">
|
|
219
217
|
<single>éditeur</single>
|
|
@@ -223,6 +221,10 @@
|
|
|
223
221
|
<single>directeur</single>
|
|
224
222
|
<multiple>directeurs</multiple>
|
|
225
223
|
</term>
|
|
224
|
+
<term name="illustrator">
|
|
225
|
+
<single>illustrateur</single>
|
|
226
|
+
<multiple>illustrateurs</multiple>
|
|
227
|
+
</term>
|
|
226
228
|
<term name="translator">
|
|
227
229
|
<single>traducteur</single>
|
|
228
230
|
<multiple>traducteurs</multiple>
|
|
@@ -233,9 +235,9 @@
|
|
|
233
235
|
</term>
|
|
234
236
|
|
|
235
237
|
<!-- SHORT ROLE FORMS -->
|
|
236
|
-
<term name="
|
|
237
|
-
<single
|
|
238
|
-
<multiple
|
|
238
|
+
<term name="director" form="short">
|
|
239
|
+
<single>réal.</single>
|
|
240
|
+
<multiple>réal.</multiple>
|
|
239
241
|
</term>
|
|
240
242
|
<term name="editor" form="short">
|
|
241
243
|
<single>éd.</single>
|
|
@@ -245,6 +247,10 @@
|
|
|
245
247
|
<single>dir.</single>
|
|
246
248
|
<multiple>dir.</multiple>
|
|
247
249
|
</term>
|
|
250
|
+
<term name="illustrator" form="short">
|
|
251
|
+
<single>ill.</single>
|
|
252
|
+
<multiple>ill.</multiple>
|
|
253
|
+
</term>
|
|
248
254
|
<term name="translator" form="short">
|
|
249
255
|
<single>trad.</single>
|
|
250
256
|
<multiple>trad.</multiple>
|
|
@@ -255,33 +261,38 @@
|
|
|
255
261
|
</term>
|
|
256
262
|
|
|
257
263
|
<!-- VERB ROLE FORMS -->
|
|
264
|
+
<term name="director" form="verb">réalisé par</term>
|
|
258
265
|
<term name="editor" form="verb">édité par</term>
|
|
259
266
|
<term name="editorial-director" form="verb">sous la direction de</term>
|
|
267
|
+
<term name="illustrator" form="verb">illustré par</term>
|
|
268
|
+
<term name="interviewer" form="verb">entretien réalisé par</term>
|
|
269
|
+
<term name="recipient" form="verb">à</term>
|
|
270
|
+
<term name="reviewed-author" form="verb">par</term>
|
|
260
271
|
<term name="translator" form="verb">traduit par</term>
|
|
261
272
|
<term name="editortranslator" form="verb">édité et traduit par</term>
|
|
262
|
-
<term name="recipient" form="verb">à</term>
|
|
263
|
-
<term name="interviewer" form="verb">entretien réalisé par</term>
|
|
264
273
|
|
|
265
274
|
<!-- SHORT VERB ROLE FORMS -->
|
|
266
275
|
<term name="container-author" form="verb-short">par</term>
|
|
276
|
+
<term name="director" form="verb-short">réal. par</term>
|
|
267
277
|
<term name="editor" form="verb-short">éd. par</term>
|
|
268
278
|
<term name="editorial-director" form="verb-short">ss la dir. de</term>
|
|
279
|
+
<term name="illustrator" form="verb-short">ill. par</term>
|
|
269
280
|
<term name="translator" form="verb-short">trad. par</term>
|
|
270
281
|
<term name="editortranslator" form="verb-short">éd. et trad. par</term>
|
|
271
282
|
|
|
272
283
|
<!-- LONG MONTH FORMS -->
|
|
273
|
-
<term name="month-01">janvier</term>
|
|
274
|
-
<term name="month-02">février</term>
|
|
275
|
-
<term name="month-03">mars</term>
|
|
276
|
-
<term name="month-04">avril</term>
|
|
277
|
-
<term name="month-05">mai</term>
|
|
278
|
-
<term name="month-06">juin</term>
|
|
279
|
-
<term name="month-07">juillet</term>
|
|
280
|
-
<term name="month-08">août</term>
|
|
281
|
-
<term name="month-09">septembre</term>
|
|
282
|
-
<term name="month-10">octobre</term>
|
|
283
|
-
<term name="month-11">novembre</term>
|
|
284
|
-
<term name="month-12">décembre</term>
|
|
284
|
+
<term name="month-01" gender="masculine">janvier</term>
|
|
285
|
+
<term name="month-02" gender="masculine">février</term>
|
|
286
|
+
<term name="month-03" gender="masculine">mars</term>
|
|
287
|
+
<term name="month-04" gender="masculine">avril</term>
|
|
288
|
+
<term name="month-05" gender="masculine">mai</term>
|
|
289
|
+
<term name="month-06" gender="masculine">juin</term>
|
|
290
|
+
<term name="month-07" gender="masculine">juillet</term>
|
|
291
|
+
<term name="month-08" gender="masculine">août</term>
|
|
292
|
+
<term name="month-09" gender="masculine">septembre</term>
|
|
293
|
+
<term name="month-10" gender="masculine">octobre</term>
|
|
294
|
+
<term name="month-11" gender="masculine">novembre</term>
|
|
295
|
+
<term name="month-12" gender="masculine">décembre</term>
|
|
285
296
|
|
|
286
297
|
<!-- SHORT MONTH FORMS -->
|
|
287
298
|
<term name="month-01" form="short">janv.</term>
|