citeproc 0.0.2 → 0.0.3
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/.rspec +1 -0
- data/README.md +2 -0
- data/auto.watchr +2 -0
- data/lib/citeproc.rb +16 -0
- data/lib/citeproc/assets.rb +66 -0
- data/lib/citeproc/attributes.rb +92 -16
- data/lib/citeproc/bibliography.rb +180 -0
- data/lib/citeproc/citation_data.rb +208 -0
- data/lib/citeproc/compatibility.rb +5 -1
- data/lib/citeproc/date.rb +225 -162
- data/lib/citeproc/engine.rb +6 -11
- data/lib/citeproc/errors.rb +5 -4
- data/lib/citeproc/extensions.rb +71 -3
- data/lib/citeproc/item.rb +113 -0
- data/lib/citeproc/names.rb +556 -0
- data/lib/citeproc/processor.rb +30 -4
- data/lib/citeproc/selector.rb +128 -0
- data/lib/citeproc/variable.rb +85 -45
- data/lib/citeproc/version.rb +1 -1
- data/spec/citeproc/assets_spec.rb +60 -0
- data/spec/citeproc/attributes_spec.rb +23 -10
- data/spec/citeproc/bibliography_spec.rb +72 -0
- data/spec/citeproc/citation_data_spec.rb +94 -0
- data/spec/citeproc/date_spec.rb +65 -9
- data/spec/citeproc/extensions_spec.rb +33 -0
- data/spec/citeproc/item_spec.rb +52 -0
- data/spec/citeproc/names_spec.rb +492 -0
- data/spec/citeproc/processor_spec.rb +39 -0
- data/spec/citeproc/selector_spec.rb +81 -0
- data/spec/citeproc/variable_spec.rb +9 -3
- metadata +133 -121
@@ -8,5 +8,44 @@ module CiteProc
|
|
8
8
|
|
9
9
|
it { should_not be nil }
|
10
10
|
|
11
|
+
|
12
|
+
describe '#bibliography (generates the bibliography)' do
|
13
|
+
|
14
|
+
describe 'when no items have been processed' do
|
15
|
+
|
16
|
+
it 'returns an empty bibliography'
|
17
|
+
|
18
|
+
# it 'returns a bibliography of all registered items if invoked with :all'
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'when items have been processed' do
|
23
|
+
|
24
|
+
it 'returns a bibliography containing all cited items'
|
25
|
+
|
26
|
+
# it 'returns a bibliography of all registered items if invoked with :all'
|
27
|
+
|
28
|
+
describe 'when invoked with a block as filter' do
|
29
|
+
|
30
|
+
it 'returns an empty bibliography if the block always returns false'
|
31
|
+
|
32
|
+
it 'returns the full bibliography if the block always returns true'
|
33
|
+
|
34
|
+
it 'returns a bibliography with all items for which the block returns true'
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'when passed a hash as argument' do
|
39
|
+
|
40
|
+
it 'fails if the hash is no valid selector'
|
41
|
+
|
42
|
+
it 'creates a selector from the hash and returns a bibliography containing all matching items'
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
11
50
|
end
|
12
51
|
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module CiteProc
|
4
|
+
|
5
|
+
describe Selector do
|
6
|
+
|
7
|
+
let(:select_books) { Selector.new(:all => { :type => :book }) }
|
8
|
+
|
9
|
+
it { should_not be nil }
|
10
|
+
it { should be_empty }
|
11
|
+
|
12
|
+
|
13
|
+
it 'should have no skip_condtions by default' do
|
14
|
+
Selector.new.skip_conditions.should be_empty
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should have no condtions by default' do
|
18
|
+
Selector.new.conditions.should be_empty
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'constructing' do
|
22
|
+
|
23
|
+
%w{ all none any skip }.each do |matcher|
|
24
|
+
it "accepts the ruby style matcher '#{matcher}'" do
|
25
|
+
Selector.new(matcher => {}).should_not be nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
%w{ include exclude select quash }.each do |matcher|
|
30
|
+
it "accepts the citeproc-js style matcher '#{matcher}'" do
|
31
|
+
Selector.new(matcher => {}).should_not be nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# it 'fails if the hash contains more than two elements'
|
36
|
+
# it 'fails if the hash contains unknown keys'
|
37
|
+
|
38
|
+
it 'accepts a citeproc json style hash'
|
39
|
+
# it 'accepts a json object (select)' do
|
40
|
+
# Selector.new(
|
41
|
+
# "select" => [
|
42
|
+
# {
|
43
|
+
# "field" => "type",
|
44
|
+
# "value" => "book"
|
45
|
+
# },
|
46
|
+
# { "field" => "categories",
|
47
|
+
# "value" => "1990s"
|
48
|
+
# }
|
49
|
+
# ]
|
50
|
+
# ).conditions.should have(2).items
|
51
|
+
# end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '#to_proc' do
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#to_citeproc' do
|
59
|
+
|
60
|
+
it 'returns nil by default' do
|
61
|
+
Selector.new.to_citeproc.should be nil
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'converts all matcher to select' do
|
65
|
+
Selector.new(:all => { :a => 'b' }).to_citeproc.should == { 'select' => [{ 'field' => 'a', 'value' => 'b' }]}
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'converts any matcher to include' do
|
69
|
+
Selector.new(:any => { :a => 'b' }).to_citeproc.should == { 'include' => [{ 'field' => 'a', 'value' => 'b' }]}
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'converts none matcher to exclude' do
|
73
|
+
Selector.new(:none => { :a => 'b' }).to_citeproc.should == { 'exclude' => [{ 'field' => 'a', 'value' => 'b' }]}
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
@@ -27,9 +27,9 @@ module CiteProc
|
|
27
27
|
Variable.new(23.1).should == '23.1'
|
28
28
|
end
|
29
29
|
|
30
|
-
it '
|
31
|
-
|
32
|
-
end
|
30
|
+
# it 'raises type error when initialized with a hash' do
|
31
|
+
# lambda { Variable.new(:value => 'test') }.should raise_error(TypeError)
|
32
|
+
# end
|
33
33
|
|
34
34
|
it 'supports self yielding block' do
|
35
35
|
Variable.new { |v| v.value = 'test' }.should == 'test'
|
@@ -50,6 +50,11 @@ module CiteProc
|
|
50
50
|
it 'contains :text fields' do
|
51
51
|
Variable.fields[:text].should_not be_empty
|
52
52
|
end
|
53
|
+
|
54
|
+
it 'contains :number fields' do
|
55
|
+
Variable.fields[:numbers].should_not be_empty
|
56
|
+
Variable.fields[:number].should_not be_empty
|
57
|
+
end
|
53
58
|
|
54
59
|
it 'accepts either string or symbol input' do
|
55
60
|
Variable.fields[:names].should equal Variable.fields['names']
|
@@ -61,6 +66,7 @@ module CiteProc
|
|
61
66
|
Variable.types[:author].should == :names
|
62
67
|
Variable.types[:issued].should == :date
|
63
68
|
Variable.types[:abstract].should == :text
|
69
|
+
Variable.types[:issue].should == :number
|
64
70
|
end
|
65
71
|
|
66
72
|
it 'accepts either string or symbol input' do
|
metadata
CHANGED
@@ -1,140 +1,152 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: citeproc
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
7
|
+
authors:
|
8
|
+
- Sylvester Keil
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
type: :development
|
59
|
-
version_requirements: *id004
|
12
|
+
date: 2011-11-05 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: multi_json
|
16
|
+
requirement: &2157057820 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2157057820
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: cucumber
|
27
|
+
requirement: &2157054940 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.2
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2157054940
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &2157052260 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.6.0
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2157052260
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: watchr
|
49
|
+
requirement: &2157045420 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.7'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2157045420
|
60
58
|
description: A a cite processor for Citation Style Language (CSL) styles.
|
61
59
|
email: http://sylvester.keil.or.at
|
62
60
|
executables: []
|
63
|
-
|
64
61
|
extensions: []
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
62
|
+
extra_rdoc_files:
|
63
|
+
- README.md
|
64
|
+
files:
|
65
|
+
- .gitignore
|
66
|
+
- .rspec
|
67
|
+
- Gemfile
|
68
|
+
- LICENSE
|
69
|
+
- README.md
|
70
|
+
- auto.watchr
|
71
|
+
- citeproc.gemspec
|
72
|
+
- lib/citeproc.rb
|
73
|
+
- lib/citeproc/abbreviate.rb
|
74
|
+
- lib/citeproc/assets.rb
|
75
|
+
- lib/citeproc/attributes.rb
|
76
|
+
- lib/citeproc/bibliography.rb
|
77
|
+
- lib/citeproc/citation_data.rb
|
78
|
+
- lib/citeproc/compatibility.rb
|
79
|
+
- lib/citeproc/date.rb
|
80
|
+
- lib/citeproc/engine.rb
|
81
|
+
- lib/citeproc/errors.rb
|
82
|
+
- lib/citeproc/extensions.rb
|
83
|
+
- lib/citeproc/item.rb
|
84
|
+
- lib/citeproc/names.rb
|
85
|
+
- lib/citeproc/processor.rb
|
86
|
+
- lib/citeproc/selector.rb
|
87
|
+
- lib/citeproc/utilities.rb
|
88
|
+
- lib/citeproc/variable.rb
|
89
|
+
- lib/citeproc/version.rb
|
90
|
+
- spec/citeproc/abbreviate_spec.rb
|
91
|
+
- spec/citeproc/assets_spec.rb
|
92
|
+
- spec/citeproc/attributes_spec.rb
|
93
|
+
- spec/citeproc/bibliography_spec.rb
|
94
|
+
- spec/citeproc/citation_data_spec.rb
|
95
|
+
- spec/citeproc/date_spec.rb
|
96
|
+
- spec/citeproc/engine_spec.rb
|
97
|
+
- spec/citeproc/extensions_spec.rb
|
98
|
+
- spec/citeproc/item_spec.rb
|
99
|
+
- spec/citeproc/names_spec.rb
|
100
|
+
- spec/citeproc/processor_spec.rb
|
101
|
+
- spec/citeproc/selector_spec.rb
|
102
|
+
- spec/citeproc/utilities_spec.rb
|
103
|
+
- spec/citeproc/variable_spec.rb
|
104
|
+
- spec/spec_helper.rb
|
98
105
|
homepage: http://inukshuk.github.com/citeproc
|
99
|
-
licenses:
|
100
|
-
|
106
|
+
licenses:
|
107
|
+
- FreeBSD
|
101
108
|
post_install_message:
|
102
|
-
rdoc_options:
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
require_paths:
|
111
|
-
|
112
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
rdoc_options:
|
110
|
+
- --line-numbers
|
111
|
+
- --inline-source
|
112
|
+
- --title
|
113
|
+
- ! '"CiteProc"'
|
114
|
+
- --main
|
115
|
+
- README.md
|
116
|
+
- --webcvs=http://github.com/inukshuk/citeproc/tree/master/
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
120
|
none: false
|
114
|
-
requirements:
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
126
|
none: false
|
120
|
-
requirements:
|
121
|
-
|
122
|
-
|
123
|
-
|
127
|
+
requirements:
|
128
|
+
- - ! '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
124
131
|
requirements: []
|
125
|
-
|
126
132
|
rubyforge_project:
|
127
|
-
rubygems_version: 1.
|
133
|
+
rubygems_version: 1.8.10
|
128
134
|
signing_key:
|
129
135
|
specification_version: 3
|
130
136
|
summary: A cite processor interface.
|
131
|
-
test_files:
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
137
|
+
test_files:
|
138
|
+
- spec/citeproc/abbreviate_spec.rb
|
139
|
+
- spec/citeproc/assets_spec.rb
|
140
|
+
- spec/citeproc/attributes_spec.rb
|
141
|
+
- spec/citeproc/bibliography_spec.rb
|
142
|
+
- spec/citeproc/citation_data_spec.rb
|
143
|
+
- spec/citeproc/date_spec.rb
|
144
|
+
- spec/citeproc/engine_spec.rb
|
145
|
+
- spec/citeproc/extensions_spec.rb
|
146
|
+
- spec/citeproc/item_spec.rb
|
147
|
+
- spec/citeproc/names_spec.rb
|
148
|
+
- spec/citeproc/processor_spec.rb
|
149
|
+
- spec/citeproc/selector_spec.rb
|
150
|
+
- spec/citeproc/utilities_spec.rb
|
151
|
+
- spec/citeproc/variable_spec.rb
|
152
|
+
- spec/spec_helper.rb
|