csl 1.4.3 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +5 -5
  2. data/BSDL +1 -1
  3. data/Gemfile +11 -30
  4. data/README.md +1 -2
  5. data/Rakefile +7 -3
  6. data/csl.gemspec +9 -13
  7. data/lib/csl/locale.rb +8 -4
  8. data/lib/csl/locale/term.rb +1 -1
  9. data/lib/csl/node.rb +3 -3
  10. data/lib/csl/style/names.rb +9 -9
  11. data/lib/csl/treelike.rb +12 -8
  12. data/lib/csl/version.rb +1 -1
  13. metadata +15 -94
  14. data/.rspec +0 -3
  15. data/.simplecov +0 -4
  16. data/Guardfile +0 -15
  17. data/features/locales/loading.feature +0 -57
  18. data/features/locales/ordinalize.feature +0 -638
  19. data/features/parser/choose.feature +0 -16
  20. data/features/parser/info.feature +0 -27
  21. data/features/parser/localized_dates.feature +0 -35
  22. data/features/parser/terms.feature +0 -28
  23. data/features/step_definitions/locale_steps.rb +0 -36
  24. data/features/step_definitions/parser_steps.rb +0 -40
  25. data/features/step_definitions/style_steps.rb +0 -16
  26. data/features/style/loading.feature +0 -53
  27. data/features/support/env.rb +0 -24
  28. data/spec/csl/info_spec.rb +0 -278
  29. data/spec/csl/locale/date_spec.rb +0 -63
  30. data/spec/csl/locale/style_options_spec.rb +0 -19
  31. data/spec/csl/locale/term_spec.rb +0 -255
  32. data/spec/csl/locale_spec.rb +0 -245
  33. data/spec/csl/node_spec.rb +0 -273
  34. data/spec/csl/parser_spec.rb +0 -112
  35. data/spec/csl/schema_spec.rb +0 -112
  36. data/spec/csl/style/bibliography_spec.rb +0 -7
  37. data/spec/csl/style/choose_spec.rb +0 -66
  38. data/spec/csl/style/citation_spec.rb +0 -7
  39. data/spec/csl/style/date_spec.rb +0 -21
  40. data/spec/csl/style/group_spec.rb +0 -7
  41. data/spec/csl/style/label_spec.rb +0 -44
  42. data/spec/csl/style/layout_spec.rb +0 -7
  43. data/spec/csl/style/macro_spec.rb +0 -7
  44. data/spec/csl/style/names_spec.rb +0 -36
  45. data/spec/csl/style/number_spec.rb +0 -85
  46. data/spec/csl/style/sort_spec.rb +0 -11
  47. data/spec/csl/style/text_spec.rb +0 -7
  48. data/spec/csl/style_spec.rb +0 -137
  49. data/spec/csl/treelike_spec.rb +0 -151
  50. data/spec/fixtures/locales/locales-de-DE.xml +0 -298
  51. data/spec/fixtures/locales/locales-en-GB.xml +0 -304
  52. data/spec/fixtures/locales/locales-en-US.xml +0 -304
  53. data/spec/fixtures/styles/apa.csl +0 -443
  54. data/spec/spec_helper.rb +0 -57
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9a40d05b869d0449dfa44789ebb566a7982370c4
4
- data.tar.gz: 250321443eee09d877016c6294f3ee4394764161
2
+ SHA256:
3
+ metadata.gz: 898e3658ba769d2e532731020e7e060c8c9c7feba6e180cf6f42f376a4fe8e49
4
+ data.tar.gz: dc3c3f9a28dbb9cba43343f076d4a724e6e231c6d54ed5990d536ceaff5978c4
5
5
  SHA512:
