blacklight-marc 7.0.1 → 7.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +32 -0
- data/app/models/concerns/blacklight/{solr/document/marc_export.rb → marc/document_export.rb} +4 -5
- data/app/models/concerns/blacklight/{solr/document/marc.rb → marc/document_extension.rb} +9 -5
- data/lib/blacklight/marc/engine.rb +7 -11
- data/lib/blacklight/marc/version.rb +1 -1
- data/lib/generators/blacklight/marc/install_generator.rb +4 -4
- data/spec/test_app_templates/Gemfile.extra +0 -1
- data/spec/views/bookmarks/_endnote.html.erb_spec.rb +1 -1
- data/spec/views/bookmarks/_refworks.html.erb_spec.rb +1 -1
- data/spec/views/catalog/index.atom.builder_spec.rb +1 -1
- metadata +9 -9
- data/.travis.yml +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c370b1c69a4ed2a7c2e77de6dbdeedbf6314fa1334ae1c3f88f216bd7dad23a
|
4
|
+
data.tar.gz: cf92a4865a958b67d9f9eec4f352e5cc666f5b1c052661d2e1d0899ce1e45419
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54ddf02511c8fa185842d66f0f1f30a9ae988485fc0108e7f099fc6b4a8b4be83b56f96c6757949d7b3c95b9e1444fb08c219e68c3c5d2c1a81c560d092848e8
|
7
|
+
data.tar.gz: f1d1c86c9635a4519c898763d7a6fc80a05088a3060c4dd41dae28d2b7b763806cd3f577094d9d69f4760a9dbbf26944ac47bf92ef6181c144e96711d8acff1c
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
rails_version: [6.1.4.7, 7.0.2.3]
|
15
|
+
ruby: [2.7, '3.0']
|
16
|
+
include:
|
17
|
+
- rails_version: 5.2.4.4
|
18
|
+
ruby: 2.7
|
19
|
+
- rails_version: 6.0.3.4
|
20
|
+
ruby: 2.7
|
21
|
+
env:
|
22
|
+
RAILS_VERSION: ${{ matrix.rails_version }}
|
23
|
+
steps:
|
24
|
+
- uses: actions/checkout@v2
|
25
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
26
|
+
uses: ruby/setup-ruby@v1
|
27
|
+
with:
|
28
|
+
ruby-version: ${{ matrix.ruby }}
|
29
|
+
- name: Install dependencies with Rails ${{ matrix.rails_version }}
|
30
|
+
run: bundle install
|
31
|
+
- name: Run tests
|
32
|
+
run: bundle exec rake
|
data/app/models/concerns/blacklight/{solr/document/marc_export.rb → marc/document_export.rb}
RENAMED
@@ -1,11 +1,12 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
# -*- coding: utf-8 -*-
|
3
|
-
|
3
|
+
|
4
|
+
# Written for use with Blacklight::Marc::DocumentExtension, but you can use
|
4
5
|
# it for your own custom Blacklight document Marc extension too -- just
|
5
6
|
# include this module in any document extension (or any other class)
|
6
7
|
# that provides a #to_marc returning a ruby-marc object. This module will add
|
7
8
|
# in export_as translation methods for a variety of formats.
|
8
|
-
module Blacklight::
|
9
|
+
module Blacklight::Marc::DocumentExport
|
9
10
|
|
10
11
|
def self.register_export_formats(document)
|
11
12
|
document.will_export_as(:xml)
|
@@ -126,9 +127,7 @@ module Blacklight::Solr::Document::MarcExport
|
|
126
127
|
# As of 11 May 2010, Refworks has a problem with UTF-8 if it's decomposed,
|
127
128
|
# it seems to want C form normalization, although RefWorks support
|
128
129
|
# couldn't tell me that. -jrochkind
|
129
|
-
text
|
130
|
-
|
131
|
-
return text
|
130
|
+
text.unicode_normalize(:nfc)
|
132
131
|
end
|
133
132
|
|
134
133
|
# Endnote Import Format. See the EndNote User Guide at:
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# This extension would normally be registered using
|
10
10
|
# Blacklight::Solr::Document#use_extension. eg:
|
11
11
|
#
|
12
|
-
# SolrDocument.use_extension( Blacklight::
|
12
|
+
# SolrDocument.use_extension( Blacklight::Marc::DocumentExtension ) { |document| my_logic_for_document_has_marc?( document ) }
|
13
13
|
#
|
14
14
|
# This extension also expects a :marc_source_field and :marc_format_type to
|
15
15
|
# be registered with the hosting classes extension_parameters. In an initializer
|
@@ -18,15 +18,16 @@
|
|
18
18
|
# SolrDocument.extension_parameters[:marc_format_type] = :marc21 # or :marcxml
|
19
19
|
require 'marc'
|
20
20
|
|
21
|
-
module Blacklight::
|
21
|
+
module Blacklight::Marc
|
22
|
+
module DocumentExtension
|
22
23
|
|
23
|
-
include Blacklight::
|
24
|
+
include Blacklight::Marc::DocumentExport # All our export_as stuff based on to_marc.
|
24
25
|
|
25
26
|
class UnsupportedMarcFormatType < RuntimeError; end
|
26
27
|
|
27
28
|
def self.extended(document)
|
28
29
|
# Register our exportable formats, we inherit these from MarcExport
|
29
|
-
Blacklight::
|
30
|
+
Blacklight::Marc::DocumentExport.register_export_formats( document )
|
30
31
|
end
|
31
32
|
|
32
33
|
# ruby-marc object
|
@@ -59,7 +60,9 @@ module Blacklight::Solr::Document::Marc
|
|
59
60
|
end
|
60
61
|
|
61
62
|
def marc_record_from_marcxml
|
62
|
-
|
63
|
+
marcxml = fetch(_marc_source_field)
|
64
|
+
marcxml = marcxml.first if marcxml.kind_of? Array
|
65
|
+
MARC::XMLReader.new(StringIO.new(marcxml)).to_a.first
|
63
66
|
end
|
64
67
|
|
65
68
|
def _marc_helper
|
@@ -76,4 +79,5 @@ module Blacklight::Solr::Document::Marc
|
|
76
79
|
self.class.extension_parameters[:marc_format_type]
|
77
80
|
end
|
78
81
|
|
82
|
+
end
|
79
83
|
end
|
@@ -1,21 +1,10 @@
|
|
1
|
-
require "blacklight/marc"
|
2
|
-
require "rails"
|
3
|
-
|
4
1
|
module Blacklight::Marc
|
5
2
|
class Engine < Rails::Engine
|
6
|
-
config.autoload_paths += %W(
|
7
|
-
#{config.root}/app/presenters
|
8
|
-
#{config.root}/app/controllers/concerns
|
9
|
-
#{config.root}/app/models/concerns
|
10
|
-
)
|
11
|
-
|
12
3
|
rake_tasks do
|
13
4
|
load "railties/solr_marc.rake"
|
14
5
|
end
|
15
6
|
|
16
7
|
initializer 'blacklight_marc.initialize' do |app|
|
17
|
-
require 'blacklight/solr/document'
|
18
|
-
|
19
8
|
Mime::Type.register_alias "text/plain", :refworks_marc_txt
|
20
9
|
Mime::Type.register_alias "text/plain", :openurl_kev
|
21
10
|
Mime::Type.register "application/x-endnote-refer", :endnote
|
@@ -23,6 +12,13 @@ module Blacklight::Marc
|
|
23
12
|
Mime::Type.register "application/marcxml+xml", :marcxml,
|
24
13
|
["application/x-marc+xml", "application/x-marcxml+xml",
|
25
14
|
"application/marc+xml"]
|
15
|
+
|
16
|
+
# these are here for backwards compatibility with the old class names,
|
17
|
+
# which zeitwerk didn't care for
|
18
|
+
config.after_initialize do
|
19
|
+
Blacklight::Solr::Document::Marc = Blacklight::Marc::DocumentExtension
|
20
|
+
Blacklight::Solr::Document::MarcExport = Blacklight::Marc::DocumentExport
|
21
|
+
end
|
26
22
|
end
|
27
23
|
end
|
28
24
|
end
|
@@ -40,11 +40,11 @@ EOF
|
|
40
40
|
# The following shows how to setup this blacklight document to display marc documents
|
41
41
|
extension_parameters[:marc_source_field] = :marc_ss
|
42
42
|
extension_parameters[:marc_format_type] = :marcxml
|
43
|
-
use_extension(
|
44
|
-
document.key?(
|
43
|
+
use_extension(Blacklight::Marc::DocumentExtension) do |document|
|
44
|
+
document.key?(SolrDocument.extension_parameters[:marc_source_field])
|
45
45
|
end
|
46
|
-
|
47
|
-
field_semantics.merge!(
|
46
|
+
|
47
|
+
field_semantics.merge!(
|
48
48
|
:title => "title_ssm",
|
49
49
|
:author => "author_ssm",
|
50
50
|
:language => "language_ssim",
|
@@ -29,7 +29,7 @@ describe "catalog/index" do
|
|
29
29
|
params.merge!( @params )
|
30
30
|
allow(view).to receive(:blacklight_config).and_return(@config)
|
31
31
|
allow(view).to receive(:search_field_options_for_select).and_return([])
|
32
|
-
|
32
|
+
allow(controller).to receive(:search_state_class).and_return(Blacklight::SearchState)
|
33
33
|
render :template => 'catalog/index', :formats => [:atom]
|
34
34
|
|
35
35
|
# We need to use rexml to test certain things that have_tag wont' test
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight-marc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0
|
4
|
+
version: 7.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: blacklight
|
@@ -219,17 +219,17 @@ executables: []
|
|
219
219
|
extensions: []
|
220
220
|
extra_rdoc_files: []
|
221
221
|
files:
|
222
|
+
- ".github/workflows/ruby.yml"
|
222
223
|
- ".gitignore"
|
223
224
|
- ".solr_wrapper.yaml"
|
224
|
-
- ".travis.yml"
|
225
225
|
- Gemfile
|
226
226
|
- LICENSE
|
227
227
|
- README.md
|
228
228
|
- Rakefile
|
229
229
|
- app/assets/stylesheets/blacklight_marc.scss
|
230
230
|
- app/helpers/blacklight_marc_helper.rb
|
231
|
-
- app/models/concerns/blacklight/
|
232
|
-
- app/models/concerns/blacklight/
|
231
|
+
- app/models/concerns/blacklight/marc/document_export.rb
|
232
|
+
- app/models/concerns/blacklight/marc/document_extension.rb
|
233
233
|
- app/views/bookmarks/_endnote.html.erb
|
234
234
|
- app/views/bookmarks/_marc_tools.html.erb
|
235
235
|
- app/views/bookmarks/_refworks.html.erb
|
@@ -310,7 +310,7 @@ homepage: https://github.com/projectblacklight/blacklight-marc
|
|
310
310
|
licenses:
|
311
311
|
- Apache-2.0
|
312
312
|
metadata: {}
|
313
|
-
post_install_message:
|
313
|
+
post_install_message:
|
314
314
|
rdoc_options: []
|
315
315
|
require_paths:
|
316
316
|
- lib
|
@@ -325,8 +325,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
325
325
|
- !ruby/object:Gem::Version
|
326
326
|
version: '0'
|
327
327
|
requirements: []
|
328
|
-
rubygems_version: 3.
|
329
|
-
signing_key:
|
328
|
+
rubygems_version: 3.2.32
|
329
|
+
signing_key:
|
330
330
|
specification_version: 4
|
331
331
|
summary: MARC support for Blacklight
|
332
332
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
|
4
|
-
notifications:
|
5
|
-
email: false
|
6
|
-
|
7
|
-
matrix:
|
8
|
-
include:
|
9
|
-
- rvm: 2.7.1
|
10
|
-
env: "RAILS_VERSION=6.0.3.2"
|
11
|
-
- rvm: 2.6.6
|
12
|
-
env: "RAILS_VERSION=6.0.3.2"
|
13
|
-
- rvm: 2.6.6
|
14
|
-
env: "RAILS_VERSION=5.2.4.3"
|
15
|
-
|
16
|
-
before_install:
|
17
|
-
- gem install bundler
|
18
|
-
|
19
|
-
notifications:
|
20
|
-
irc: "irc.freenode.org#blacklight"
|
21
|
-
email:
|
22
|
-
- blacklight-commits@googlegroups.com
|
23
|
-
|
24
|
-
global_env:
|
25
|
-
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
26
|
-
|
27
|
-
jdk: openjdk11
|