citeproc 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/citeproc.rb +6 -0
- data/lib/citeproc/abbreviate.rb +5 -1
- data/lib/citeproc/errors.rb +5 -4
- data/lib/citeproc/extensions.rb +1 -1
- data/lib/citeproc/item.rb +2 -2
- data/lib/citeproc/names.rb +2 -0
- data/lib/citeproc/processor.rb +11 -3
- data/lib/citeproc/version.rb +1 -1
- data/spec/citeproc/abbreviate_spec.rb +6 -1
- data/spec/spec_helper.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abde1189aaa24cbddc03302bf1dfddbf5cf16c4c
|
4
|
+
data.tar.gz: 166d801b807891e3c56f454ac9281209c2f50de2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b5d32aebb7b02fb0703562db2c4959e96d1c76dd2b7444b0d2b43ee1a1652b4e0786ccbf0c90be1bd8aa042de1c80109f3d28acf0fcbb182d0cf20a11564b83
|
7
|
+
data.tar.gz: 2752f32474e7c1a51a718517e78c4200fb5f72505d4ed475597e99012213650e9c631344d1cc1c7a5a6c9b245788b356ebc298a785760fe9c6803d3e4e948165
|
data/lib/citeproc.rb
CHANGED
@@ -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
|
data/lib/citeproc/abbreviate.rb
CHANGED
@@ -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
|
-
|
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
|
|
data/lib/citeproc/errors.rb
CHANGED
@@ -9,11 +9,12 @@ module CiteProc
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
class ParseError < Error; end
|
13
13
|
|
14
|
-
EngineError
|
14
|
+
class EngineError < Error; end
|
15
15
|
|
16
|
-
|
16
|
+
class NotImplementedError < Error; end
|
17
|
+
|
18
|
+
class RenderingError < Error; end
|
17
19
|
|
18
|
-
RenderingError = Class.new(Error)
|
19
20
|
end
|
data/lib/citeproc/extensions.rb
CHANGED
@@ -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#
|
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)
|
data/lib/citeproc/item.rb
CHANGED
@@ -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
|
-
# @
|
94
|
-
# @
|
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
|
data/lib/citeproc/names.rb
CHANGED
@@ -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')
|
data/lib/citeproc/processor.rb
CHANGED
@@ -11,7 +11,7 @@ module CiteProc
|
|
11
11
|
:style => 'chicago-author-date',
|
12
12
|
:engine => 'citeproc-ruby',
|
13
13
|
:format => 'html',
|
14
|
-
:
|
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
|
-
|
101
|
-
|
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)
|
data/lib/citeproc/version.rb
CHANGED
@@ -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
|
data/spec/spec_helper.rb
CHANGED
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.
|
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-
|
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.
|
104
|
+
rubygems_version: 2.2.2
|
105
105
|
signing_key:
|
106
106
|
specification_version: 4
|
107
107
|
summary: A cite processor interface.
|