blacklight-citeproc 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58728c3ed06908d2c5fea28545abcef6d99e57dc65c783b59b9f94f036f2b6f7
4
- data.tar.gz: b3489bf8ab8a75996200af7dcf440a1b23911533d01841ac1880d2cd1dbc823f
3
+ metadata.gz: c52e615bdce424fbfec115950ac82e38649f018158159940da6e9fcd873c2104
4
+ data.tar.gz: 57570370748113f270490e00b5c52e71c53362fba0c43e9ddfb767955a511f7a
5
5
  SHA512:
6
- metadata.gz: 91d78c9b8154b1bf72d80dea5e24eaee1f129a5ab6532728853804d555eb947eaee46b4b133cd8b8fa6704c15ec9f8e10fce1fe0eb32c6f1b7d799f6d49c40aa
7
- data.tar.gz: ceb6103e2cb503ebb91e6c4ce21e0529ab3d2ccc0018397f68a1cc922c1f96a460ab07b0c332dd9a925ab6c9b12208f56fc8b671e884ddfaeebbd495905f658b
6
+ metadata.gz: ba1daf9478ce409440babf3a88433ebf1318eabc57c970278d68eb1bc7a26eb99d89db8a8e8a29e733139a7dfffc61330270e0fd63a651a67d9641829115b5eb
7
+ data.tar.gz: d5b51b51495d1289035fb7d4e12c8e4d43a2cfcdf927c3ed3471aef3a6ea476b156ed60c7b470f43a30d3d2facc4919a5c5814051dde92f7367b8acf41ad9885
@@ -11,7 +11,7 @@ module Blacklight::Citeproc
11
11
 
12
12
  def initialize
13
13
  @processors = []
14
- @citations = []
14
+ @bibliographies = []
15
15
 
16
16
  throw BadConfigError, 'Catalog controller needs a config.citeproc section' unless blacklight_config.citeproc
17
17
  @config = blacklight_config.citeproc
@@ -33,5 +33,26 @@ module Blacklight::Citeproc
33
33
  render layout: false
34
34
  end
35
35
 
36
+ def print_multiple ids
37
+ _, documents = search_service.fetch(ids)
38
+ bibtex = ::BibTeX::Bibliography.new
39
+ documents.each do |document|
40
+ bibtex << document.export_as(:bibtex)
41
+ end
42
+
43
+ @processors.each do |processor|
44
+ processor.import bibtex.to_citeproc
45
+ bibliography = processor.render(:bibliography)
46
+ @citations << {citation: bibliography.html_safe, label: processor.options[:style]}
47
+ end
48
+ render :print_single, layout: false
49
+ end
50
+
51
+ def print_bookmarks
52
+ bookmarks = token_or_current_or_guest_user.bookmarks
53
+ bookmark_ids = bookmarks.collect { |b| b.document_id.to_s }
54
+ print_multiple bookmark_ids
55
+ end
56
+
36
57
  end
37
58
  end
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ['lib']
23
23
 
24
- spec.add_dependency "bibtex-ruby", "~> 4.4.6"
24
+ spec.add_dependency "bibtex-ruby", ">= 4.4.6"
25
25
  spec.add_dependency "citeproc-ruby", "~> 1.1"
26
26
  spec.add_dependency "csl-styles", "~> 1.0.1.9"
27
27
 
@@ -1,3 +1,4 @@
1
1
  Blacklight::Citeproc::Engine.routes.draw do
2
2
  get '/catalog/:id/citation' => 'blacklight/citeproc/citation#print_single'
3
+ get '/bookmarks/citation' => 'blacklight/citeproc/citation#print_bookmarks'
3
4
  end
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Citeproc
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-citeproc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jane Sandberg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-13 00:00:00.000000000 Z
11
+ date: 2020-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bibtex-ruby
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.4.6
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
26
  version: 4.4.6
27
27
  - !ruby/object:Gem::Dependency