mods_display 0.9.0 → 0.9.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04b5809a32a151c63f3c9423f8917046060c12ed6a88a64e30b018f89256f144
|
4
|
+
data.tar.gz: a2104c15cdec18e265fd19349fece71736a2e92f2c0bceb8288d7977a4ffa2a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f4505c49261d1a76e3f1ba8da36fce97a396c5a680de93ac61293d45aefde35716463172e0e92c29e90cbef2a8ed11b65ef9fa2787028e6f8be36f31dadf582
|
7
|
+
data.tar.gz: afbf6a24b41cdc0c097f66b7ff7173501cfd1de626c1ed850e54c6e85319edd4af4484b46612e7828622b78469536ce8d859a8e1068bacb2461ac4d2c8385b25
|
@@ -77,6 +77,9 @@ module ModsDisplay
|
|
77
77
|
|
78
78
|
def license_statement(element)
|
79
79
|
matches = element.text.match(/^(?<code>.*) (?<type>.*):(?<description>.*)$/)
|
80
|
+
|
81
|
+
return "<div>#{element.text}</div>" unless matches
|
82
|
+
|
80
83
|
code = matches[:code].downcase
|
81
84
|
type = matches[:type].downcase
|
82
85
|
description = license_description(code, type) || matches[:description]
|
data/lib/mods_display/version.rb
CHANGED
@@ -25,6 +25,7 @@ describe ModsDisplay::AccessCondition do
|
|
25
25
|
@cc_license_note = Stanford::Mods::Record.new.from_str(cc_license_fixture, false).accessCondition
|
26
26
|
@odc_license_note = Stanford::Mods::Record.new.from_str(odc_license_fixture, false).accessCondition
|
27
27
|
@no_link_license_note = Stanford::Mods::Record.new.from_str(no_license_fixture, false).accessCondition
|
28
|
+
@garbage_license_fixture = Stanford::Mods::Record.new.from_str(garbage_license_fixture, false).accessCondition
|
28
29
|
end
|
29
30
|
describe 'labels' do
|
30
31
|
it 'should normalize types and assign proper labels' do
|
@@ -54,7 +55,7 @@ describe ModsDisplay::AccessCondition do
|
|
54
55
|
expect(fields.first.values.length).to eq(1)
|
55
56
|
expect(fields.first.values.first).to match(%r{^<div class='unknown-something'>.*</div>$})
|
56
57
|
end
|
57
|
-
it 'should
|
58
|
+
it 'should identify and link CreativeCommons licenses properly' do
|
58
59
|
fields = mods_display_access_condition(@cc_license_note).fields
|
59
60
|
expect(fields.length).to eq(1)
|
60
61
|
expect(fields.first.values.length).to eq(1)
|
@@ -63,7 +64,7 @@ describe ModsDisplay::AccessCondition do
|
|
63
64
|
'This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License'
|
64
65
|
)
|
65
66
|
end
|
66
|
-
it 'should
|
67
|
+
it 'should identify and link OpenDataCommons licenses properly' do
|
67
68
|
fields = mods_display_access_condition(@odc_license_note).fields
|
68
69
|
expect(fields.length).to eq(1)
|
69
70
|
expect(fields.first.values.length).to eq(1)
|
@@ -82,6 +83,16 @@ describe ModsDisplay::AccessCondition do
|
|
82
83
|
)
|
83
84
|
expect(fields.first.values.first).not_to include('<a.*>')
|
84
85
|
end
|
86
|
+
|
87
|
+
it 'returns the license text if it does not look like our expected format' do
|
88
|
+
fields = mods_display_access_condition(@garbage_license_fixture).fields
|
89
|
+
expect(fields.length).to eq(1)
|
90
|
+
expect(fields.first.values.length).to eq(1)
|
91
|
+
expect(fields.first.values.first).to include(
|
92
|
+
'Unknown garbage that does not look like a license'
|
93
|
+
)
|
94
|
+
expect(fields.first.values.first).not_to include('<a.*>')
|
95
|
+
end
|
85
96
|
end
|
86
97
|
end
|
87
98
|
describe 'to_html' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mods_display
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jessie Keck
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stanford-mods
|
@@ -243,7 +243,7 @@ files:
|
|
243
243
|
homepage: https://github.com/sul-dlss/mods_display
|
244
244
|
licenses: []
|
245
245
|
metadata: {}
|
246
|
-
post_install_message:
|
246
|
+
post_install_message:
|
247
247
|
rdoc_options: []
|
248
248
|
require_paths:
|
249
249
|
- lib
|
@@ -258,8 +258,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
258
|
- !ruby/object:Gem::Version
|
259
259
|
version: '0'
|
260
260
|
requirements: []
|
261
|
-
rubygems_version: 3.
|
262
|
-
signing_key:
|
261
|
+
rubygems_version: 3.2.3
|
262
|
+
signing_key:
|
263
263
|
specification_version: 4
|
264
264
|
summary: The MODS Display gem allows implementers to configure a customized display
|
265
265
|
of MODS metadata. This display implements the specifications defined at Stanford
|