citeproc-js 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -2
- data/README.md +10 -0
- data/lib/citeproc/js.rb +14 -1
- data/lib/citeproc/js/assets.rb +3 -3
- data/lib/citeproc/js/compatibility.rb +14 -0
- data/lib/citeproc/js/engine.rb +0 -4
- data/lib/citeproc/js/version.rb +1 -1
- data/spec/citeproc/js/assets_spec.rb +7 -0
- data/spec/citeproc/js/engine_spec.rb +10 -6
- metadata +146 -108
data/Gemfile
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
source :rubygems
|
2
2
|
gemspec
|
3
3
|
|
4
|
-
group :
|
4
|
+
group :debug do
|
5
5
|
gem 'ruby-debug', :platforms => [:ruby_18, :jruby]
|
6
6
|
gem 'ruby-debug19', :require => 'ruby-debug', :platforms => [:ruby_19]
|
7
|
-
gem 'therubyrhino', :require => 'rhino', :platforms => [:jruby]
|
8
7
|
end
|
8
|
+
|
9
|
+
gem 'therubyrhino', '~>1.72', :require => 'rhino', :platforms => [:jruby]
|
10
|
+
gem 'johnson', '~>1.2', :platforms => [:ruby_18]
|
data/README.md
CHANGED
@@ -7,6 +7,16 @@ thin Ruby wrapper around Frank G. Benett's awesome
|
|
7
7
|
[citeproc-js](https://bitbucket.org/fbennett/citeproc-js/overview).
|
8
8
|
|
9
9
|
|
10
|
+
Requirements
|
11
|
+
------------
|
12
|
+
|
13
|
+
In addition to the dependencies defined by the gem, please make sure to
|
14
|
+
your environment meets the following requirements depending on your platform;
|
15
|
+
|
16
|
+
* For Ruby 1.8.7, please install [johnson](https://github.com/jbarnette/johnson).
|
17
|
+
* For JRuby, please install [therubyrhino](https://github.com/cowboyd/therubyrhino).
|
18
|
+
|
19
|
+
Support for other platforms is still in development.
|
10
20
|
|
11
21
|
|
12
22
|
License
|
data/lib/citeproc/js.rb
CHANGED
@@ -1,11 +1,24 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
require 'citeproc/js/compatibility'
|
3
|
+
|
4
|
+
ruby_18 do
|
5
|
+
ENV['EXECJS_RUNTIME'] = 'Johnson'
|
6
|
+
end
|
7
|
+
|
8
|
+
jruby do
|
9
|
+
ENV['EXECJS_RUNTIME'] = 'RubyRhino'
|
10
|
+
end
|
3
11
|
|
4
12
|
if ENV['DEBUG']
|
5
13
|
require 'ruby-debug'
|
6
14
|
Debugger.start
|
7
15
|
end
|
8
16
|
|
17
|
+
require 'multi_json'
|
18
|
+
require 'execjs'
|
19
|
+
|
20
|
+
require 'forwardable'
|
21
|
+
|
9
22
|
require 'citeproc'
|
10
23
|
|
11
24
|
require 'citeproc/js/version'
|
data/lib/citeproc/js/assets.rb
CHANGED
@@ -43,7 +43,7 @@ module CiteProc
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def extend_name(file)
|
46
|
-
file = File.extname(file).empty? ? [file, extension].compact.join
|
46
|
+
file = File.extname(file).empty? ? [file, extension].compact.join : file
|
47
47
|
file = file.start_with?(prefix.to_s) ? file : [prefix,file].join
|
48
48
|
file
|
49
49
|
end
|
@@ -54,13 +54,13 @@ module CiteProc
|
|
54
54
|
class Style
|
55
55
|
include Asset
|
56
56
|
@root = '/usr/local/share/citation-style-language/styles'.freeze
|
57
|
-
@extension = 'csl'.freeze
|
57
|
+
@extension = '.csl'.freeze
|
58
58
|
end
|
59
59
|
|
60
60
|
class Locale
|
61
61
|
include Asset
|
62
62
|
@root = '/usr/local/share/citation-style-language/locales'.freeze
|
63
|
-
@extension = 'xml'.freeze
|
63
|
+
@extension = '.xml'.freeze
|
64
64
|
@prefix = 'locales-'
|
65
65
|
end
|
66
66
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
if RUBY_VERSION < '1.9'
|
2
|
+
$KCODE = 'U'
|
3
|
+
def ruby_18; yield; end
|
4
|
+
def ruby_19; false; end
|
5
|
+
else
|
6
|
+
def ruby_18; false; end
|
7
|
+
def ruby_19; yield; end
|
8
|
+
end
|
9
|
+
|
10
|
+
if RUBY_PLATFORM =~ /java/i
|
11
|
+
def jruby; yield; end
|
12
|
+
else
|
13
|
+
def jruby; false; end
|
14
|
+
end
|
data/lib/citeproc/js/engine.rb
CHANGED
data/lib/citeproc/js/version.rb
CHANGED
@@ -20,9 +20,16 @@ module CiteProc
|
|
20
20
|
describe 'Style' do
|
21
21
|
|
22
22
|
before(:all) do
|
23
|
+
@default_root = Style.root
|
24
|
+
@default_extension = Style.extension
|
23
25
|
Style.root = root
|
24
26
|
Style.extension = extension
|
25
27
|
end
|
28
|
+
|
29
|
+
after(:all) do
|
30
|
+
Style.root = @default_root
|
31
|
+
Style.extension = @default_extension
|
32
|
+
end
|
26
33
|
|
27
34
|
describe '.load' do
|
28
35
|
|
@@ -54,13 +54,17 @@ module CiteProc
|
|
54
54
|
end
|
55
55
|
|
56
56
|
context 'when started' do
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
let(:subject) do
|
58
|
+
Engine.new do |e|
|
59
|
+
p = double(:processor)
|
60
|
+
p.stub(:options).and_return { Processor.defaults }
|
61
|
+
p.stub(:items).and_return { load_items('items') }
|
62
|
+
e.processor = p
|
63
|
+
e.style = :apa
|
64
|
+
e.locales = :'en-US'
|
65
|
+
e.start
|
66
|
+
end
|
61
67
|
end
|
62
|
-
|
63
|
-
after(:each) { subject.stop }
|
64
68
|
|
65
69
|
describe '#processor_version' do
|
66
70
|
it 'returns the citeproc-js version' do
|
metadata
CHANGED
@@ -1,145 +1,183 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: citeproc-js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
|
-
|
13
|
+
- Sylvester Keil
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2011-08-
|
14
|
-
default_executable:
|
18
|
+
date: 2011-08-09 00:00:00 Z
|
15
19
|
dependencies:
|
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
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: citeproc
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 11
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
version: "0.0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: execjs
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 23
|
44
|
+
segments:
|
45
|
+
- 1
|
46
|
+
- 2
|
47
|
+
- 4
|
48
|
+
version: 1.2.4
|
49
|
+
- - <
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
hash: 27
|
52
|
+
segments:
|
53
|
+
- 1
|
54
|
+
- 3
|
55
|
+
- 0
|
56
|
+
version: 1.3.0
|
57
|
+
type: :runtime
|
58
|
+
version_requirements: *id002
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: cucumber
|
61
|
+
prerelease: false
|
62
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
hash: 19
|
68
|
+
segments:
|
69
|
+
- 1
|
70
|
+
- 0
|
71
|
+
- 2
|
72
|
+
version: 1.0.2
|
73
|
+
type: :development
|
74
|
+
version_requirements: *id003
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rspec
|
77
|
+
prerelease: false
|
78
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 23
|
84
|
+
segments:
|
85
|
+
- 2
|
86
|
+
- 6
|
87
|
+
- 0
|
88
|
+
version: 2.6.0
|
89
|
+
type: :development
|
90
|
+
version_requirements: *id004
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: watchr
|
93
|
+
prerelease: false
|
94
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 5
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
- 7
|
103
|
+
version: "0.7"
|
104
|
+
type: :development
|
105
|
+
version_requirements: *id005
|
74
106
|
description: A citeproc engine based on the citeproc-js CSL (Citation Style Language) processor.
|
75
107
|
email:
|
76
|
-
|
108
|
+
- http://sylvester.keil.or.at
|
77
109
|
executables: []
|
78
110
|
|
79
111
|
extensions: []
|
80
112
|
|
81
113
|
extra_rdoc_files:
|
82
|
-
|
114
|
+
- README.md
|
83
115
|
files:
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
116
|
+
- .gitignore
|
117
|
+
- .rspec
|
118
|
+
- Gemfile
|
119
|
+
- LICENSE
|
120
|
+
- README.md
|
121
|
+
- auto.watchr
|
122
|
+
- citeproc-js.gemspec
|
123
|
+
- lib/citeproc/js.rb
|
124
|
+
- lib/citeproc/js/assets.rb
|
125
|
+
- lib/citeproc/js/compatibility.rb
|
126
|
+
- lib/citeproc/js/engine.rb
|
127
|
+
- lib/citeproc/js/support/citeproc.js
|
128
|
+
- lib/citeproc/js/support/system.js
|
129
|
+
- lib/citeproc/js/support/xmldom.js
|
130
|
+
- lib/citeproc/js/support/xmle4x.js
|
131
|
+
- lib/citeproc/js/version.rb
|
132
|
+
- spec/citeproc/js/assets_spec.rb
|
133
|
+
- spec/citeproc/js/engine_spec.rb
|
134
|
+
- spec/fixtures/items/items.json
|
135
|
+
- spec/fixtures/locales/locales-en-US.xml
|
136
|
+
- spec/fixtures/styles/apa.csl
|
137
|
+
- spec/spec_helper.rb
|
106
138
|
homepage: http://inukshuk.github.com/citeproc-js
|
107
139
|
licenses:
|
108
|
-
|
140
|
+
- AGPLv3
|
109
141
|
post_install_message:
|
110
142
|
rdoc_options:
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
143
|
+
- --line-numbers
|
144
|
+
- --inline-source
|
145
|
+
- --title
|
146
|
+
- "\"CiteProc-JS Rubygem\""
|
147
|
+
- --main
|
148
|
+
- README.md
|
149
|
+
- --webcvs=http://github.com/inukshuk/citeproc-js/tree/master/
|
118
150
|
require_paths:
|
119
|
-
|
151
|
+
- lib
|
120
152
|
required_ruby_version: !ruby/object:Gem::Requirement
|
121
153
|
none: false
|
122
154
|
requirements:
|
123
|
-
|
124
|
-
|
125
|
-
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
hash: 3
|
158
|
+
segments:
|
159
|
+
- 0
|
160
|
+
version: "0"
|
126
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
162
|
none: false
|
128
163
|
requirements:
|
129
|
-
|
130
|
-
|
131
|
-
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
hash: 3
|
167
|
+
segments:
|
168
|
+
- 0
|
169
|
+
version: "0"
|
132
170
|
requirements: []
|
133
171
|
|
134
172
|
rubyforge_project:
|
135
|
-
rubygems_version: 1.5
|
173
|
+
rubygems_version: 1.8.5
|
136
174
|
signing_key:
|
137
175
|
specification_version: 3
|
138
176
|
summary: A citeproc engine based on citeproc-js.
|
139
177
|
test_files:
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
178
|
+
- spec/citeproc/js/assets_spec.rb
|
179
|
+
- spec/citeproc/js/engine_spec.rb
|
180
|
+
- spec/fixtures/items/items.json
|
181
|
+
- spec/fixtures/locales/locales-en-US.xml
|
182
|
+
- spec/fixtures/styles/apa.csl
|
183
|
+
- spec/spec_helper.rb
|