citeproc 0.0.9 → 1.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -5,9 +5,17 @@ rvm:
5
5
  - 1.9.3
6
6
  - jruby-18mode
7
7
  - jruby-19mode
8
- # - rbx-18mode
9
- # - rbx-19mode
8
+ - rbx-18mode
9
+ - rbx-19mode
10
10
  - 1.8.7
11
11
  - ree
12
12
  notifications:
13
- email: false
13
+ email:
14
+ - i@nukshuk.io
15
+ on_success: change
16
+ on_failure: always
17
+ matrix:
18
+ allow_failures:
19
+ rvm:
20
+ - rbx-18mode
21
+ - rbx-19mode
data/Gemfile CHANGED
@@ -12,6 +12,13 @@ group :optional do
12
12
  gem 'bibtex-ruby', '~>2.0.10', :require => 'bibtex'
13
13
 
14
14
  gem 'simplecov', '~>0.6.4'
15
+
16
+ gem 'guard', '~>1.2'
17
+ gem 'guard-rspec', '~>1.1'
18
+ gem 'guard-cucumber', '~>1.2'
19
+
20
+ gem 'yard', '~>0.8', :platforms => [:mri_19]
21
+ gem 'redcarpet', '~>2.1', :platforms => [:mri_19]
15
22
 
16
23
  gem 'unicode_utils', '~>1.3.0', :platform => :mri_19
17
24
  gem 'unicode', '~>0.4.2', :platform => :mri_18
data/Guardfile ADDED
@@ -0,0 +1,14 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec' do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { 'spec' }
8
+ end
9
+
10
+ guard 'cucumber' do
11
+ watch(%r{^features/.+\.feature$})
12
+ watch(%r{^features/support/.+$}) { 'features' }
13
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
14
+ end
data/citeproc.gemspec CHANGED
@@ -25,11 +25,9 @@ Gem::Specification.new do |s|
25
25
  s.add_runtime_dependency('multi_json', '~>1.3.5')
26
26
  s.add_runtime_dependency('namae', '~>0.1')
27
27
 
28
- s.add_development_dependency('cucumber', ['~>1.2.0'])
29
- s.add_development_dependency('rspec', ['~>2.10.0'])
30
- s.add_development_dependency('watchr', ['~>0.7'])
31
- s.add_development_dependency('rake', ['~>0.9.2'])
32
- s.add_development_dependency('yard', ['~>0.8.1'])
28
+ s.add_development_dependency 'cucumber', '~>1.2'
29
+ s.add_development_dependency 'rspec', '~>2.7'
30
+ s.add_development_dependency 'rake', '~>0.9'
33
31
 
34
32
  s.files = `git ls-files`.split("\n")
35
33
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
data/cucumber.yml ADDED
@@ -0,0 +1 @@
1
+ default: --format progress --require features --color
@@ -0,0 +1,8 @@
1
+ begin
2
+ require 'simplecov'
3
+ require 'debugger'
4
+ rescue LoadError
5
+ # ignore
6
+ end
7
+
8
+ require 'citeproc'
data/lib/citeproc.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  require 'date'
3
3
  require 'forwardable'
4
4
  require 'observer'
5
- require 'uri'
5
+ require 'open-uri'
6
6
 
7
7
  require 'multi_json'
8
8
  require 'namae'
@@ -90,12 +90,17 @@ end
90
90
  # Robust unicode upcase/downcase
91
91
  #
92
92
 
93
- if RUBY_PLATFORM == 'java'
93
+ if RUBY_PLATFORM =~ /java/i
94
94
  require 'java'
95
95
 
96
96
  puts java.lang.System.getProperty('file.encoding')
97
97
 
98
98
  module CiteProc
99
+
100
+ def jruby
101
+ yield
102
+ end
103
+
99
104
  def upcase(string)
100
105
  java.lang.String.new(string).to_upper_case(java.util.Locale::ENGLISH).to_s
101
106
  end
@@ -115,8 +120,11 @@ if RUBY_PLATFORM == 'java'
115
120
 
116
121
  else
117
122
 
