mods_display 1.3.2 → 1.3.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: 5a10b1a255b452e15abe4bb8efefa442a09e17722689eeada14c2e5b210f80f8
4
- data.tar.gz: 6cb1fb4fa43419a3820e303cec2da27c9c03d2bd3d4e2db32d3d4189071207e1
3
+ metadata.gz: 8b02c9e6144396522bb2860acfab8d56b954ae7a89e2b7c23514ab040ad6815f
4
+ data.tar.gz: 0d8c763e0fae89901e0a5536c085304ac99cc039892d9768399c5d17bdee1d9d
5
5
  SHA512:
6
- metadata.gz: 221cf2e30ffc91d3c11afdc2c200552577d7bd2b7975b022bf897668b1342edd7d9a3d21c0cc2724d48ad30b0d1a0be2af46cbab15cc398072aeb5761387d80c
7
- data.tar.gz: 6f945ced7697570d76661f72e6a16d81fd03a32225f669e133c4e8428f03c1d816b282a2c40c9217d23af23a5f5ff6f49fe807917fbbfbafc34ac1f414f911d6
6
+ metadata.gz: 218328b229bcc0603719e5f1f3b424477c76d9b53aa5a83bddb2ffaf599dcf06c47edf55051cfa8d2ae4be48e46e435a4e85f7f25f65b825c0b4e36819d2e535
7
+ data.tar.gz: bca60074460f2c75f806742d07db1e5ef229e2db8fe88f8e773ba1f216df5b11661c16967623c31e00c6d9d505b777c2cb0fb4d0611bc1d125bf0e7ab4b39fb2
@@ -17,6 +17,7 @@ module ModsDisplay
17
17
  render component.new(field: field, delimiter: delimiter, value_transformer: block)
18
18
  end
19
19
 
20
+ # this returns a role's label and the display names for ModsDisplay:Name:Person
20
21
  def mods_name_field(field)
21
22
  mods_record_field(field) do |name|
22
23
  block_given? ? capture { yield(name.name) } : name.name
@@ -90,8 +91,12 @@ module ModsDisplay
90
91
  # Martin Wong data has significant linebreaks in abstracts and notes that we want
91
92
  # to preserve and display in HTML.
92
93
  #
94
+ # Some user-deposited items have complex use and reproduction statements that also
95
+ # need linebreaks preserved.
96
+ #
93
97
  # See https://github.com/sul-dlss/mods_display/issues/78
94
- simple_formatted_fields = [ModsDisplay::Abstract, ModsDisplay::Contents, ModsDisplay::Note]
98
+ # and https://github.com/sul-dlss/mods_display/issues/145
99
+ simple_formatted_fields = [ModsDisplay::Abstract, ModsDisplay::Contents, ModsDisplay::Note, ModsDisplay::AccessCondition]
95
100
  if simple_formatted_fields.any? { |klass| field&.field.is_a? klass } && formatted_val.include?("\n")
96
101
  simple_format(formatted_val, {}, sanitize: false)
97
102
  else
@@ -82,10 +82,21 @@ module ModsDisplay
82
82
  end
83
83
 
84
84
  def license_statement(element)
85
- matches = element_text(element).match(/^(?<code>.*) (?<type>.*):(?<description>.*)$/)
85
+ element_text = element_text(element)
86
+ legacy_matches = element_text.match(/^(?<code>.*) (?<type>.*):(?<description>.*)$/)
87
+ return legacy_license_statement(element, legacy_matches) if legacy_matches
86
88
 
87
- return element_text(element) unless matches
89
+ matches = element_text.match(/^This work is licensed under a (.+?)\.$/)
90
+ return linked_licensed_statement(element, matches) if matches && element['xlink:href'].present?
88
91
 
92
+ element_text
93
+ end
94
+
95
+ def linked_licensed_statement(element, matches)
96
+ "This work is licensed under a <a href='#{element['xlink:href']}'>#{matches[1]}</a>."
97
+ end
98
+
99
+ def legacy_license_statement(_element, matches)
89
100
  code = matches[:code].downcase
90
101
  type = matches[:type].downcase
91
102
  description = license_description(code, type) || matches[:description]
@@ -3,6 +3,9 @@
3
3
  module ModsDisplay
4
4
  class Name < Field
5
5
  include ModsDisplay::RelatorCodes
6
+
7
+ # this returns a hash:
8
+ # { role1 label => [ ModsDisplay:Name:Person, ModsDisplay:Name:Person, ...], role2 label => [ ModsDisplay:Name:Person, ModsDisplay:Name:Person, ...] }
6
9
  def fields
7
10
  return_fields = @values.map do |value|
8
11
  name_identifiers = value.element_children.select { |child| child.name == 'nameIdentifier' }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ModsDisplay
4
- VERSION = '1.3.2'
4
+ VERSION = '1.3.3'
5
5
  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: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jessie Keck
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-26 00:00:00.000000000 Z
11
+ date: 2023-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stanford-mods
@@ -245,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
245
  - !ruby/object:Gem::Version
246
246
  version: '0'
247
247
  requirements: []
248
- rubygems_version: 3.4.13
248
+ rubygems_version: 3.3.7
249
249
  signing_key:
250
250
  specification_version: 4
251
251
  summary: The MODS Display gem allows implementers to configure a customized display