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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9f9a8160c37669047e06dbeb5659056f96da25971415f2137aba6dd897f2b36
4
- data.tar.gz: 5b896f34ed9b437a08e7fe00fa0b1de64d8f7195a83f1d53591512411be46a83
3
+ metadata.gz: 4638485de31e2e8c4ab29c0ded3c7f2d26c603164ab801df2259248c20c4fd70
4
+ data.tar.gz: b5f8fef7bc32f342ae20934a658c60e41bda292ffd881e10a356e2dd419a8f66
5
5
  SHA512:
6
- metadata.gz: f65a5e51302e839f5ec13ba8a5a2fd743127305a70a1f94c4cfbc457157ba3eb3382e883475a710f04abad8f18f11296713c4b5c7235271fb2f31b9297e8dc15
7
- data.tar.gz: 3fc95092334d3f3a10bb6e626d98c4d6e4d4fdd875c95cb6189b7394d65a61b0ca6d2ab367cced0cfb78c93c38920562706c727c5a8d263c1e4dfbeb2ef6e0af
6
+ metadata.gz: d14b3342bbaec986311bdf311170a7a88c5a183fcaaf7e8481a675f1a2f0a032c56ddde863d57c6baf7dd23bb944bac00be9079788661a0d9a04db5dcd33b302
7
+ data.tar.gz: 3b7fc32415189849122d64d1c6256125f68f4b00321b84230a4ba7adf3b2564c055ff0a08c846ecd3c152488dc4c9bce8c0c74d7f87fa964a9d3afb5e8833b45
@@ -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.0
19
- - 2.7
20
- - 2.6
17
+ - '3.3'
18
+ - '3.2'
19
+ - '3.1'
21
20
  steps:
22
- - uses: actions/checkout@v2
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-2020 Sylvester Keil. All rights reserved.
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 'byebug', :require => false, :platforms => :mri
16
- gem 'ruby-debug', :require => false, :platforms => :jruby
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
- require 'citeproc'
19
- require 'csl/styles'
20
-
21
- # Create a new processor with the desired style,
22
- # format, and locale.
23
- cp = CiteProc::Processor.new style: 'apa', format: 'text'
24
-
25
- # To see what styles are available in your current
26
- # environment, run `CSL::Style.ls'; this also works for
27
- # locales as `CSL::Locale.ls'.
28
-
29
- # Tell the processor where to find your references. In this
30
- # example we load them from a BibTeX bibliography using the
31
- # bibtex-ruby gem.
32
- cp.import BibTeX.open('./references.bib').to_citeproc
33
-
34
- # Now you are ready for rendering; the processor API
35
- # provides three main rendering methods: `process',
36
- # `append', or `bibliography'.
37
-
38
- # For simple one-off renditions, you can also call
39
- # `render' in bibliography or citation mode:
40
- cp.render :bibliography, id: 'knuth'
41
-
42
- # This will return a rendered reference, like:
43
- #-> Knuth, D. (1968). The art of computer programming. Boston: Addison-Wesley.
44
-
45
- # CiteProc-Ruby exposes a full CSL API to you; this
46
- # makes it possible to just alter CSL styles on the
47
- # fly. For example, what if we want names not to be
48
- # initialized even though APA style is configured to
49
- # do so? We could change the CSL style itself, but
50
- # we can also make a quick adjustment at runtime:
51
- name = cp.engine.style.macros['author'] > 'names' > 'name'
52
-
53
- # What just happened? We selected the current style's
54
- # 'author' macro and then descended to the CSL name
55
- # node via its parent names node. Now we can change
56
- # this name node and the cite processor output will
57
- # pick-up the changes right away:
58
- name[:initialize] = 'false'
59
-
60
- cp.render :bibliography, id: 'knuth'
61
- #-> Knuth, Donald. (1968). The art of computer programming (Vol. 1). Boston: Addison-Wesley.
62
-
63
- # Note that we have picked 'text' as the output format;
64
- # if we want to make us of richer output formats we
65
- # can switch to HTML instead:
66
- cp.engine.format = 'html'
67
-
68
- cp.render :bibliography, id: 'knuth'
69
- #-> Knuth, Donald. (1968). <i>The art of computer programming</i> (Vol. 1). Boston: Addison-Wesley.
70
-
71
- # You can also render citations on the fly.
72
- cp.render :citation, id: 'knuth', locator: '23'
73
- #-> (Knuth, 1968, p. 23)
74
-
75
- # Pass an array if you want to render multiple citations:
76
- cp.render :citation, [{ id: 'knuth' }, { id: 'perez' }]
77
- #-> (Knuth, 1968; Perez, 1989)
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-2020 Sylvester Keil. All rights reserved.
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
- require 'pry'
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
@@ -1,5 +1,5 @@
1
1
  module CiteProc
2
2
  module Ruby
3
- VERSION = '2.0.0'
3
+ VERSION = '2.1.0'
4
4
  end
5
5
  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.0.0
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: 2022-01-01 00:00:00.000000000 Z
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.2.15
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