mods_display 1.6.1 → 1.6.3
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 +4 -4
- data/.rubocop.yml +11 -7
- data/.rubocop_todo.yml +48 -69
- data/Gemfile +2 -0
- data/lib/mods_display/fields/abstract.rb +1 -1
- data/lib/mods_display/fields/audience.rb +1 -1
- data/lib/mods_display/fields/cartographics.rb +1 -1
- data/lib/mods_display/fields/contents.rb +1 -1
- data/lib/mods_display/fields/date_other.rb +2 -1
- data/lib/mods_display/fields/genre.rb +1 -1
- data/lib/mods_display/fields/geo.rb +1 -1
- data/lib/mods_display/fields/name.rb +1 -1
- data/lib/mods_display/fields/nested_related_item.rb +17 -3
- data/lib/mods_display/fields/reference_title.rb +1 -1
- data/lib/mods_display/fields/related_item.rb +3 -3
- data/lib/mods_display/fields/resource_type.rb +1 -1
- data/lib/mods_display/fields/subject.rb +6 -8
- data/lib/mods_display/related_item_concerns.rb +2 -2
- data/lib/mods_display/version.rb +1 -1
- data/mods_display.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb30184d2c6b81caa114445a1dbb6f06ef18c413c35c2b6737d02cf383c5aa76
|
4
|
+
data.tar.gz: 9c3414483586142a98cd9a350e7a4300959c4cd7c9a2f00e42e43f93362c335a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c259bff4aae3d28754646b78b24fa2e3a2fd94039fb9184767a9a644fec3e013a6400129263424887e77752244465ee0502f65c7a960e74fb0b4223d0df8d224
|
7
|
+
data.tar.gz: 9661658df503d9dbe555de30a3a72d081add769a0c11ca6e7908ff2df47f30e8911bc8ffeb75abb41a58f7d8f2c3c10ead31b2de7335dd989a453aa1f151c17e
|
data/.rubocop.yml
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
2
|
|
3
|
-
require:
|
3
|
+
require:
|
4
|
+
- rubocop-rspec
|
5
|
+
- rubocop-rspec_rails
|
6
|
+
- rubocop-capybara
|
4
7
|
|
5
8
|
AllCops:
|
6
9
|
Exclude:
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
-
|
11
|
-
-
|
10
|
+
- "*.gemspec"
|
11
|
+
- "bin/**/*"
|
12
|
+
- "db/**/*"
|
13
|
+
- "spec/fixtures/**/*"
|
14
|
+
- "vendor/**/*"
|
12
15
|
TargetRubyVersion: 2.7
|
13
16
|
NewCops: enable
|
17
|
+
SuggestExtensions: false
|
14
18
|
|
15
19
|
# Use single-quoted strings where possible
|
16
20
|
Style/StringLiterals:
|
@@ -35,4 +39,4 @@ Naming/MethodName:
|
|
35
39
|
Enabled: false
|
36
40
|
|
37
41
|
Naming/VariableName:
|
38
|
-
Enabled: false
|
42
|
+
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
@@ -1,80 +1,59 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2023-
|
3
|
+
# on 2023-12-06 18:14:53 UTC using RuboCop version 1.58.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 2
|
10
10
|
Capybara/SpecificMatcher:
|
11
11
|
Exclude:
|
12
|
-
-
|
12
|
+
- "spec/helpers/record_helper_spec.rb"
|
13
13
|
|
14
14
|
# Offense count: 2
|
15
15
|
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
|
16
16
|
Lint/DuplicateBranch:
|
17
17
|
Exclude:
|
18
|
-
-
|
18
|
+
- "lib/mods_display/fields/title.rb"
|
19
19
|
|
20
20
|
# Offense count: 1
|
21
21
|
Lint/ShadowingOuterLocalVariable:
|
22
22
|
Exclude:
|
23
|
-
-
|
23
|
+
- "spec/helpers/record_helper_spec.rb"
|
24
24
|
|
25
|
-
# Offense count:
|
25
|
+
# Offense count: 15
|
26
26
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
27
27
|
Metrics/AbcSize:
|
28
|
-
Max:
|
28
|
+
Max: 42
|
29
29
|
|
30
|
-
# Offense count:
|
30
|
+
# Offense count: 2
|
31
31
|
# Configuration parameters: CountComments, CountAsOne.
|
32
32
|
Metrics/ClassLength:
|
33
|
-
Max:
|
33
|
+
Max: 132
|
34
34
|
|
35
35
|
# Offense count: 1
|
36
36
|
# Configuration parameters: LengthThreshold.
|
37
37
|
Metrics/CollectionLiteralLength:
|
38
38
|
Exclude:
|
39
|
-
-
|
39
|
+
- "lib/mods_display/relator_codes.rb"
|
40
40
|
|
41
|
-
# Offense count:
|
41
|
+
# Offense count: 9
|
42
42
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
43
43
|
Metrics/CyclomaticComplexity:
|
44
|
-
Max:
|
44
|
+
Max: 12
|
45
45
|
|
46
|
-
# Offense count:
|
46
|
+
# Offense count: 18
|
47
47
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
48
48
|
Metrics/MethodLength:
|
49
|
-
Max:
|
49
|
+
Max: 24
|
50
50
|
|
51
|
-
# Offense count:
|
51
|
+
# Offense count: 7
|
52
52
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
53
53
|
Metrics/PerceivedComplexity:
|
54
|
-
Max:
|
55
|
-
|
56
|
-
# Offense count: 1
|
57
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
58
|
-
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
59
|
-
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
60
|
-
Naming/MemoizedInstanceVariableName:
|
61
|
-
Exclude:
|
62
|
-
- 'lib/mods_display/fields/geo.rb'
|
54
|
+
Max: 13
|
63
55
|
|
64
|
-
# Offense count:
|
65
|
-
# Configuration parameters: EnforcedStyle, AllowedPatterns.
|
66
|
-
# SupportedStyles: snake_case, camelCase
|
67
|
-
Naming/MethodName:
|
68
|
-
Exclude:
|
69
|
-
- 'lib/mods_display/fields/abstract.rb'
|
70
|
-
- 'lib/mods_display/fields/audience.rb'
|
71
|
-
- 'lib/mods_display/fields/contents.rb'
|
72
|
-
- 'lib/mods_display/fields/field.rb'
|
73
|
-
- 'lib/mods_display/fields/genre.rb'
|
74
|
-
- 'lib/mods_display/fields/resource_type.rb'
|
75
|
-
- 'lib/mods_display/fields/subject.rb'
|
76
|
-
|
77
|
-
# Offense count: 18
|
56
|
+
# Offense count: 17
|
78
57
|
RSpec/BeforeAfterAll:
|
79
58
|
Enabled: false
|
80
59
|
|
@@ -83,34 +62,34 @@ RSpec/BeforeAfterAll:
|
|
83
62
|
# Prefixes: when, with, without
|
84
63
|
RSpec/ContextWording:
|
85
64
|
Exclude:
|
86
|
-
-
|
87
|
-
-
|
65
|
+
- "spec/fields/contents_spec.rb"
|
66
|
+
- "spec/fields/form_spec.rb"
|
88
67
|
|
89
68
|
# Offense count: 1
|
90
69
|
# Configuration parameters: IgnoredMetadata.
|
91
70
|
RSpec/DescribeClass:
|
92
71
|
Exclude:
|
93
|
-
-
|
94
|
-
-
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-
|
98
|
-
-
|
72
|
+
- "**/spec/features/**/*"
|
73
|
+
- "**/spec/requests/**/*"
|
74
|
+
- "**/spec/routing/**/*"
|
75
|
+
- "**/spec/system/**/*"
|
76
|
+
- "**/spec/views/**/*"
|
77
|
+
- "spec/integration/html_spec.rb"
|
99
78
|
|
100
79
|
# Offense count: 1
|
101
80
|
# This cop supports safe autocorrection (--autocorrect).
|
102
81
|
RSpec/ExpectActual:
|
103
82
|
Exclude:
|
104
|
-
-
|
105
|
-
-
|
83
|
+
- "**/spec/routing/**/*"
|
84
|
+
- "spec/fields/name_spec.rb"
|
106
85
|
|
107
|
-
# Offense count:
|
86
|
+
# Offense count: 39
|
108
87
|
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
|
109
88
|
# Include: **/*_spec*rb*, **/spec/**/*
|
110
|
-
RSpec/
|
89
|
+
RSpec/SpecFilePathSuffix:
|
111
90
|
Enabled: false
|
112
91
|
|
113
|
-
# Offense count:
|
92
|
+
# Offense count: 96
|
114
93
|
# Configuration parameters: AssignmentOnly.
|
115
94
|
RSpec/InstanceVariable:
|
116
95
|
Enabled: false
|
@@ -118,10 +97,10 @@ RSpec/InstanceVariable:
|
|
118
97
|
# Offense count: 2
|
119
98
|
RSpec/IteratedExpectation:
|
120
99
|
Exclude:
|
121
|
-
-
|
122
|
-
-
|
100
|
+
- "spec/helpers/record_helper_spec.rb"
|
101
|
+
- "spec/integration/html_spec.rb"
|
123
102
|
|
124
|
-
# Offense count:
|
103
|
+
# Offense count: 4
|
125
104
|
# Configuration parameters: .
|
126
105
|
# SupportedStyles: have_received, receive
|
127
106
|
RSpec/MessageSpies:
|
@@ -132,7 +111,7 @@ RSpec/MessageSpies:
|
|
132
111
|
RSpec/MultipleMemoizedHelpers:
|
133
112
|
Max: 6
|
134
113
|
|
135
|
-
# Offense count:
|
114
|
+
# Offense count: 8
|
136
115
|
# Configuration parameters: AllowedGroups.
|
137
116
|
RSpec/NestedGroups:
|
138
117
|
Max: 4
|
@@ -140,23 +119,23 @@ RSpec/NestedGroups:
|
|
140
119
|
# Offense count: 1
|
141
120
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
142
121
|
# Configuration parameters: Inferences.
|
143
|
-
|
122
|
+
RSpecRails/InferredSpecType:
|
144
123
|
Exclude:
|
145
|
-
-
|
124
|
+
- "spec/helpers/record_helper_spec.rb"
|
146
125
|
|
147
|
-
# Offense count:
|
126
|
+
# Offense count: 39
|
148
127
|
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
|
149
128
|
# Include: **/*_spec.rb
|
150
129
|
RSpec/SpecFilePathFormat:
|
151
130
|
Enabled: false
|
152
131
|
|
153
|
-
# Offense count:
|
132
|
+
# Offense count: 3
|
154
133
|
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
155
134
|
RSpec/VerifiedDoubles:
|
156
135
|
Exclude:
|
157
|
-
-
|
136
|
+
- "spec/helpers/record_helper_spec.rb"
|
158
137
|
|
159
|
-
# Offense count:
|
138
|
+
# Offense count: 50
|
160
139
|
# Configuration parameters: AllowedConstants.
|
161
140
|
Style/Documentation:
|
162
141
|
Enabled: false
|
@@ -164,22 +143,22 @@ Style/Documentation:
|
|
164
143
|
# Offense count: 4
|
165
144
|
Style/MixinUsage:
|
166
145
|
Exclude:
|
167
|
-
-
|
168
|
-
-
|
169
|
-
-
|
170
|
-
-
|
146
|
+
- "spec/fields/cartographics_spec.rb"
|
147
|
+
- "spec/fields/imprint_spec.rb"
|
148
|
+
- "spec/fields/name_spec.rb"
|
149
|
+
- "spec/fields/subject_spec.rb"
|
171
150
|
|
172
151
|
# Offense count: 1
|
173
152
|
Style/MultilineBlockChain:
|
174
153
|
Exclude:
|
175
|
-
-
|
154
|
+
- "lib/mods_display/fields/imprint.rb"
|
176
155
|
|
177
|
-
# Offense count:
|
156
|
+
# Offense count: 13
|
178
157
|
Style/OpenStructUse:
|
179
158
|
Exclude:
|
180
|
-
-
|
159
|
+
- "spec/helpers/record_helper_spec.rb"
|
181
160
|
|
182
|
-
# Offense count:
|
161
|
+
# Offense count: 46
|
183
162
|
# This cop supports safe autocorrection (--autocorrect).
|
184
163
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
185
164
|
# URISchemes: http, https
|
data/Gemfile
CHANGED
@@ -10,7 +10,7 @@ module ModsDisplay
|
|
10
10
|
next unless subject_element.respond_to?(:cartographics)
|
11
11
|
|
12
12
|
subject_element.cartographics.each do |field|
|
13
|
-
scale = field.scale.empty? ?
|
13
|
+
scale = field.scale.empty? ? nil : element_text(field.scale)
|
14
14
|
projection = field.projection.empty? ? nil : element_text(field.projection)
|
15
15
|
coordinates = field.coordinates.empty? ? nil : element_text(field.coordinates)
|
16
16
|
post_scale = [projection, coordinates].compact.join(' ') if [projection, coordinates].compact.length.positive?
|
@@ -17,7 +17,8 @@ module ModsDisplay
|
|
17
17
|
|
18
18
|
def type_attribute_value(date)
|
19
19
|
if date.is_a?(Stanford::Mods::Imprint::DateRange)
|
20
|
-
|
20
|
+
# Note that a range can be only single ended.
|
21
|
+
date.start&.value&.type || date.stop&.value&.type
|
21
22
|
else
|
22
23
|
date.value.type
|
23
24
|
end
|
@@ -25,7 +25,7 @@ module ModsDisplay
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def geo_extensions
|
28
|
-
@
|
28
|
+
@geo_extensions ||= @stanford_mods_elements.select do |extension_element|
|
29
29
|
displayLabel(extension_element) =~ /^geo:?$/
|
30
30
|
end
|
31
31
|
end
|
@@ -20,7 +20,7 @@ module ModsDisplay
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def to_html(view_context = ApplicationController.renderer)
|
23
|
-
component = ModsDisplay::FieldComponent.with_collection(fields, value_transformer:
|
23
|
+
component = ModsDisplay::FieldComponent.with_collection(fields, value_transformer: lambda(&:to_s))
|
24
24
|
|
25
25
|
view_context.render component, layout: false
|
26
26
|
end
|
@@ -8,14 +8,14 @@ module ModsDisplay
|
|
8
8
|
class NestedRelatedItem < Field
|
9
9
|
include ModsDisplay::RelatedItemConcerns
|
10
10
|
|
11
|
-
def initialize(
|
12
|
-
super(
|
11
|
+
def initialize(related_item_elements, value_renderer: ValueRenderer)
|
12
|
+
super(related_item_elements)
|
13
13
|
@value_renderer = value_renderer
|
14
14
|
end
|
15
15
|
|
16
16
|
def fields
|
17
17
|
@fields ||= begin
|
18
|
-
return_fields = RelatedItemValue.
|
18
|
+
return_fields = RelatedItemValue.for_stanford_mods_elements(@stanford_mods_elements).map do |related_item_element|
|
19
19
|
next if related_item_element.collection?
|
20
20
|
next unless render_nested_related_item?(related_item_element)
|
21
21
|
|
@@ -30,6 +30,20 @@ module ModsDisplay
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
# Used by exhibits
|
34
|
+
def to_html(view_context = ApplicationController.renderer)
|
35
|
+
helpers = view_context.respond_to?(:simple_format) ? view_context : ApplicationController.new.view_context
|
36
|
+
|
37
|
+
component = ModsDisplay::ListFieldComponent.with_collection(
|
38
|
+
fields,
|
39
|
+
value_transformer: ->(value) { helpers.format_mods_html(value.to_s) },
|
40
|
+
list_html_attributes: { class: 'mods_display_nested_related_items' },
|
41
|
+
list_item_html_attributes: { class: 'mods_display_nested_related_item open' }
|
42
|
+
)
|
43
|
+
|
44
|
+
view_context.render component, layout: false
|
45
|
+
end
|
46
|
+
|
33
47
|
# this class provides html markup and is subclassed in purl application
|
34
48
|
class ValueRenderer
|
35
49
|
def initialize(related_item_element)
|
@@ -4,13 +4,13 @@ module ModsDisplay
|
|
4
4
|
class RelatedItem < Field
|
5
5
|
include ModsDisplay::RelatedItemConcerns
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
super(
|
7
|
+
def initialize(related_item_elements, value_renderer: ValueRenderer)
|
8
|
+
super(related_item_elements)
|
9
9
|
@value_renderer = value_renderer
|
10
10
|
end
|
11
11
|
|
12
12
|
def fields
|
13
|
-
return_fields = RelatedItemValue.
|
13
|
+
return_fields = RelatedItemValue.for_stanford_mods_elements(@stanford_mods_elements).map do |related_item_element|
|
14
14
|
next if related_item_element.collection?
|
15
15
|
next if render_nested_related_item?(related_item_element)
|
16
16
|
|
@@ -52,15 +52,13 @@ module ModsDisplay
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def values_from_subjects(element)
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|
55
|
+
selected_subjects(element).map do |child|
|
56
|
+
if element_text(child).include?('--')
|
57
|
+
element_text(child).split('--').map(&:strip)
|
58
|
+
else
|
59
|
+
element_text(child)
|
60
|
+
end
|
62
61
|
end
|
63
|
-
return_values
|
64
62
|
end
|
65
63
|
|
66
64
|
def selected_subjects(element = @value)
|
@@ -56,8 +56,8 @@ module ModsDisplay
|
|
56
56
|
@type_attribute ||= get_attribute('type')
|
57
57
|
end
|
58
58
|
|
59
|
-
def self.
|
60
|
-
|
59
|
+
def self.for_stanford_mods_elements(stanford_mods_elements)
|
60
|
+
stanford_mods_elements.map { |element| new(element) }
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
data/lib/mods_display/version.rb
CHANGED
data/mods_display.gemspec
CHANGED
@@ -31,6 +31,6 @@ Gem::Specification.new do |gem|
|
|
31
31
|
gem.add_development_dependency 'rspec-rails'
|
32
32
|
gem.add_development_dependency 'rubocop'
|
33
33
|
gem.add_development_dependency 'capybara'
|
34
|
-
gem.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '~>
|
34
|
+
gem.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '~> 7.0'
|
35
35
|
gem.add_development_dependency 'combustion', '~> 1.3'
|
36
36
|
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.6.
|
4
|
+
version: 1.6.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:
|
11
|
+
date: 2024-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stanford-mods
|
@@ -148,14 +148,14 @@ dependencies:
|
|
148
148
|
requirements:
|
149
149
|
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
151
|
+
version: '7.0'
|
152
152
|
type: :development
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
156
|
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
158
|
+
version: '7.0'
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
160
|
name: combustion
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
262
|
- !ruby/object:Gem::Version
|
263
263
|
version: '0'
|
264
264
|
requirements: []
|
265
|
-
rubygems_version: 3.
|
265
|
+
rubygems_version: 3.5.15
|
266
266
|
signing_key:
|
267
267
|
specification_version: 4
|
268
268
|
summary: The MODS Display gem allows implementers to configure a customized display
|