118
- module CiteProc
119
- private
123
+ module CiteProc
124
+
125
+ def jruby
126
+ false
127
+ end
120
128
 
121
129
  begin
122
130
  require 'unicode'
@@ -1,5 +1,6 @@
1
1
  module CiteProc
2
2
 
3
+ # @abstract
3
4
  class Engine
4
5
  extend Forwardable
5
6
 
@@ -167,9 +167,16 @@ module CiteProc
167
167
  @type ||= self.class.name.split(/::/)[-1].downcase.to_sym
168
168
  end
169
169
 
170
- # @return [Boolean] whether or not the variable can be (safely) cast to a numeric value
170
+ # Tests whether the variable contains numeric content. Content is
171
+ # considered numeric if it solely consists of numbers. Numbers may have
172
+ # prefixes and suffixes ("D2", "2b", "L2d"), and may be separated by a
173
+ # comma, hyphen, or ampersand, with or without spaces ("2, 3", "2-4",
174
+ # "2 & 4"). For example, "2nd" tests "true" whereas "second" and
175
+ # "2nd edition" test "false".
176
+ #
177
+ # @return [Boolean] whether or not the variable's value is numeric
171
178
  def numeric?
172
- !!match(/\d/)
179
+ !!match(/^\w*\d+\w*(\s*[,&-]\s*\w*\d+\w*)*$/i)
173
180
  end
174
181
 
175
182
  # @return [Fixnum] the first (!) numeric data contained in the variable's
@@ -1,3 +1,3 @@
1
1
  module CiteProc
2
- VERSION = '0.0.9'.freeze
2
+ VERSION = '1.0.0.pre1'.freeze
3
3
  end
@@ -121,17 +121,47 @@ module CiteProc
121
121
  context 'variable contains a number' do
122
122
  it 'returns true (string initialized)' do
123
123
  Variable.new('23').should be_numeric
124
- Variable.new('foo 23').should be_numeric
124
+ Variable.new('X23').should be_numeric
125
+ Variable.new('23rd').should be_numeric
125
126
  end
126
127
  it 'returns true (integer initialized)' do
127
128
  Variable.new(23).should be_numeric
128
129
  end
129
130
  end
131
+
130
132
  context 'variable does not contain a number' do
131
133
  it 'returns false for strings' do
132
134
  Variable.new('test').should_not be_numeric
133
135
  end
134
136
  end
137
+
138
+ context 'variable contains numbers but is not numeric' do
139
+ it 'returns false for strings' do
140
+ Variable.new('23rd test').should_not be_numeric
141
+ Variable.new('23rd, 24th & 25th edition').should_not be_numeric
142
+ end
143
+ end
144
+
145
+ context 'variable contains multiple numbers' do
146
+ it 'returns true for simple ranges' do
147
+ Variable.new('23-24').should be_numeric
148
+ Variable.new('23 - 24').should be_numeric
149
+ Variable.new('23- 24').should be_numeric
150
+ end
151
+
152
+ it 'returns true for simple lists' do
153
+ Variable.new('23,24').should be_numeric
154
+ Variable.new('23 , 24').should be_numeric
155
+ Variable.new('23, 24').should be_numeric
156
+ Variable.new('23 ,24').should be_numeric
157
+ Variable.new('23 ,24,25 , 26, 27').should be_numeric
158
+ end
159
+
160
+ it 'returns true for complex lists' do
161
+ Variable.new('23rd, 24th & 25th').should be_numeric
162
+ Variable.new('X23, A2-49th & 25th & A1, B2').should be_numeric
163
+ end
164
+ end
135
165
  end
136
166
 
137
167
  describe '#strip_markup' do
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citeproc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
5
- prerelease:
4
+ version: 1.0.0.pre1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sylvester Keil
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-09 00:00:00.000000000 Z
12
+ date: 2012-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
16
- requirement: &70283202228100 !ruby/object:Gem::Requirement
16
+ requirement: &70221817636060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.3.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70283202228100
24
+ version_requirements: *70221817636060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: namae
27
- requirement: &70283202246360 !ruby/object:Gem::Requirement
27
+ requirement: &70221817635560 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,62 +32,40 @@ dependencies:
32
32
  version: '0.1'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70283202246360
