mods_display 0.9.0 → 0.9.1

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: 812e9a8267dc6ae0197542f330279828002b7e79c1c6d8e524b2de5a5fb74ee0
4
- data.tar.gz: cf89ca82a8b2e5468ae688ad52d1bfb9df31d7259b3e4a97e0d23a7ac073382f
3
+ metadata.gz: 04b5809a32a151c63f3c9423f8917046060c12ed6a88a64e30b018f89256f144
4
+ data.tar.gz: a2104c15cdec18e265fd19349fece71736a2e92f2c0bceb8288d7977a4ffa2a0
5
5
  SHA512:
6
- metadata.gz: b986f158981d8911a9aec36f971b9ccaf47be7cf896504de4e54b0d94f01100a98b37599f3c4ff0743f5250013fe3b0ec2e579fdf282104d92fd622bf3f13fe3
7
- data.tar.gz: 898809bce0691902559f201808422a5088eb173812638002b9282dbf45fcc386b6ce0192e96de8eb9e94591af452ebe05d921f99751bc6a890a997df4cc215e5
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]
@@ -1,3 +1,3 @@
1
1
  module ModsDisplay
2
- VERSION = '0.9.0'
2
+ VERSION = '0.9.1'
3
3
  end
@@ -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 itentify and link CreativeCommons licenses properly' do
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 itentify and link OpenDataCommons licenses properly' do
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
@@ -47,4 +47,12 @@ module AccessConditionFixtures
47
47
  </mods>
48
48
  XML
49
49
  end
50
+
51
+ def garbage_license_fixture
52
+ <<-XML
53
+ <mods>
54
+ <accessCondition type='license'>Unknown garbage that does not look like a license</accessCondition>
55
+ </mods>
56
+ XML
57
+ end
50
58
  end
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.0
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-03-09 00:00:00.000000000 Z
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.1.4
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