6
- metadata.gz: 42cebdb43391419a9aa21e5e1c711de3b6a2d77afc5d0353d696dcadb2ddb60ff6f3e2098e02a8ee4e9ab160febd0d62346c6aeb0cb330facf73de0e1482463b
7
- data.tar.gz: a7df94ba34b1edde8ea787779c9779b35efad66fffebdaf6384f42c63bead587cd13fac6aeba5da0421bc1f9449acf4552bb27a1b58a9b3d400b588286d60d3f
6
+ metadata.gz: 83efc463e5dec2e4a167e050e5802150642da5bf8668e2084f103af6259ec0d94dc2123764b78d6d8037b5af0dd03f99ae37c98c1e92fbe96de3f8385ddf1287
7
+ data.tar.gz: 7b6db55d071b3d31521d40988dd88e2700e8ca1a66753e1282c0057656d08a3103f8a26f7e56eabb84694de33d89b3006d44d999fa5b3a2bb652fb82b51d1288
data/BSDL CHANGED
@@ -1,7 +1,7 @@
1
1
  CSL-Ruby. A Ruby CSL parser and library.
2
2
 
3
3
  Copyright 2012 President and Fellows of Harvard College.
4
- Copyright 2009-2014 Sylvester Keil. All rights reserved.
4
+ Copyright 2009-2020 Sylvester Keil. All rights reserved.
5
5
 
6
6
  Redistribution and use in source and binary forms, with or without
7
7
  modification, are permitted provided that the following conditions are met:
data/Gemfile CHANGED
@@ -2,49 +2,30 @@ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  group :development, :test do
5
- gem 'rake', '~>10.0'
6
- gem 'rspec', '~>3.0'
7
- gem 'cucumber', '~>1.2'
8
- gem 'simplecov', '~>0.8', :require => false
9
- gem 'rubinius-coverage', :platform => :rbx
10
- gem 'coveralls', :require => false
5
+ gem 'rake'
6
+ gem 'rspec'
7
+ gem 'cucumber'
11
8
  end
12
9
 
13
10
  group :debug do
14
- if RUBY_VERSION >= '2.0'
15
- gem 'byebug', :require => false, :platforms => :mri
16
- else
17
- gem 'debugger', :require => false, :platforms => :mri
18
- end
19
-
20
- gem 'ruby-debug', :require => false, :platforms => :jruby
21
-
22
- gem 'rubinius-debugger', :require => false, :platforms => :rbx
23
- gem 'rubinius-compiler', :require => false, :platforms => :rbx
11
+ gem 'byebug', require: false, platforms: :mri
12
+ gem 'ruby-debug', require: false, platforms: :jruby
24
13
  end
25
14
 
26
15
  group :optional do
27
- gem 'nokogiri', '~> 1.6'
16
+ gem 'nokogiri'
28
17
  end
29
18
 
30
19
  group :extra do
31
- gem 'guard', '~>2.2'
32
- gem 'guard-rspec'
33
- gem 'guard-cucumber'
34
- gem 'bond'
35
20
  gem 'diff-lcs'
36
21
  gem 'pry'
37
- gem 'rb-fsevent', '~>0.9', :platforms => :ruby
38
- gem 'yard', '~>0.8', :platforms => :mri
39
- gem 'redcarpet', '~>3.0', :platforms => :mri
22
+ gem 'yard', platforms: :mri
23
+ gem 'redcarpet', platforms: :mri
40
24
  end
41
25
 
42
- group :rbx do
43
- platform :rbx do
44
- gem 'rubysl', '~>2.0'
45
- gem 'json', '~>1.8'
46
- gem 'racc'
47
- end
26
+ group :coverage do
27
+ gem 'coveralls', require: false if ENV['CI']
28
+ gem 'simplecov', require: false
48
29
  end
49
30
 
50
31
  # vim: syntax=ruby
data/README.md CHANGED
@@ -6,7 +6,6 @@ format to describe the formatting of citations, notes and bibliographies.
6
6
 
