pennmarc 1.2.21 → 1.3.0
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 +31 -35
- 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 +3 -3
- 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: 6f422c1bb424ebc17da2ba97c65d4e248b6704be27a6f0a5fbc6d871e17c995e
|
4
|
+
data.tar.gz: cdf55d046c6ea17d28393c1d9b1b3bf8803d6435a53db34d3e824494d09f7b4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c166a340a11acbabb7fed4b5ae05f20490e41d00783e03032516bcd5ef6bda4db764160379a5d617bbcee3d8adbc067a6288e68d3e2de9fdbb94b4468f1971a1
|
7
|
+
data.tar.gz: 50dbc268e26a309062d811b336566ea61c5062725af13c14482ab31a8f91bb2ed2fa5b1f1d2b4c5e408b6104da6a871482778775a359d90396263c0548a193cc
|
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
|
@@ -1,25 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module PennMARC
|
4
|
-
# Do Creator & Author field processing. Main methods pull from 110 and 111 fields.
|
5
|
-
# return data structures intended for generating "search" links, but some of the split subfield parsing remains from
|
6
|
-
# ported methods in case we need to replicate that functionality.
|
4
|
+
# Do Creator & Author field processing. Main methods pull from 110 and 111 fields.
|
7
5
|
# @todo can there ever be multiple 100 fields?
|
8
6
|
# can ǂe and ǂ4 both be used at the same time? seems to result in duplicate values
|
9
7
|
class Creator < Helper
|
10
8
|
# Main tags for Author/Creator information
|
11
9
|
TAGS = %w[100 110].freeze
|
12
10
|
|
11
|
+
# For creator fields intended for display, these subfields are ignored
|
12
|
+
DISPLAY_EXCLUDED_SUBFIELDS = %w[a 0 1 4 5 6 8 t].freeze
|
13
|
+
|
14
|
+
# For creator fields intended for searching, these subfields are ignored
|
15
|
+
SEARCH_EXCLUDED_SUBFIELDS = %w[a 1 4 5 6 8 t].freeze
|
16
|
+
|
13
17
|
# Aux tags for Author/Creator information, for use in search_aux method
|
14
18
|
AUX_TAGS = %w[100 110 111 400 410 411 700 710 711 800 810 811].freeze
|
15
19
|
|
16
20
|
CONFERENCE_SEARCH_TAGS = %w[111 711 811].freeze
|
17
21
|
CORPORATE_SEARCH_TAGS = %w[110 710 810].freeze
|
18
22
|
|
19
|
-
# subfields NOT to join when combining raw subfield values
|
20
|
-
NAME_EXCLUDED_SUBFIELDS = %w[a 1 4 5 6 8 t].freeze
|
21
|
-
|
22
23
|
CONTRIBUTOR_TAGS = %w[700 710].freeze
|
24
|
+
CONTRIBUTOR_DISPLAY_SUBFIELDS = %w[a b c d j q u 3].freeze
|
23
25
|
|
24
26
|
FACET_SOURCE_MAP = {
|
25
27
|
100 => 'abcdjq', 110 => 'abcdjq', 111 => 'abcen',
|
@@ -28,14 +30,12 @@ module PennMARC
|
|
28
30
|
}.freeze
|
29
31
|
|
30
32
|
class << self
|
31
|
-
# Author/Creator search field
|
33
|
+
# Author/Creator search field, from tags
|
32
34
|
# {https://www.oclc.org/bibformats/en/1xx/100.html 100 Main Entry--Personal Name} and
|
33
|
-
# {https://www.oclc.org/bibformats/en/1xx/110.html 110 Main Entry--Corporate Name}.
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
# @todo shouldn't indicator1 tell us the order of the name? do we not trust the indicator?
|
38
|
-
# @note ported from get_author_creator_1_search_values
|
35
|
+
# {https://www.oclc.org/bibformats/en/1xx/110.html 110 Main Entry--Corporate Name}. Includes subfield values
|
36
|
+
# except for those in the {DISPLAY_EXCLUDED_SUBFIELDS} constant. Maps any relator codes found in ǂ4. To better
|
37
|
+
# handle name searches, returns names as both "First Last" and "Last, First" if a comma is found in ǂa. Also
|
38
|
+
# indexes any linked values in the 880.
|
39
39
|
# @param record [MARC::Record]
|
40
40
|
# @param relator_map [Hash]
|
41
41
|
# @return [Array<String>] array of author/creator values for indexing
|
@@ -49,18 +49,18 @@ module PennMARC
|
|
49
49
|
# {https://www.loc.gov/marc/bibliographic/bd700.html MARC 700},
|
50
50
|
# {https://www.loc.gov/marc/bibliographic/bd710.html MARC 710},
|
51
51
|
# and {https://www.loc.gov/marc/bibliographic/bd711.html MARC 711}. The 800, 810 and 8111 tags are similar in
|
52
|
-
# theme to the 7xx fields but apply to serial records.
|
53
|
-
#
|
52
|
+
# theme to the 7xx fields but apply to serial records. Includes all subfield values except those in the
|
53
|
+
# {SEARCH_EXCLUDED_SUBFIELDS} constant.
|
54
54
|
# @param record [MARC::Record]
|
55
55
|
# @return [Array<String>] array of extended author/creator values for indexing
|
56
56
|
def search_aux(record, relator_map: Mappers.relator)
|
57
57
|
name_search_values record: record, tags: AUX_TAGS, relator_map: relator_map
|
58
58
|
end
|
59
59
|
|
60
|
-
# Retrieve creator values for display from fields {https://www.loc.gov/marc/bibliographic/bd100.html 100}
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# If there are no valid encoded relators, uses the value found in $e.
|
60
|
+
# Retrieve creator values for display from fields {https://www.loc.gov/marc/bibliographic/bd100.html 100},
|
61
|
+
# {https://www.loc.gov/marc/bibliographic/bd110.html 110} and their linked alternates. First, join each subfield
|
62
|
+
# value except for those defined in the {DISPLAY_EXCLUDED_SUBFIELDS} constant. Then, appends any encoded relators
|
63
|
+
# found in $4. If there are no valid encoded relators, uses the value found in $e.
|
64
64
|
# @param record [MARC::Record]
|
65
65
|
# @return [Array<String>] array of author/creator values for display
|
66
66
|
def show(record, relator_map: Mappers.relator)
|
@@ -91,13 +91,7 @@ module PennMARC
|
|
91
91
|
# @param first_initial_only [Boolean] only use the first initial instead of first name
|
92
92
|
# @return [Array<String>] names of the authors
|
93
93
|
def authors_list(record, main_tags_only: false, first_initial_only: false)
|
94
|
-
|
95
|
-
TAGS
|
96
|
-
else
|
97
|
-
TAGS + CONTRIBUTOR_TAGS
|
98
|
-
end
|
99
|
-
|
100
|
-
fields = record.fields(tags)
|
94
|
+
fields = record.fields(main_tags_only ? TAGS : TAGS + CONTRIBUTOR_TAGS)
|
101
95
|
fields.filter_map { |field|
|
102
96
|
if field['a'].present?
|
103
97
|
name = trim_trailing(:comma, field['a'])
|
@@ -164,7 +158,7 @@ module PennMARC
|
|
164
158
|
}.uniq
|
165
159
|
end
|
166
160
|
|
167
|
-
# Author/Creator sort. Does not map
|
161
|
+
# Author/Creator sort. Does not map or include any relator codes.
|
168
162
|
# @todo This includes any URI from ǂ0 which could help to disambiguate in sorts, but ǂ1 is excluded...
|
169
163
|
# @note ported from get_author_creator_sort_values
|
170
164
|
# @param record [MARC::Record]
|
@@ -177,8 +171,6 @@ module PennMARC
|
|
177
171
|
# Author/Creator for faceting. Grabs values from a plethora of fields, joins defined subfields, then trims some
|
178
172
|
# punctuation (@see Util.trim_punctuation)
|
179
173
|
# @todo should trim_punctuation apply to each subfield value, or the joined values? i think the joined values
|
180
|
-
# @note ported from author_creator_xfacet2_input - is this the best choice? check the copyField declarations -
|
181
|
-
# franklin uses author_creator_f
|
182
174
|
# @param record [MARC::Record]
|
183
175
|
# @return [Array<String>] array of author/creator values for faceting
|
184
176
|
def facet(record)
|
@@ -267,7 +259,7 @@ module PennMARC
|
|
267
259
|
|
268
260
|
# Retrieve contributor values for display from fields {https://www.oclc.org/bibformats/en/7xx/700.html 700}
|
269
261
|
# and {https://www.oclc.org/bibformats/en/7xx/710.html 710} and their linked alternates. Joins subfields
|
270
|
-
#
|
262
|
+
# defined in {CONTRIBUTOR_DISPLAY_SUBFIELDS}, then appends resulting string with any encoded relationships
|
271
263
|
# found in $4. If there are no valid encoded relationships, uses the value found in $e.
|
272
264
|
# @note legacy version returns array of hash objects including data for display link
|
273
265
|
# @param record [MARC::Record]
|
@@ -281,7 +273,7 @@ module PennMARC
|
|
281
273
|
if vernacular
|
282
274
|
fields += record.fields('880').select { |f| subfield_value?(f, '6', /^(#{CONTRIBUTOR_TAGS.join('|')})/) }
|
283
275
|
end
|
284
|
-
sf = name_only ? %w[a] :
|
276
|
+
sf = name_only ? %w[a] : CONTRIBUTOR_DISPLAY_SUBFIELDS
|
285
277
|
fields.filter_map { |field|
|
286
278
|
next if indicator_2_options.exclude?(field.indicator2) && field.tag.in?(CONTRIBUTOR_TAGS)
|
287
279
|
next if subfield_defined? field, 'i'
|
@@ -299,11 +291,11 @@ module PennMARC
|
|
299
291
|
# @return [Array<String>] name values from given tags
|
300
292
|
def name_search_values(record:, tags:, relator_map:)
|
301
293
|
acc = record.fields(tags).filter_map do |field|
|
302
|
-
name_from_main_entry field, relator_map, should_convert_name_order: false
|
294
|
+
name_from_main_entry field, relator_map, should_convert_name_order: false, for_display: false
|
303
295
|
end
|
304
296
|
|
305
297
|
acc += record.fields(tags).filter_map do |field|
|
306
|
-
name_from_main_entry field, relator_map, should_convert_name_order: true
|
298
|
+
name_from_main_entry field, relator_map, should_convert_name_order: true, for_display: false
|
307
299
|
end
|
308
300
|
|
309
301
|
acc += record.fields(['880']).filter_map do |field|
|
@@ -323,15 +315,17 @@ module PennMARC
|
|
323
315
|
# @param field [MARC::Field]
|
324
316
|
# @param mapping [Hash]
|
325
317
|
# @param should_convert_name_order [Boolean]
|
318
|
+
# @param for_display [Boolean]
|
326
319
|
# @return [String] joined subfield values for value from field
|
327
|
-
def name_from_main_entry(field, mapping, should_convert_name_order: false)
|
320
|
+
def name_from_main_entry(field, mapping, should_convert_name_order: false, for_display: true)
|
321
|
+
subfield_exclude_spec = for_display ? DISPLAY_EXCLUDED_SUBFIELDS : SEARCH_EXCLUDED_SUBFIELDS
|
328
322
|
relator_term_sf = relator_term_subfield(field)
|
329
323
|
name = field.filter_map { |sf|
|
330
324
|
if sf.code == 'a'
|
331
325
|
should_convert_name_order ? convert_name_order(sf.value) : trim_trailing(:comma, sf.value)
|
332
326
|
elsif sf.code == relator_term_sf
|
333
327
|
next
|
334
|
-
elsif
|
328
|
+
elsif subfield_exclude_spec.exclude?(sf.code)
|
335
329
|
sf.value
|
336
330
|
end
|
337
331
|
}.join(' ')
|
@@ -341,6 +335,8 @@ module PennMARC
|
|
341
335
|
relator_term_sf: relator_term_sf,
|
342
336
|
relator_map: mapping)
|
343
337
|
|
338
|
+
return name_and_relator unless for_display
|
339
|
+
|
344
340
|
name_and_relator + (%w[. -].member?(name_and_relator.last) ? '' : '.')
|
345
341
|
end
|
346
342
|
|
@@ -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
@@ -52,8 +52,8 @@ describe 'PennMARC::Creator' do
|
|
52
52
|
it 'contains the expected search_aux field values for a single author work' do
|
53
53
|
expect(helper.search_aux(record, relator_map: mapping)).to contain_exactly(
|
54
54
|
'Author Fancy active 24th century AD, Author.',
|
55
|
-
'Author, Added
|
56
|
-
'Added Author
|
55
|
+
'Author, Added',
|
56
|
+
'Added Author',
|
57
57
|
'Alt Author Alt Fanciness',
|
58
58
|
'Alt Added Author'
|
59
59
|
)
|
@@ -328,7 +328,7 @@ describe 'PennMARC::Creator' do
|
|
328
328
|
describe '.conference_show' do
|
329
329
|
let(:record) do
|
330
330
|
marc_record fields: [
|
331
|
-
marc_field(tag: '111', subfields: { a: 'MARC History Symposium', '4': 'aut' }),
|
331
|
+
marc_field(tag: '111', subfields: { a: 'MARC History Symposium', '0': 'http://cool.uri/12345', '4': 'aut' }),
|
332
332
|
marc_field(tag: '880', subfields: { a: 'Alt. MARC History Symposium', '6': '111' })
|
333
333
|
]
|
334
334
|
end
|
@@ -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.0
|
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-15 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|