35
+ version_requirements: *70221817635560
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cucumber
38
- requirement: &70283202244140 !ruby/object:Gem::Requirement
38
+ requirement: &70221817635100 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 1.2.0
43
+ version: '1.2'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70283202244140
46
+ version_requirements: *70221817635100
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70283202253680 !ruby/object:Gem::Requirement
49
+ requirement: &70221817634600 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 2.10.0
54
+ version: '2.7'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70283202253680
58
- - !ruby/object:Gem::Dependency
59
- name: watchr
60
- requirement: &70283202250860 !ruby/object:Gem::Requirement
61
- none: false
62
- requirements:
63
- - - ~>
64
- - !ruby/object:Gem::Version
65
- version: '0.7'
66
- type: :development
67
- prerelease: false
68
- version_requirements: *70283202250860
57
+ version_requirements: *70221817634600
69
58
  - !ruby/object:Gem::Dependency
70
59
  name: rake
71
- requirement: &70283202267480 !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
74
- - - ~>
75
- - !ruby/object:Gem::Version
76
- version: 0.9.2
77
- type: :development
78
- prerelease: false
79
- version_requirements: *70283202267480
80
- - !ruby/object:Gem::Dependency
81
- name: yard
82
- requirement: &70283202263440 !ruby/object:Gem::Requirement
60
+ requirement: &70221817634140 !ruby/object:Gem::Requirement
83
61
  none: false
84
62
  requirements:
85
63
  - - ~>
86
64
  - !ruby/object:Gem::Version
87
- version: 0.8.1
65
+ version: '0.9'
88
66
  type: :development
89
67
  prerelease: false
90
- version_requirements: *70283202263440
68
+ version_requirements: *70221817634140
91
69
  description: ! "\n A cite processor interface for Citation Style Language (CSL)
92
70
  styles.\n "
93
71
  email:
@@ -104,10 +82,12 @@ files:
104
82
  - AGPL
105
83
  - BSDL
106
84
  - Gemfile
85
+ - Guardfile
107
86
  - README.md
108
87
  - Rakefile
109
- - auto.watchr
110
88
  - citeproc.gemspec
89
+ - cucumber.yml
90
+ - features/support/env.rb
111
91
  - lib/citeproc.rb
112
92
  - lib/citeproc/abbreviate.rb
113
93
  - lib/citeproc/assets.rb
@@ -157,9 +137,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
137
  required_rubygems_version: !ruby/object:Gem::Requirement
158
138
  none: false
159
139
  requirements:
160
- - - ! '>='
140
+ - - ! '>'
161
141
  - !ruby/object:Gem::Version
162
- version: '0'
142
+ version: 1.3.1
163
143
  requirements: []
164
144
  rubyforge_project:
165
145
  rubygems_version: 1.8.10
@@ -167,6 +147,7 @@ signing_key:
167
147
  specification_version: 3
168
148
  summary: A cite processor interface.
169
149
  test_files:
150
+ - features/support/env.rb
170
151
  - spec/citeproc/abbreviate_spec.rb
171
152
  - spec/citeproc/assets_spec.rb
172
153
  - spec/citeproc/attributes_spec.rb
data/auto.watchr DELETED
@@ -1,22 +0,0 @@
1
-
2
- # Rules
3
- # --------------------------------------------------
4
- watch( '^spec/.+_spec.rb' ) { |m| rspec m[0] }
5
- watch( '^lib/(.*)\.rb' ) { |m| rspec "spec/#{m[1]}_spec.rb" }
6
-
7
- # Signal Handling
8
- # --------------------------------------------------
9
- Signal.trap('QUIT') { rspec 'spec' } # Ctrl-\
10
- Signal.trap('INT' ) { abort("\n") } # Ctrl-C
11
-
12
- def rspec (*paths)
13
- paths = paths.reject { |p| !File.exists?(p) }
14
- run "bundle exec rspec --tty -c #{ paths.empty? ? 'spec' : paths.join(' ') }"
15
- end
16
-
17
- def run (cmd)
18
- puts cmd
19
- system cmd
20
- end
21
-
22
- rspec 'spec'