7
7
  [![Build Status](https://secure.travis-ci.org/inukshuk/csl-ruby.png)](http://travis-ci.org/inukshuk/csl-ruby)
8
8
  [![Coverage Status](https://coveralls.io/repos/inukshuk/csl-ruby/badge.png?branch=master)](https://coveralls.io/r/inukshuk/csl-ruby?branch=master)
9
- [![Dependency Status](https://gemnasium.com/inukshuk/csl-ruby.png)](https://gemnasium.com/inukshuk/csl-ruby)
10
9
 
11
10
  Styles and Locales
12
11
  ------------------
@@ -139,7 +138,7 @@ this project as part of [Google Summer of Code](https://developers.google.com/op
139
138
 
140
139
  Copyright
141
140
  ---------
142
- Copyright 2009-2015 Sylvester Keil. All rights reserved.
141
+ Copyright 2009-2020 Sylvester Keil. All rights reserved.
143
142
 
144
143
  Copyright 2012 President and Fellows of Harvard College.
145
144
 
data/Rakefile CHANGED
@@ -34,9 +34,13 @@ Cucumber::Rake::Task.new(:cucumber) do |t|
34
34
  t.profile = 'default'
35
35
  end
36
36
 
37
- require 'coveralls/rake/task'
38
- Coveralls::RakeTask.new
39
- task :test_with_coveralls => [:spec, :cucumber, 'coveralls:push']
37
+ begin
38
+ require 'coveralls/rake/task'
39
+ Coveralls::RakeTask.new
40
+ task :test_with_coveralls => [:spec, :cucumber, 'coveralls:push']
41
+ rescue LoadError => e
42
+ # ignore
43
+ end if ENV['CI']
40
44
 
41
45
  task :release do |t|
42
46
  system "gem build csl.gemspec"
@@ -8,7 +8,9 @@ EXCLUDES = %w{
8
8
  .coveralls.yml
9
9
  .travis.yml
10
10
  .csl.gemspec
11
- }
11
+ .simplecov
12
+ .rspec
13
+ } | `git ls-files -- {spec,features}/*`.split("\n")
12
14
 
13
15
  Gem::Specification.new do |s|
14
16
  s.name = 'csl'
@@ -17,27 +19,21 @@ Gem::Specification.new do |s|
17
19
  s.authors = ['Sylvester Keil']
18
20
  s.email = ['http://sylvester.keil.or.at']
19
21
  s.homepage = 'https://github.com/inukshuk/csl-ruby'
22
+ s.license = 'AGPL-3.0'
23
+ s.date = Time.now.strftime('%Y-%m-%d')
20
24
  s.summary = 'A Ruby CSL parser and library'
21
- s.description =
22
- """
25
+ s.description = <<~EOS
23
26
  A Ruby parser and full API for the Citation Style Language (CSL),
24
27
  an open XML-based language to describe the formatting of citations
25
28
  and bibliographies.
26
- """
27
-
28
- s.license = 'AGPL'
29
- s.date = Time.now.strftime('%Y-%m-%d')
29
+ EOS
30
30
 
31
- s.required_ruby_version = '>= 1.9.3'
32
31
 
33
- s.add_dependency('namae', ['~>0.7'])
32
+ s.required_ruby_version = '>= 2.2'
33
+ s.add_dependency('namae', ['~>1.0'])
34
34
 
35
35
  s.files = `git ls-files`.split("\n") - EXCLUDES
36
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
37
- s.executables = []
38
36
  s.require_path = 'lib'
39
-
40
- s.has_rdoc = 'yard'
41
37
  end
42
38
 
43
39
  # vim: syntax=ruby
@@ -330,9 +330,9 @@ module CSL
330
330
  #
331
331
  # Calls block once for each term defined by the locale. If no block is
332
332
  # given, an enumerator is returned instead.
333
- def each_term
333
+ def each_term(&block)
334
334
  if block_given?
335
- terms.each(&Proc.new)
335
+ terms.each(&block)
336
336
  self
337
337
  else
338
338
  enum_for :each_term
@@ -345,12 +345,12 @@ module CSL
345
345
  #
346
346
  # Calls block once for each date format defined by the locale. If no
347
347
  # block is given, an enumerator is returned instead.
348
- def each_date
348
+ def each_date(&block)
349
349
  if block_given?
350
350
  if date.is_a? CSL::Node
351
351
  yield date
352
352
  else
353
- date.each(&Proc.new)
353
+ date.each(&block)
354
354
  end
355
355
  else
356
356
  enum_for :each_date
@@ -409,6 +409,10 @@ module CSL
409
409
  self
410
410
  end
411
411
 
412
+ def reverse_merge(other)
413
+ other.merge(self)
414
+ end
415
+
412
416
 
413
417
  # Locales are sorted first by language, then by region; sort order is
414
418
  # alphabetical with the following exceptions: the default locale is
@@ -441,7 +441,7 @@ module CSL
441
441
  when options.key?(:number) || options.key?('number')
442
442
  key = options[:number] || options['number']
443
443
 
444
- if key.is_a?(Fixnum) || key.to_s =~ /^[+-]?\d+$/
444
+ if key.is_a?(Integer) || key.to_s =~ /^[+-]?\d+$/
445
445
  key.to_i > 1
446
446
  else
447
447
  !key.blank? && key.to_s =~ /^plural/i
@@ -268,9 +268,9 @@ module CSL
268
268
  alias has_defaults? has_default_attributes?
269
269
 
270
270
  # Iterates through the Node's attributes
271
- def each
271
+ def each(&block)
272
272
  if block_given?
273
- attributes.each_pair(&Proc.new)
273
+ attributes.each_pair(&block)
274
274
  self
275
275
  else
276
276
  to_enum
@@ -538,7 +538,7 @@ module CSL
538
538
  def match_conditions_for(name, conditions)
539
539
  case name
540
540
  when Node
541
- [name.nodename, name.attributes.to_hash]
541
+ conditions, name = name.attributes.to_hash, name.nodename
542
542
  when Hash
543
543
  conditions, name = name, nodename
544
544
  when Symbol
@@ -88,32 +88,32 @@ module CSL
88
88
  def truncate?(names, subsequent = false)
89
89
  names = names.length if names.respond_to?(:length)
90
90
  limit = truncate_when(subsequent)
91
+ count = truncate_at(subsequent)
91
92
 
92
- !limit.zero? && names.to_i >= limit
93
+ !count.nil? && !limit.nil? && names.to_i >= limit.to_i
93
94
  end
94
95
 
95
96
  # @param [Enumerable] names
96
97
  # @return [Array] the truncated list of names
97
98
  def truncate(names, subsequent = false)
98
- limit = truncate_at(subsequent)
99
-
100
- return [] if limit.zero?
101
- names.take limit
99
+ count = truncate_at(subsequent)
100
+ count = names.length if count.nil?
101
+ names.take count.to_i
102
102
  end
103
103
 
104
104
  def truncate_when(subsequent = false)
105
105
  if subsequent && attribute?(:'et-al-subsequent-min')
106
- attributes[:'et-al-subsequent-min'].to_i
106
+ attributes[:'et-al-subsequent-min']
107
107
  else
108
- attributes[:'et-al-min'].to_i
108
+ attributes[:'et-al-min']
109
109
  end
110
110
  end
111
111
 
112
112
  def truncate_at(subsequent = false)
113
113
  if subsequent && attribute?(:'et-al-subsequent-use-first')
114
- attributes.fetch(:'et-al-subsequent-use-first', 1).to_i
114
+ attributes.fetch(:'et-al-subsequent-use-first')
115
115
  else
116
- attributes.fetch(:'et-al-use-first', 1).to_i
116
+ attributes.fetch(:'et-al-use-first')
117
117
  end
118
118
  end
119
119
 
@@ -17,9 +17,9 @@ module CSL
17
17
  @nodename ||= self.class.name.split(/::/)[-1].gsub(/([[:lower:]])([[:upper:]])/, '\1-\2').downcase
18
18
  end
19
19
 
20
- def each_child
20
+ def each_child(&block)
21
21
  if block_given?
22
- children.each(&Proc.new)
22
+ children.each(&block)
23
23
  self
24
24
  else
25
25
  enum_for :each_child
@@ -27,7 +27,7 @@ module CSL
27
27
  end
28
28
 
29
29
  def delete_children(*nodes)
30
- nodes.each do |node|
30
+ nodes.flatten.each do |node|
31
31
  delete_child node
32
32
  end
33
33
  end
@@ -167,11 +167,11 @@ module CSL
167
167
  end
168
168
 
169
169
  # Traverses the node's sub-tree in depth-first order.
170
- def each_descendant
170
+ def each_descendant(&block)
171
171
  if block_given?
172
172
  each_child do |child|
173
173
  yield child
174
- child.each_descendant(&Proc.new)
174
+ child.each_descendant(&block)
175
175
  end
176
176
 
177
177
  self
@@ -230,7 +230,11 @@ module CSL
230
230
  %w{ ancestors descendants siblings root depth }.each do |name|
231
231
  ivar = "@#{name}"
232
232
  define_method("#{name}!") do
233
- instance_variable_get(ivar) || send(name)
233
+ if instance_variable_defined?(ivar)
234
+ instance_variable_get(ivar)
235
+ else
236
+ send(name)
237
+ end
234
238
  end
235
239
  end
236
240
 
@@ -376,9 +380,9 @@ module CSL
376
380
 
377
381
  # Iterates through all children. Nil values are skipped and Arrays
378
382
  # expanded.
379
- def each
383
+ def each(&block)
380
384
  if block_given?
381
- order.each(&Proc.new)
385
+ order.each(&block)
382
386
  self
383
387
  else
384
388
  to_enum
@@ -1,3 +1,3 @@
1
1
  module CSL
2
- VERSION = '1.4.3'.freeze
2
+ VERSION = '1.5.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-25 00:00:00.000000000 Z
11
+ date: 2020-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: namae
@@ -16,16 +16,18 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.7'
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.7'
27
- description: "\n\t\tA Ruby parser and full API for the Citation Style Language (CSL),\n\t\tan
28
- open XML-based language to describe the formatting of citations\n\t\tand bibliographies.\n\t\t"
26
+ version: '1.0'
27
+ description: |
28
+ A Ruby parser and full API for the Citation Style Language (CSL),
29
+ an open XML-based language to describe the formatting of citations
30
+ and bibliographies.
29
31
  email:
30
32
  - http://sylvester.keil.or.at
31
33
  executables: []
@@ -34,28 +36,14 @@ extra_rdoc_files: []
34
36
  files:
35
37
  - ".document"
36
38
  - ".gitignore"
37
- - ".rspec"
38
- - ".simplecov"
39
39
  - ".yardopts"
40
40
  - AGPL
41
41
  - BSDL
42
42
  - Gemfile
43
- - Guardfile
44
43
  - README.md
45
44
  - Rakefile
46
45
  - csl.gemspec
47
46
  - cucumber.yml
48
- - features/locales/loading.feature
49
- - features/locales/ordinalize.feature
50
- - features/parser/choose.feature
51
- - features/parser/info.feature
52
- - features/parser/localized_dates.feature
53
- - features/parser/terms.feature
54
- - features/step_definitions/locale_steps.rb
55
- - features/step_definitions/parser_steps.rb
56
- - features/step_definitions/style_steps.rb
57
- - features/style/loading.feature
58
- - features/support/env.rb
59
47
  - lib/csl.rb
60
48
  - lib/csl/compatibility.rb
61
49
  - lib/csl/date_part.rb
@@ -87,33 +75,6 @@ files:
87
75
  - lib/csl/style/text.rb
88
76
  - lib/csl/treelike.rb
89
77
  - lib/csl/version.rb
90
- - spec/csl/info_spec.rb
91
- - spec/csl/locale/date_spec.rb
92
- - spec/csl/locale/style_options_spec.rb
93
- - spec/csl/locale/term_spec.rb
94
- - spec/csl/locale_spec.rb
95
- - spec/csl/node_spec.rb
96
- - spec/csl/parser_spec.rb
97
- - spec/csl/schema_spec.rb
98
- - spec/csl/style/bibliography_spec.rb
99
- - spec/csl/style/choose_spec.rb
100
- - spec/csl/style/citation_spec.rb
101
- - spec/csl/style/date_spec.rb
102
- - spec/csl/style/group_spec.rb
103
- - spec/csl/style/label_spec.rb
104
- - spec/csl/style/layout_spec.rb
105
- - spec/csl/style/macro_spec.rb
106
- - spec/csl/style/names_spec.rb
107
- - spec/csl/style/number_spec.rb
108
- - spec/csl/style/sort_spec.rb
109
- - spec/csl/style/text_spec.rb
110
- - spec/csl/style_spec.rb
111
- - spec/csl/treelike_spec.rb
112
- - spec/fixtures/locales/locales-de-DE.xml
113
- - spec/fixtures/locales/locales-en-GB.xml
114
- - spec/fixtures/locales/locales-en-US.xml
115
- - spec/fixtures/styles/apa.csl
116
- - spec/spec_helper.rb
117
78
  - vendor/schema/csl-categories.rng
118
79
  - vendor/schema/csl-terms.rng
119
80
  - vendor/schema/csl-types.rng
@@ -121,9 +82,9 @@ files:
121
82
  - vendor/schema/csl.rng
122
83
  homepage: https://github.com/inukshuk/csl-ruby
123
84
  licenses:
124
- - AGPL
85
+ - AGPL-3.0
125
86
  metadata: {}
126
- post_install_message:
87
+ post_install_message:
127
88
  rdoc_options: []
128
89
  require_paths:
129
90
  - lib
@@ -131,55 +92,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
92
  requirements:
132
93
  - - ">="
133
94
  - !ruby/object:Gem::Version
134
- version: 1.9.3
95
+ version: '2.2'
135
96
  required_rubygems_version: !ruby/object:Gem::Requirement
136
97
  requirements:
137
98
  - - ">="
138
99
  - !ruby/object:Gem::Version
139
100
  version: '0'
140
101
  requirements: []
141
- rubyforge_project:
142
- rubygems_version: 2.4.7
143
- signing_key:
102
+ rubygems_version: 3.1.2
103
+ signing_key:
144
104
  specification_version: 4
145
105
  summary: A Ruby CSL parser and library
146
- test_files:
147
- - features/locales/loading.feature
148
- - features/locales/ordinalize.feature
149
- - features/parser/choose.feature
150
- - features/parser/info.feature
151
- - features/parser/localized_dates.feature
152
- - features/parser/terms.feature
153
- - features/step_definitions/locale_steps.rb
154
- - features/step_definitions/parser_steps.rb
155
- - features/step_definitions/style_steps.rb
156
- - features/style/loading.feature
157
- - features/support/env.rb
158
- - spec/csl/info_spec.rb
159
- - spec/csl/locale/date_spec.rb
160
- - spec/csl/locale/style_options_spec.rb
161
- - spec/csl/locale/term_spec.rb
162
- - spec/csl/locale_spec.rb
163
- - spec/csl/node_spec.rb
164
- - spec/csl/parser_spec.rb
165
- - spec/csl/schema_spec.rb
166
- - spec/csl/style/bibliography_spec.rb
167
- - spec/csl/style/choose_spec.rb
168
- - spec/csl/style/citation_spec.rb
169
- - spec/csl/style/date_spec.rb
170
- - spec/csl/style/group_spec.rb
171
- - spec/csl/style/label_spec.rb
172
- - spec/csl/style/layout_spec.rb
173
- - spec/csl/style/macro_spec.rb
174
- - spec/csl/style/names_spec.rb
175
- - spec/csl/style/number_spec.rb
176
- - spec/csl/style/sort_spec.rb
177
- - spec/csl/style/text_spec.rb
178
- - spec/csl/style_spec.rb
179
- - spec/csl/treelike_spec.rb
180
- - spec/fixtures/locales/locales-de-DE.xml
181
- - spec/fixtures/locales/locales-en-GB.xml
182
- - spec/fixtures/locales/locales-en-US.xml
183
- - spec/fixtures/styles/apa.csl
184
- - spec/spec_helper.rb
185
- has_rdoc: yard
106
+ test_files: []