pennmarc 1.2.22 → 1.3.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 +4 -4
- data/.rubocop_todo.yml +15 -45
- data/Gemfile.lock +83 -64
- data/lib/pennmarc/helpers/creator.rb +30 -0
- data/lib/pennmarc/helpers/location.rb +1 -1
- data/lib/pennmarc/helpers/relation.rb +0 -10
- data/lib/pennmarc/util.rb +1 -1
- data/lib/pennmarc/version.rb +1 -1
- data/spec/lib/pennmarc/helpers/creator_spec.rb +66 -0
- data/spec/lib/pennmarc/helpers/relation_spec.rb +0 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce41a1f1d20b337d09c9efe7864702f2991fea918aadfaf2094e9a87c1291e47
|
4
|
+
data.tar.gz: 1b65ac76d70e6e9e6b9bf5c60d7bd9cfa3b352a2292486fb7e1668662bf81d9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c094891accf90519201927873b4e711b649efee1ab191118d541b9a733ecb573b1c0719306c1a958056f461947279312bed0b4950438bf23c91c437b7c251e7
|
7
|
+
data.tar.gz: c5578566958775705e86f5be697558468a061e089a361ab1629fa4aaa45758d1fb56970c6651a0bcbd5539c71e6802c61bc2b88b1ade7953ba06a395e2f9d442
|
data/.rubocop_todo.yml
CHANGED
@@ -1,20 +1,12 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 10000`
|
3
|
-
# on
|
3
|
+
# on 2025-08-15 20:13:24 UTC using RuboCop version 1.79.2.
|
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:
|
10
|
-
# This cop supports safe autocorrection (--autocorrect).
|
11
|
-
# Configuration parameters: Severity, Include.
|
12
|
-
# Include: **/*.gemspec
|
13
|
-
Gemspec/RequireMFA:
|
14
|
-
Exclude:
|
15
|
-
- 'pennmarc.gemspec'
|
16
|
-
|
17
|
-
# Offense count: 26
|
9
|
+
# Offense count: 27
|
18
10
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
19
11
|
Metrics/AbcSize:
|
20
12
|
Exclude:
|
@@ -31,18 +23,17 @@ Metrics/AbcSize:
|
|
31
23
|
- 'lib/pennmarc/helpers/title.rb'
|
32
24
|
- 'lib/pennmarc/util.rb'
|
33
25
|
|
34
|
-
# Offense count:
|
26
|
+
# Offense count: 5
|
35
27
|
# Configuration parameters: CountComments, Max, CountAsOne.
|
36
28
|
Metrics/ClassLength:
|
37
29
|
Exclude:
|
38
30
|
- 'lib/pennmarc/helpers/creator.rb'
|
39
31
|
- 'lib/pennmarc/helpers/format.rb'
|
40
|
-
- 'lib/pennmarc/helpers/production.rb'
|
41
32
|
- 'lib/pennmarc/helpers/series.rb'
|
42
33
|
- 'lib/pennmarc/helpers/subject.rb'
|
43
34
|
- 'lib/pennmarc/helpers/title.rb'
|
44
35
|
|
45
|
-
# Offense count:
|
36
|
+
# Offense count: 21
|
46
37
|
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
47
38
|
Metrics/CyclomaticComplexity:
|
48
39
|
Exclude:
|
@@ -59,18 +50,16 @@ Metrics/CyclomaticComplexity:
|
|
59
50
|
- 'lib/pennmarc/helpers/title.rb'
|
60
51
|
- 'lib/pennmarc/util.rb'
|
61
52
|
|
62
|
-
# Offense count:
|
53
|
+
# Offense count: 17
|
63
54
|
# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
|
64
55
|
Metrics/MethodLength:
|
65
56
|
Exclude:
|
66
57
|
- 'lib/pennmarc/helpers/creator.rb'
|
67
|
-
- 'lib/pennmarc/helpers/date.rb'
|
68
58
|
- 'lib/pennmarc/helpers/edition.rb'
|
69
59
|
- 'lib/pennmarc/helpers/format.rb'
|
70
60
|
- 'lib/pennmarc/helpers/location.rb'
|
71
61
|
- 'lib/pennmarc/helpers/note.rb'
|
72
62
|
- 'lib/pennmarc/helpers/production.rb'
|
73
|
-
- 'lib/pennmarc/helpers/relation.rb'
|
74
63
|
- 'lib/pennmarc/helpers/series.rb'
|
75
64
|
- 'lib/pennmarc/helpers/subject.rb'
|
76
65
|
- 'lib/pennmarc/helpers/title.rb'
|
@@ -81,7 +70,7 @@ Metrics/ModuleLength:
|
|
81
70
|
Exclude:
|
82
71
|
- 'lib/pennmarc/util.rb'
|
83
72
|
|
84
|
-
# Offense count:
|
73
|
+
# Offense count: 16
|
85
74
|
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
86
75
|
Metrics/PerceivedComplexity:
|
87
76
|
Exclude:
|
@@ -96,52 +85,33 @@ Metrics/PerceivedComplexity:
|
|
96
85
|
- 'lib/pennmarc/helpers/title.rb'
|
97
86
|
- 'lib/pennmarc/util.rb'
|
98
87
|
|
99
|
-
# Offense count: 4
|
100
|
-
# This cop supports safe autocorrection (--autocorrect).
|
101
|
-
# Configuration parameters: EnforcedStyle, BlockForwardingName.
|
102
|
-
# SupportedStyles: anonymous, explicit
|
103
|
-
Naming/BlockForwarding:
|
104
|
-
Exclude:
|
105
|
-
- 'lib/pennmarc/util.rb'
|
106
|
-
|
107
88
|
# Offense count: 1
|
108
|
-
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
|
109
|
-
# NamePrefix: is_, has_, have_
|
110
|
-
# ForbiddenPrefixes: is_, has_, have_
|
89
|
+
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
|
90
|
+
# NamePrefix: is_, has_, have_, does_
|
91
|
+
# ForbiddenPrefixes: is_, has_, have_, does_
|
111
92
|
# AllowedMethods: is_a?
|
112
93
|
# MethodDefinitionMacros: define_method, define_singleton_method
|
113
|
-
Naming/
|
94
|
+
Naming/PredicatePrefix:
|
114
95
|
Exclude:
|
115
96
|
- 'lib/pennmarc/helpers/relation.rb'
|
116
97
|
|
117
98
|
# Offense count: 1
|
118
99
|
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
119
100
|
# SupportedStyles: snake_case, normalcase, non_integer
|
120
|
-
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
|
101
|
+
# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
|
121
102
|
Naming/VariableNumber:
|
122
103
|
Exclude:
|
123
104
|
- 'lib/pennmarc/util.rb'
|
124
105
|
|
125
|
-
# Offense count:
|
106
|
+
# Offense count: 2
|
126
107
|
# Configuration parameters: Max, CountAsOne.
|
127
108
|
RSpec/ExampleLength:
|
128
109
|
Exclude:
|
129
|
-
- 'spec/lib/pennmarc/helpers/creator_spec.rb'
|
130
|
-
- 'spec/lib/pennmarc/helpers/note_spec.rb'
|
131
|
-
- 'spec/lib/pennmarc/helpers/production_spec.rb'
|
132
110
|
- 'spec/lib/pennmarc/marc_util_spec.rb'
|
133
111
|
|
134
112
|
# Offense count: 1
|
135
|
-
# Configuration parameters: Include, CustomTransform, IgnoreMethods,
|
136
|
-
# Include: **/*_spec
|
137
|
-
RSpec/
|
113
|
+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
|
114
|
+
# Include: **/*_spec.rb
|
115
|
+
RSpec/SpecFilePathFormat:
|
138
116
|
Exclude:
|
139
117
|
- 'spec/lib/pennmarc/parser_spec.rb'
|
140
|
-
|
141
|
-
# Offense count: 27
|
142
|
-
# Configuration parameters: Max, AllowedGroups.
|
143
|
-
RSpec/NestedGroups:
|
144
|
-
Exclude:
|
145
|
-
- 'spec/lib/pennmarc/helpers/access_spec.rb'
|
146
|
-
- 'spec/lib/pennmarc/helpers/format_spec.rb'
|
147
|
-
- 'spec/lib/pennmarc/helpers/location_spec.rb'
|
data/Gemfile.lock
CHANGED
@@ -1,86 +1,106 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (7.
|
5
|
-
|
4
|
+
activesupport (7.2.2.2)
|
5
|
+
base64
|
6
|
+
benchmark (>= 0.3)
|
7
|
+
bigdecimal
|
8
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
9
|
+
connection_pool (>= 2.2.5)
|
10
|
+
drb
|
6
11
|
i18n (>= 1.6, < 2)
|
12
|
+
logger (>= 1.4.2)
|
7
13
|
minitest (>= 5.1)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
14
|
+
securerandom (>= 0.3)
|
15
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
16
|
+
ast (2.4.3)
|
17
|
+
base64 (0.3.0)
|
18
|
+
benchmark (0.4.1)
|
19
|
+
bigdecimal (3.2.2)
|
20
|
+
concurrent-ruby (1.3.5)
|
21
|
+
connection_pool (2.5.3)
|
22
|
+
diff-lcs (1.6.2)
|
12
23
|
docile (1.4.0)
|
13
|
-
|
24
|
+
drb (2.2.3)
|
25
|
+
i18n (1.14.7)
|
14
26
|
concurrent-ruby (~> 1.0)
|
15
|
-
json (2.
|
27
|
+
json (2.13.2)
|
28
|
+
language_server-protocol (3.17.0.5)
|
16
29
|
lcsort (0.9.1)
|
17
30
|
library_stdnums (1.6.0)
|
18
|
-
|
31
|
+
lint_roller (1.1.0)
|
32
|
+
logger (1.7.0)
|
33
|
+
marc (1.3.0)
|
34
|
+
nokogiri (~> 1.0)
|
19
35
|
rexml
|
20
|
-
|
21
|
-
|
22
|
-
minitest (5.18.0)
|
23
|
-
nokogiri (1.18.5-arm64-darwin)
|
36
|
+
minitest (5.25.5)
|
37
|
+
nokogiri (1.18.9-arm64-darwin)
|
24
38
|
racc (~> 1.4)
|
25
|
-
nokogiri (1.18.
|
39
|
+
nokogiri (1.18.9-x64-mingw-ucrt)
|
26
40
|
racc (~> 1.4)
|
27
|
-
nokogiri (1.18.
|
41
|
+
nokogiri (1.18.9-x86_64-darwin)
|
28
42
|
racc (~> 1.4)
|
29
|
-
nokogiri (1.18.
|
43
|
+
nokogiri (1.18.9-x86_64-linux-gnu)
|
30
44
|
racc (~> 1.4)
|
31
|
-
parallel (1.
|
32
|
-
parser (3.
|
45
|
+
parallel (1.27.0)
|
46
|
+
parser (3.3.9.0)
|
33
47
|
ast (~> 2.4.1)
|
48
|
+
racc
|
49
|
+
prism (1.4.0)
|
34
50
|
racc (1.8.1)
|
35
|
-
rack (3.0
|
51
|
+
rack (3.2.0)
|
36
52
|
rainbow (3.1.1)
|
37
|
-
rake (13.0
|
38
|
-
regexp_parser (2.
|
39
|
-
rexml (3.
|
40
|
-
rspec (3.
|
41
|
-
rspec-core (~> 3.
|
42
|
-
rspec-expectations (~> 3.
|
43
|
-
rspec-mocks (~> 3.
|
44
|
-
rspec-core (3.
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-expectations (3.
|
53
|
+
rake (13.3.0)
|
54
|
+
regexp_parser (2.11.2)
|
55
|
+
rexml (3.4.1)
|
56
|
+
rspec (3.13.1)
|
57
|
+
rspec-core (~> 3.13.0)
|
58
|
+
rspec-expectations (~> 3.13.0)
|
59
|
+
rspec-mocks (~> 3.13.0)
|
60
|
+
rspec-core (3.13.5)
|
61
|
+
rspec-support (~> 3.13.0)
|
62
|
+
rspec-expectations (3.13.5)
|
47
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-mocks (3.
|
64
|
+
rspec-support (~> 3.13.0)
|
65
|
+
rspec-mocks (3.13.5)
|
50
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.
|
52
|
-
rspec-support (3.
|
53
|
-
rubocop (1.
|
67
|
+
rspec-support (~> 3.13.0)
|
68
|
+
rspec-support (3.13.4)
|
69
|
+
rubocop (1.79.2)
|
54
70
|
json (~> 2.3)
|
71
|
+
language_server-protocol (~> 3.17.0.2)
|
72
|
+
lint_roller (~> 1.1.0)
|
55
73
|
parallel (~> 1.10)
|
56
|
-
parser (>= 3.
|
74
|
+
parser (>= 3.3.0.2)
|
57
75
|
rainbow (>= 2.2.2, < 4.0)
|
58
|
-
regexp_parser (>=
|
59
|
-
|
60
|
-
rubocop-ast (>= 1.28.0, < 2.0)
|
76
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
77
|
+
rubocop-ast (>= 1.46.0, < 2.0)
|
61
78
|
ruby-progressbar (~> 1.7)
|
62
|
-
unicode-display_width (>= 2.4.0, <
|
63
|
-
rubocop-ast (1.
|
64
|
-
parser (>= 3.
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
rubocop (~> 1.
|
69
|
-
rubocop-performance (1.
|
70
|
-
|
71
|
-
rubocop
|
72
|
-
|
79
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
80
|
+
rubocop-ast (1.46.0)
|
81
|
+
parser (>= 3.3.7.2)
|
82
|
+
prism (~> 1.4)
|
83
|
+
rubocop-capybara (2.22.1)
|
84
|
+
lint_roller (~> 1.1)
|
85
|
+
rubocop (~> 1.72, >= 1.72.1)
|
86
|
+
rubocop-performance (1.25.0)
|
87
|
+
lint_roller (~> 1.1)
|
88
|
+
rubocop (>= 1.75.0, < 2.0)
|
89
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
90
|
+
rubocop-rails (2.33.3)
|
73
91
|
activesupport (>= 4.2.0)
|
92
|
+
lint_roller (~> 1.1)
|
74
93
|
rack (>= 1.1)
|
75
|
-
rubocop (>= 1.
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
rubocop (
|
80
|
-
|
81
|
-
|
94
|
+
rubocop (>= 1.75.0, < 2.0)
|
95
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
96
|
+
rubocop-rake (0.7.1)
|
97
|
+
lint_roller (~> 1.1)
|
98
|
+
rubocop (>= 1.72.1)
|
99
|
+
rubocop-rspec (3.6.0)
|
100
|
+
lint_roller (~> 1.1)
|
101
|
+
rubocop (~> 1.72, >= 1.72.1)
|
82
102
|
ruby-progressbar (1.13.0)
|
83
|
-
|
103
|
+
securerandom (0.4.1)
|
84
104
|
simplecov (0.22.0)
|
85
105
|
docile (~> 1.1)
|
86
106
|
simplecov-html (~> 0.11)
|
@@ -89,19 +109,18 @@ GEM
|
|
89
109
|
simplecov_json_formatter (0.1.4)
|
90
110
|
tzinfo (2.0.6)
|
91
111
|
concurrent-ruby (~> 1.0)
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
rubocop (~> 1.24)
|
112
|
+
unicode-display_width (3.1.5)
|
113
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
114
|
+
unicode-emoji (4.0.4)
|
115
|
+
upennlib-rubocop (1.3.0)
|
116
|
+
rubocop (~> 1.72)
|
98
117
|
rubocop-capybara
|
99
118
|
rubocop-performance
|
100
119
|
rubocop-rails
|
101
120
|
rubocop-rake
|
102
121
|
rubocop-rspec
|
103
122
|
webrick (1.8.1)
|
104
|
-
yard (0.9.
|
123
|
+
yard (0.9.37)
|
105
124
|
|
106
125
|
PLATFORMS
|
107
126
|
arm64-darwin-21
|
@@ -85,6 +85,36 @@ module PennMARC
|
|
85
85
|
creators.to_h { |h| [h[:show], h[:facet]] }
|
86
86
|
end
|
87
87
|
|
88
|
+
# Show more credited authors - both 100 field and 700 entries where the relator term is aut
|
89
|
+
# @param record [MARC::Record]
|
90
|
+
# @return [Array<String>] array of author/creator values for display
|
91
|
+
def extended_show(record, relator_map: Mappers.relator)
|
92
|
+
fields = record.fields(%w[100 700])
|
93
|
+
fields.filter_map { |field|
|
94
|
+
# for 700 entries, only include ones with relator code of aut
|
95
|
+
next if (field.tag == '700') && field['4']&.downcase != 'aut'
|
96
|
+
|
97
|
+
parse_show_value(field, relator_map: relator_map)
|
98
|
+
}.uniq
|
99
|
+
end
|
100
|
+
|
101
|
+
# Hash with extended creators show values as the fields and the corresponding facet as the values.
|
102
|
+
# Only include 100, and 700 with relator of aut
|
103
|
+
# @param record [MARC::Record]
|
104
|
+
# @param relator_map [Hash]
|
105
|
+
# @return [Hash]
|
106
|
+
def extended_show_facet_map(record, relator_map: Mappers.relator)
|
107
|
+
creators = record.fields(%w[100 700]).filter_map do |field|
|
108
|
+
# for 700 entries, only include ones with relator code of aut
|
109
|
+
next if (field.tag == '700') && field['4']&.downcase != 'aut'
|
110
|
+
|
111
|
+
show = parse_show_value(field, relator_map: relator_map)
|
112
|
+
facet = parse_facet_value(field, FACET_SOURCE_MAP[field.tag.to_i].chars)
|
113
|
+
{ show: show, facet: facet }
|
114
|
+
end
|
115
|
+
creators.to_h { |h| [h[:show], h[:facet]] }
|
116
|
+
end
|
117
|
+
|
88
118
|
# Returns the list of authors with name (subfield $a) only
|
89
119
|
# @param record [MARC::Record]
|
90
120
|
# @param main_tags_only [Boolean] only use TAGS; otherwise use both TAGS and CONTRIBUTOR_TAGS
|
@@ -42,7 +42,7 @@ module PennMARC
|
|
42
42
|
# @return [Array<String>]
|
43
43
|
def location(record:, display_value:, location_map:)
|
44
44
|
# get enriched marc location tag and relevant subfields
|
45
|
-
enriched_location_tag_and_subfields(record) => {tag:, location_code_sf:, call_num_sf:, call_num_type_sf:}
|
45
|
+
enriched_location_tag_and_subfields(record) => { tag:, location_code_sf:, call_num_sf:, call_num_type_sf: }
|
46
46
|
|
47
47
|
record.fields(tag).flat_map { |field|
|
48
48
|
field.filter_map { |subfield|
|
@@ -5,8 +5,6 @@ module PennMARC
|
|
5
5
|
# records.
|
6
6
|
class Relation < Helper
|
7
7
|
class << self
|
8
|
-
CHRONOLOGY_PREFIX = 'CHR'
|
9
|
-
|
10
8
|
RELATED_WORK_FIELDS = %w[700 710 711 730].freeze
|
11
9
|
CONTAINS_FIELDS = %w[700 710 711 730 740].freeze
|
12
10
|
|
@@ -21,14 +19,6 @@ module PennMARC
|
|
21
19
|
}.uniq
|
22
20
|
end
|
23
21
|
|
24
|
-
# Get "chronology" information from specially-prefixed 650 (subject) fields
|
25
|
-
# @todo why do we stuff chronology data in a 650 field?
|
26
|
-
# @param record [MARC::Record]
|
27
|
-
# @return [Array] array of chronology values
|
28
|
-
def chronology_show(record)
|
29
|
-
prefixed_subject_and_alternate(record, CHRONOLOGY_PREFIX)
|
30
|
-
end
|
31
|
-
|
32
22
|
# Get notes for Related Collections from {https://www.oclc.org/bibformats/en/5xx/544.html MARC 544}.
|
33
23
|
# @param record [MARC::Record]
|
34
24
|
# @return [Array]
|
data/lib/pennmarc/util.rb
CHANGED
@@ -269,7 +269,7 @@ module PennMARC
|
|
269
269
|
mapping[relator_code&.to_sym]
|
270
270
|
end
|
271
271
|
|
272
|
-
# Get 650 & 880 for Provenance
|
272
|
+
# Get 650 & 880 for Provenance: prefix should be 'PRO' or 'CHR' and may be preceded by a '%'
|
273
273
|
# @note 11/2018: do not display $5 in PRO or CHR subjs
|
274
274
|
# @param record [MARC::Record]
|
275
275
|
# @param prefix [String] prefix to select from subject field
|
data/lib/pennmarc/version.rb
CHANGED
@@ -93,6 +93,52 @@ describe 'PennMARC::Creator' do
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
+
describe '.extended_show' do
|
97
|
+
let(:record) { marc_record fields: fields }
|
98
|
+
|
99
|
+
context 'with a single author record' do
|
100
|
+
let(:fields) do
|
101
|
+
[marc_field(tag: '100', subfields: { a: 'Surname, Name', '0': 'http://cool.uri/12345', d: '1900-2000',
|
102
|
+
e: 'author.', '4': 'http://cool.uri/vocabulary/relators/aut' }),
|
103
|
+
marc_field(tag: '880', subfields: { a: 'Surname, Alternative', '6': '100' })]
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'returns single author values with no URIs anywhere (the same as show)' do
|
107
|
+
values = helper.extended_show(record)
|
108
|
+
expect(values).to contain_exactly 'Surname, Name 1900-2000, author.'
|
109
|
+
expect(values.join.downcase).not_to include 'http'
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context 'with author records in 100 and 700' do
|
114
|
+
let(:fields) do
|
115
|
+
[marc_field(tag: '100', subfields: { a: 'Surname, Name', '0': 'http://cool.uri/12345', d: '1900-2000',
|
116
|
+
e: 'author.', '4': 'http://cool.uri/vocabulary/relators/aut' }),
|
117
|
+
marc_field(tag: '700', subfields: { a: 'Surname, Alternative', e: 'author', '6': '100', '4': 'aut' }),
|
118
|
+
marc_field(tag: '700', subfields: { a: 'Surname, Not Included', '6': '100', '4': 'edt' })]
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'returns two authors' do
|
122
|
+
values = helper.extended_show(record)
|
123
|
+
expect(values).to contain_exactly 'Surname, Name 1900-2000, author.', 'Surname, Alternative, Author.'
|
124
|
+
expect(values.join.downcase).not_to include 'http'
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
context 'with no 100 or 700 fields' do
|
129
|
+
let(:fields) do
|
130
|
+
[marc_field(tag: '110', subfields: { a: 'Group of People', b: 'Annual Meeting', '4': 'aut' }),
|
131
|
+
marc_field(tag: '880', subfields: { '6': '110', a: 'Alt. Group Name', b: 'Alt. Annual Meeting' })]
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'returns empty' do
|
135
|
+
values = helper.extended_show(record, relator_map: mapping)
|
136
|
+
expect(values).to be_empty
|
137
|
+
expect(values.join.downcase).not_to include 'http'
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
96
142
|
describe '.authors_list' do
|
97
143
|
let(:record) { marc_record fields: fields }
|
98
144
|
|
@@ -198,6 +244,26 @@ describe 'PennMARC::Creator' do
|
|
198
244
|
end
|
199
245
|
end
|
200
246
|
|
247
|
+
describe '.extended_show_facet_map' do
|
248
|
+
let(:record) do
|
249
|
+
marc_record fields: [
|
250
|
+
marc_field(tag: '100', subfields: { a: 'Surname, Name', '0': 'http://cool.uri/12345', d: '1900-2000',
|
251
|
+
e: 'author.', '4': 'http://cool.uri/vocabulary/relators/aut' }),
|
252
|
+
marc_field(tag: '700', subfields: { a: 'Group of People', b: 'Annual Meeting', '4': 'aut' }),
|
253
|
+
marc_field(tag: '700', subfields: { a: 'Second Group of People', b: 'Meeting', '4': 'aut' }),
|
254
|
+
marc_field(tag: '700', subfields: { a: 'Ignore (not author)', '4': 'edt' }),
|
255
|
+
marc_field(tag: '880', subfields: { a: 'Ignore', '6': '100' })
|
256
|
+
]
|
257
|
+
end
|
258
|
+
|
259
|
+
it 'returns expected hash' do
|
260
|
+
values = helper.extended_show_facet_map(record, relator_map: mapping)
|
261
|
+
expect(values).to eq({ 'Surname, Name 1900-2000, author.' => 'Surname, Name 1900-2000',
|
262
|
+
'Group of People Annual Meeting, Author.' => 'Group of People Annual Meeting',
|
263
|
+
'Second Group of People Meeting, Author.' => 'Second Group of People Meeting' })
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
201
267
|
describe '.show_aux' do
|
202
268
|
let(:record) { marc_record fields: fields }
|
203
269
|
|
@@ -16,20 +16,6 @@ describe 'PennMARC::Relation' do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
describe '.chronology_show' do
|
20
|
-
let(:fields) do
|
21
|
-
[marc_field(tag: '650', indicator2: '4', subfields: { a: 'CHR Heading' }),
|
22
|
-
marc_field(tag: '650', indicator2: '4', subfields: { a: 'Regular Local Heading' }),
|
23
|
-
marc_field(tag: '650', indicator2: '1', subfields: { a: 'LoC Heading' }),
|
24
|
-
marc_field(tag: '880', indicator2: '4', subfields: { '6': '650', a: 'CHR Alt. Heading' }),
|
25
|
-
marc_field(tag: '880', indicator2: '4', subfields: { '6': '999', a: 'Another Alt.' })]
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'returns only the specified subfield data and linked alternate field with CHR prefix removed' do
|
29
|
-
expect(helper.chronology_show(record)).to eq ['Heading', 'Alt. Heading']
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
19
|
describe '.related_collections_show' do
|
34
20
|
let(:fields) do
|
35
21
|
[marc_field(tag: '544', subfields: { d: 'Penn Papers', c: 'USA' }),
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pennmarc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Kanning
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2025-
|
15
|
+
date: 2025-08-21 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|