citeproc-ruby 2.0.0 → 2.1.0
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 +4 -4
- data/.github/workflows/ci.yml +10 -5
- data/BSDL +1 -1
- data/Gemfile +3 -4
- data/README.md +63 -61
- data/Rakefile +3 -5
- data/lib/citeproc/ruby/renderer/choose.rb +4 -2
- data/lib/citeproc/ruby/version.rb +1 -1
- metadata +17 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4638485de31e2e8c4ab29c0ded3c7f2d26c603164ab801df2259248c20c4fd70
|
4
|
+
data.tar.gz: b5f8fef7bc32f342ae20934a658c60e41bda292ffd881e10a356e2dd419a8f66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d14b3342bbaec986311bdf311170a7a88c5a183fcaaf7e8481a675f1a2f0a032c56ddde863d57c6baf7dd23bb944bac00be9079788661a0d9a04db5dcd33b302
|
7
|
+
data.tar.gz: 3b7fc32415189849122d64d1c6256125f68f4b00321b84230a4ba7adf3b2564c055ff0a08c846ecd3c152488dc4c9bce8c0c74d7f87fa964a9d3afb5e8833b45
|
data/.github/workflows/ci.yml
CHANGED
@@ -10,18 +10,23 @@ jobs:
|
|
10
10
|
build:
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
env:
|
13
|
-
RUBYOPT: W2
|
14
13
|
BUNDLE_WITHOUT: debug:extra
|
15
14
|
strategy:
|
16
15
|
matrix:
|
17
16
|
ruby-version:
|
18
|
-
- 3.
|
19
|
-
- 2
|
20
|
-
-
|
17
|
+
- '3.3'
|
18
|
+
- '3.2'
|
19
|
+
- '3.1'
|
21
20
|
steps:
|
22
|
-
- uses: actions/checkout@
|
21
|
+
- uses: actions/checkout@v4
|
23
22
|
- uses: ruby/setup-ruby@v1
|
24
23
|
with:
|
25
24
|
ruby-version: ${{ matrix.ruby-version }}
|
26
25
|
bundler-cache: true
|
27
26
|
- run: bundle exec rake
|
27
|
+
- name: Upload coverage results
|
28
|
+
if: matrix.ruby-version == '3.3'
|
29
|
+
continue-on-error: true
|
30
|
+
uses: coverallsapp/github-action@v2
|
31
|
+
with:
|
32
|
+
github-token: ${{ github.token }}
|
data/BSDL
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
CiteProc-Ruby. A Ruby CSL cite processor.
|
2
2
|
|
3
3
|
Copyright 2012 President and Fellows of Harvard College.
|
4
|
-
Copyright 2009-
|
4
|
+
Copyright 2009-2024 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
@@ -8,12 +8,11 @@ group :development, :test do
|
|
8
8
|
gem 'rake'
|
9
9
|
gem 'rspec'
|
10
10
|
gem 'cucumber'
|
11
|
-
gem 'unicode_utils', require: false unless RUBY_VERSION >= '2.4'
|
12
11
|
end
|
13
12
|
|
14
13
|
group :debug do
|
15
|
-
gem '
|
16
|
-
gem 'ruby-debug', :
|
14
|
+
gem 'debug', '>= 1.0.0', require: false, platforms: :mri
|
15
|
+
gem 'ruby-debug', require: false, platforms: :jruby
|
17
16
|
end
|
18
17
|
|
19
18
|
group :optional do
|
@@ -22,11 +21,11 @@ group :optional do
|
|
22
21
|
end
|
23
22
|
|
24
23
|
group :extra do
|
25
|
-
gem 'pry'
|
26
24
|
gem 'yard', platforms: :mri
|
27
25
|
gem 'redcarpet', platforms: :mri
|
28
26
|
end
|
29
27
|
|
30
28
|
group :coverage do
|
31
29
|
gem 'simplecov', require: false
|
30
|
+
gem 'simplecov-lcov', require: false
|
32
31
|
end
|
data/README.md
CHANGED
@@ -15,66 +15,68 @@ Install CiteProc-Ruby and all official CSL styles (optional).
|
|
15
15
|
|
16
16
|
Start rendering you references with any CSL style!
|
17
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
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
18
|
+
```ruby
|
19
|
+
require 'citeproc'
|
20
|
+
require 'csl/styles'
|
21
|
+
|
22
|
+
# Create a new processor with the desired style,
|
23
|
+
# format, and locale.
|
24
|
+
cp = CiteProc::Processor.new style: 'apa', format: 'text'
|
25
|
+
|
26
|
+
# To see what styles are available in your current
|
27
|
+
# environment, run `CSL::Style.ls'; this also works for
|
28
|
+
# locales as `CSL::Locale.ls'.
|
29
|
+
|
30
|
+
# Tell the processor where to find your references. In this
|
31
|
+
# example we load them from a BibTeX bibliography using the
|
32
|
+
# bibtex-ruby gem.
|
33
|
+
cp.import BibTeX.open('./references.bib').to_citeproc
|
34
|
+
|
35
|
+
# Now you are ready for rendering; the processor API
|
36
|
+
# provides three main rendering methods: `process',
|
37
|
+
# `append', or `bibliography'.
|
38
|
+
|
39
|
+
# For simple one-off renditions, you can also call
|
40
|
+
# `render' in bibliography or citation mode:
|
41
|
+
cp.render :bibliography, id: 'knuth'
|
42
|
+
|
43
|
+
# This will return a rendered reference, like:
|
44
|
+
#-> Knuth, D. (1968). The art of computer programming. Boston: Addison-Wesley.
|
45
|
+
|
46
|
+
# CiteProc-Ruby exposes a full CSL API to you; this
|
47
|
+
# makes it possible to just alter CSL styles on the
|
48
|
+
# fly. For example, what if we want names not to be
|
49
|
+
# initialized even though APA style is configured to
|
50
|
+
# do so? We could change the CSL style itself, but
|
51
|
+
# we can also make a quick adjustment at runtime:
|
52
|
+
name = cp.engine.style.macros['author'] > 'names' > 'name'
|
53
|
+
|
54
|
+
# What just happened? We selected the current style's
|
55
|
+
# 'author' macro and then descended to the CSL name
|
56
|
+
# node via its parent names node. Now we can change
|
57
|
+
# this name node and the cite processor output will
|
58
|
+
# pick-up the changes right away:
|
59
|
+
name[:initialize] = 'false'
|
60
|
+
|
61
|
+
cp.render :bibliography, id: 'knuth'
|
62
|
+
#-> Knuth, Donald. (1968). The art of computer programming (Vol. 1). Boston: Addison-Wesley.
|
63
|
+
|
64
|
+
# Note that we have picked 'text' as the output format;
|
65
|
+
# if we want to make us of richer output formats we
|
66
|
+
# can switch to HTML instead:
|
67
|
+
cp.engine.format = 'html'
|
68
|
+
|
69
|
+
cp.render :bibliography, id: 'knuth'
|
70
|
+
#-> Knuth, Donald. (1968). <i>The art of computer programming</i> (Vol. 1). Boston: Addison-Wesley.
|
71
|
+
|
72
|
+
# You can also render citations on the fly.
|
73
|
+
cp.render :citation, id: 'knuth', locator: '23'
|
74
|
+
#-> (Knuth, 1968, p. 23)
|
75
|
+
|
76
|
+
# Pass an array if you want to render multiple citations:
|
77
|
+
cp.render :citation, [{ id: 'knuth' }, { id: 'perez' }]
|
78
|
+
#-> (Knuth, 1968; Perez, 1989)
|
79
|
+
```
|
78
80
|
|
79
81
|
Documentation
|
80
82
|
-------------
|
@@ -146,7 +148,7 @@ this project as part of [Google Summer of Code](https://developers.google.com/op
|
|
146
148
|
|
147
149
|
Copyright
|
148
150
|
---------
|
149
|
-
Copyright 2009-
|
151
|
+
Copyright 2009-2024 Sylvester Keil. All rights reserved.
|
150
152
|
|
151
153
|
Copyright 2012 President and Fellows of Harvard College.
|
152
154
|
|
data/Rakefile
CHANGED
@@ -12,19 +12,17 @@ end
|
|
12
12
|
$:.unshift(File.join(File.dirname(__FILE__), './lib'))
|
13
13
|
require 'citeproc/ruby/version'
|
14
14
|
|
15
|
-
|
16
15
|
desc 'Run a Pry session with CiteProc-Ruby loaded'
|
17
16
|
task :console do
|
18
|
-
|
17
|
+
ARGV.clear
|
18
|
+
require 'irb'
|
19
19
|
require 'citeproc/ruby'
|
20
|
-
|
21
|
-
Pry.start
|
20
|
+
IRB.start
|
22
21
|
end
|
23
22
|
|
24
23
|
task :check_warnings do
|
25
24
|
$VERBOSE = true
|
26
25
|
require 'citeproc/ruby'
|
27
|
-
|
28
26
|
puts CiteProc::Ruby::VERSION
|
29
27
|
end
|
30
28
|
|
@@ -24,9 +24,12 @@ module CiteProc
|
|
24
24
|
|
25
25
|
join node.each_child.map { |child|
|
26
26
|
render item, child
|
27
|
-
}
|
27
|
+
}, closest_delimiter_for(node)
|
28
28
|
end
|
29
29
|
|
30
|
+
def closest_delimiter_for(node)
|
31
|
+
node.closest(/^group|layout$/)&.delimiter || ''
|
32
|
+
end
|
30
33
|
|
31
34
|
# Evaluates the conditions of the passed-in Choose::Block
|
32
35
|
# against the passed-in CitationItem using the Block's matcher.
|
@@ -101,6 +104,5 @@ module CiteProc
|
|
101
104
|
end
|
102
105
|
end
|
103
106
|
end
|
104
|
-
|
105
107
|
end
|
106
108
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: citeproc-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: citeproc
|
@@ -44,6 +44,20 @@ dependencies:
|
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '2.0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: observer
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "<"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.0'
|
47
61
|
description: |
|
48
62
|
CiteProc-Ruby is a Citation Style Language (CSL) 1.0.1 compatible cite
|
49
63
|
processor implementation written in pure Ruby.
|
@@ -88,7 +102,6 @@ files:
|
|
88
102
|
- lib/citeproc/ruby/version.rb
|
89
103
|
homepage: https://github.com/inukshuk/citeproc-ruby
|
90
104
|
licenses:
|
91
|
-
- AGPL-3.0
|
92
105
|
- BSD-2-Clause
|
93
106
|
metadata: {}
|
94
107
|
post_install_message:
|
@@ -106,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
119
|
- !ruby/object:Gem::Version
|
107
120
|
version: '0'
|
108
121
|
requirements: []
|
109
|
-
rubygems_version: 3.
|
122
|
+
rubygems_version: 3.5.6
|
110
123
|
signing_key:
|
111
124
|
specification_version: 4
|
112
125
|
summary: A Citation Style Language (CSL) cite processor
|