citeproc 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53a6b76b4acbcdf2fbb930e63301e17562cbf864
4
- data.tar.gz: 8d609c36df5cda49552269df91042682bc06e9a0
3
+ metadata.gz: abde1189aaa24cbddc03302bf1dfddbf5cf16c4c
4
+ data.tar.gz: 166d801b807891e3c56f454ac9281209c2f50de2
5
5
  SHA512:
6
- metadata.gz: c4c3642540b8cf3af9fa23b1a8da4a08265da2795899ca4995eaf20b12d7c4814177bbafcd37b61c804b87f281b81d4f029bc1b81ff32c742bd92db72ccf95b2
7
- data.tar.gz: 340736821671a7c6bd27e3326ff03f918feb95a54236e8a9c79b6e6c66085f0aa083cae02bd478a429eb594371ddb91954ed4b807bd2c4a77319cc3ca0b5a8de
6
+ metadata.gz: 8b5d32aebb7b02fb0703562db2c4959e96d1c76dd2b7444b0d2b43ee1a1652b4e0786ccbf0c90be1bd8aa042de1c80109f3d28acf0fcbb182d0cf20a11564b83
7
+ data.tar.gz: 2752f32474e7c1a51a718517e78c4200fb5f72505d4ed475597e99012213650e9c631344d1cc1c7a5a6c9b245788b356ebc298a785760fe9c6803d3e4e948165
@@ -13,6 +13,12 @@ require 'citeproc/version'
13
13
  # CiteProc processes bibliographic data and formats it according to a style
14
14
  # defined in CSL (Citation Style Language).
15
15
  #
16
+ # @author Sylvester Keil
17
+ #
18
+ # Copyright 2009-2014 Sylvester Keil. All rights reserved.
19
+ #
20
+ # Copyright 2012 President and Fellows of Harvard College.
21
+ #
16
22
  module CiteProc
17
23
 
18
24
  module Converters
@@ -24,7 +24,11 @@ module CiteProc
24
24
  (2..3).include?(arguments.length)
25
25
 
26
26
  arguments.unshift(namespace || :default) if arguments.length < 3
27
- @abbreviations.deep_fetch(*arguments)
27
+
28
+ arguments[0] = arguments[0].to_sym
29
+ arguments[1] = arguments[1].to_sym
30
+
31
+ abbreviations.deep_fetch(*arguments)
28
32
  end
29
33
  alias abbrev abbreviate
30
34
 
@@ -9,11 +9,12 @@ module CiteProc
9
9
  end
10
10
  end
11
11
 
12
- ParseError = Class.new(Error)
12
+ class ParseError < Error; end
13
13
 
14
- EngineError = Class.new(Error)
14
+ class EngineError < Error; end
15
15
 
16
- NotImplementedByEngine = Class.new(Error)
16
+ class NotImplementedError < Error; end
17
+
18
+ class RenderingError < Error; end
17
19
 
18
- RenderingError = Class.new(Error)
19
20
  end
@@ -104,7 +104,7 @@ class Hash
104
104
  warn "citeproc: re-defining Hash#deep_copy, this may cause conflicts with other libraries" if method_defined?(:deep_copy)
105
105
  include CiteProc::Extensions::DeepCopy
106
106
 
107
- warn "citeproc: re-defining Hash#deep_copy, this may cause conflicts with other libraries" if method_defined?(:deep_fetch)
107
+ warn "citeproc: re-defining Hash#deep_fetch, this may cause conflicts with other libraries" if method_defined?(:deep_fetch)
108
108
  include CiteProc::Extensions::DeepFetch
109
109
 
110
110
  include CiteProc::Extensions::SymbolizeKeys unless method_defined?(:symbolize_keys)
@@ -90,8 +90,8 @@ module CiteProc
90
90
  # If given, number is added as the item's
91
91
  # citation-number variable.
92
92
  #
93
- # @params [Fixnum] number the item's citation-number
94
- # @returns [CitationItem] a citation item for this item
93
+ # @param number [Fixnum] the item's citation-number
94
+ # @return [CitationItem] a citation item for this item
95
95
  def cite(number = nil)
96
96
  CitationItem.new :id => id do |c|
97
97
  c.data = dup
@@ -378,6 +378,7 @@ module CiteProc
378
378
  end
379
379
 
380
380
  def initials_of(string)
381
+ return unless string
381
382
  string = string.dup
382
383
 
383
384
  string.gsub!(/([[:upper:]])[^[:upper:]\s-]*\s*/, "\\1#{initialize_with}")
@@ -397,6 +398,7 @@ module CiteProc
397
398
  end
398
399
 
399
400
  def existing_initials_of(string)
401
+ return unless string
400
402
  string = string.dup
401
403
 
402
404
  string.gsub!(/([[:upper:]])([[:upper:]])/, '\1 \2')
@@ -11,7 +11,7 @@ module CiteProc
11
11
  :style => 'chicago-author-date',
12
12
  :engine => 'citeproc-ruby',
13
13
  :format => 'html',
14
- :sort_case_sensitivity => false,
14
+ :sort_case_sensitively => false,
15
15
  :allow_locale_overrides => false
16
16
  }.freeze
17
17
 
@@ -97,8 +97,16 @@ module CiteProc
97
97
  engine.append(CitationData.new(arguments.flatten(1)))
98
98
  end
99
99
 
100
- def bibliography(*arguments, &block)
101
- engine.bibliography(Selector.new(*arguments, &block))
100
+ # Generates a bibliography for all items matching the passed-in
101
+ # selector conditions or block.
102
+ #
103
+ # @example
104
+ # processor.bibliography all: { type: 'book' }
105
+ # #-> renders bibliography for all books
106
+ #
107
+ # @return [Bibliography] the bibliography
108
+ def bibliography(attributes = nil, &block)
109
+ engine.bibliography(Selector.new(attributes, &block))
102
110
  end
103
111
 
104
112
  def render(mode, *arguments)
@@ -1,3 +1,3 @@
1
1
  module CiteProc
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
@@ -26,7 +26,12 @@ module CiteProc
26
26
  end
27
27
 
28
28
  describe '#abbreviate' do
29
+ it 'looks up abbreviations in the default namespace by default' do
30
+ subject.abbreviate(:title, 'foo').should == nil
31
+ subject.abbreviations[:default][:title] = { 'foo' => 'bar' }
32
+ subject.abbreviate(:title, 'foo').should == 'bar'
33
+ end
29
34
  end
30
35
 
31
36
  end
32
- end
37
+ end
@@ -7,9 +7,9 @@ end
7
7
 
8
8
  begin
9
9
  case
10
- when RUBY_PLATFORM < 'java'
11
- require 'debug'
12
- Debugger.start
10
+ when RUBY_PLATFORM == 'java'
11
+ # require 'debug'
12
+ # Debugger.start
13
13
  when defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
14
14
  require 'rubinius/debugger'
15
15
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citeproc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-12 00:00:00.000000000 Z
11
+ date: 2014-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: namae
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
- rubygems_version: 2.0.14
104
+ rubygems_version: 2.2.2
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: A cite processor interface.