stanford-mods 1.1.2 → 1.1.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.
@@ -1,21 +1,23 @@
1
1
  # encoding: UTF-8
2
2
  require 'stanford-mods/searchworks_languages'
3
3
  require 'logger'
4
+ require 'mods'
5
+
4
6
  # SearchWorks specific wranglings of MODS metadata as a mixin to the Stanford::Mods::Record object
5
7
  module Stanford
6
8
  module Mods
7
9
 
8
10
  class Record < ::Mods::Record
9
-
11
+
10
12
  # include langagues known to SearchWorks; try to error correct when possible (e.g. when ISO-639 disagrees with MARC standard)
11
13
  def sw_language_facet
12
14
  result = []
13
- @mods_ng_xml.language.each { |n|
15
+ @mods_ng_xml.language.each { |n|
14
16
  # get languageTerm codes and add their translations to the result
15
- n.code_term.each { |ct|
17
+ n.code_term.each { |ct|
16
18
  if ct.authority.match(/^iso639/)
17
19
  begin
18
- vals = ct.text.split(/[,|\ ]/).reject {|x| x.strip.length == 0 }
20
+ vals = ct.text.split(/[,|\ ]/).reject {|x| x.strip.length == 0 }
19
21
  vals.each do |v|
20
22
  iso639_val = ISO_639.find(v.strip).english_name
21
23
  if SEARCHWORKS_LANGUAGES.has_value?(iso639_val)
@@ -29,14 +31,14 @@ module Stanford
29
31
  p "Couldn't find english name for #{ct.text}"
30
32
  end
31
33
  else
32
- vals = ct.text.split(/[,|\ ]/).reject {|x| x.strip.length == 0 }
34
+ vals = ct.text.split(/[,|\ ]/).reject {|x| x.strip.length == 0 }
33
35
  vals.each do |v|
34
36
  result << SEARCHWORKS_LANGUAGES[v.strip]
35
37
  end
36
38
  end
37
39
  }
38
40
  # add languageTerm text values
39
- n.text_term.each { |tt|
41
+ n.text_term.each { |tt|
40
42
  val = tt.text.strip
41
43
  result << val if val.length > 0 && SEARCHWORKS_LANGUAGES.has_value?(val)
42
44
  }
@@ -48,42 +50,42 @@ module Stanford
48
50
  }
49
51
  result.uniq
50
52
  end # language_facet
51
-
52
-
53
+
54
+
53
55
  # ---- AUTHOR ----
54
-
56
+
55
57
  # @return [String] value for author_1xx_search field
56
58
  def sw_main_author
57
59
  main_author_w_date
58
60
  end
59
-
61
+
60
62
  # @return [Array<String>] values for author_7xx_search field
61
63
  def sw_addl_authors
62
64
  additional_authors_w_dates
63
65
  end
64
-
66
+
65
67
  # @return [Array<String>] values for author_person_facet, author_person_display
66
68
  def sw_person_authors
67
69
  personal_names_w_dates
68
70
  end
69
-
71
+
70
72
  # return the display_value_w_date for all <mods><name> elements that do not have type='personal'
71
73
  # @return [Array<String>] values for author_other_facet
72
74
  def sw_impersonal_authors
73
75
  @mods_ng_xml.plain_name.select {|n| n.type_at != 'personal'}.map { |n| n.display_value_w_date }
74
76
  end
75
-
77
+
76
78
  # @return [Array<String>] values for author_corp_display
77
79
  def sw_corporate_authors
78
80
  val = @mods_ng_xml.plain_name.select {|n| n.type_at == 'corporate'}.map { |n| n.display_value_w_date }
79
81
  val
80
82
  end
81
-
83
+
82
84
  # @return [Array<String>] values for author_meeting_display
83
85
  def sw_meeting_authors
84
86
  @mods_ng_xml.plain_name.select {|n| n.type_at == 'conference'}.map { |n| n.display_value_w_date }
85
87
  end
86
-
88
+
87
89
  # Returns a sortable version of the main_author:
88
90
  # main_author + sorting title
89
91
  # which is the mods approximation of the value created for a marc record
@@ -93,7 +95,7 @@ module Stanford
93
95
  val = '' + (main_author_w_date ? main_author_w_date : "\u{10FFFF} ") + ( sort_title ? sort_title : '')
94
96
  val.gsub(/[[:punct:]]*/, '').strip
95
97
  end
96
-
98
+
97
99
  def main_author_w_date_test
98
100
  result = nil
99
101
  first_wo_role = nil
@@ -102,10 +104,10 @@ module Stanford
102
104
  first_wo_role ||= n
103
105
  end
104
106
  n.role.each { |r|
105
- if r.authority.include?('marcrelator') &&
107
+ if r.authority.include?('marcrelator') &&
106
108
  (r.value.include?('Creator') || r.value.include?('Author'))
107
109
  result ||= n.display_value_w_date
108
- end
110
+ end
109
111
  }
110
112
  }
111
113
  if !result && first_wo_role
@@ -115,29 +117,29 @@ module Stanford
115
117
  end
116
118
 
117
119
  # ---- end AUTHOR ----
118
-
120
+
119
121
  # ---- TITLE ----
120
122
 
121
123
  # @return [String] value for title_245a_search field
122
124
  def sw_short_title
123
125
  short_titles ? short_titles.first : nil
124
126
  end
125
-
127
+
126
128
  # @return [String] value for title_245_search, title_full_display
127
129
  def sw_full_title
128
130
  outer_nodes = @mods_ng_xml.title_info
129
131
  outer_node = outer_nodes ? outer_nodes.first : nil
130
132
  if outer_node
131
133
  nonSort = outer_node.nonSort.text.strip.empty? ? nil : outer_node.nonSort.text.strip
132
- title = outer_node.title.text.strip.empty? ? nil: outer_node.title.text.strip
134
+ title = outer_node.title.text.strip.empty? ? nil : outer_node.title.text.strip
133
135
  preSubTitle = nonSort ? [nonSort, title].compact.join(" ") : title
134
136
  preSubTitle.sub!(/:$/, '') if preSubTitle # remove trailing colon
135
137
 
136
138
  subTitle = outer_node.subTitle.text.strip
137
139
  preParts = subTitle.empty? ? preSubTitle : preSubTitle + " : " + subTitle
138
140
  preParts.sub!(/\.$/, '') if preParts # remove trailing period
139
-
140
- partName = outer_node.partName.text.strip unless outer_node.partName.text.strip.empty?
141
+
142
+ partName = outer_node.partName.text.strip unless outer_node.partName.text.strip.empty?
141
143
  partNumber = outer_node.partNumber.text.strip unless outer_node.partNumber.text.strip.empty?
142
144
  partNumber.sub!(/,$/, '') if partNumber # remove trailing comma
143
145
  if partNumber && partName
@@ -171,13 +173,13 @@ module Stanford
171
173
  end
172
174
  result
173
175
  end
174
-
175
- # this includes all titles except
176
+
177
+ # this includes all titles except
176
178
  # @return [Array<String>] values for title_variant_search
177
179
  def sw_addl_titles
178
180
  full_titles.select { |s| s !~ Regexp.new(Regexp.escape(sw_short_title)) }
179
181
  end
180
-
182
+
181
183
  # Returns a sortable version of the main title
182
184
  # @return [String] value for title_sort field
183
185
  def sw_sort_title
@@ -187,13 +189,13 @@ module Stanford
187
189
  if outer_node
188
190
  nonSort = outer_node.nonSort.text.strip.empty? ? nil : outer_node.nonSort.text.strip
189
191
  end
190
-
192
+
191
193
  val = '' + ( sw_full_title ? sw_full_title : '')
192
194
  val.sub!(Regexp.new("^" + nonSort), '') if nonSort
193
195
  val.gsub!(/[[:punct:]]*/, '').strip
194
196
  val.squeeze(" ").strip
195
197
  end
196
-
198
+
197
199
  #remove trailing commas
198
200
  # @deprecated in favor of sw_title_display
199
201
  def sw_full_title_without_commas
@@ -201,11 +203,11 @@ module Stanford
201
203
  result.sub!(/,$/, '') if result
202
204
  result
203
205
  end
204
-
206
+
205
207
  # ---- end TITLE ----
206
208
 
207
209
  # ---- SUBJECT ----
208
-
210
+
209
211
  # Values are the contents of:
210
212
  # subject/geographic
211
213
  # subject/hierarchicalGeographic
@@ -214,11 +216,11 @@ module Stanford
214
216
  # @return [Array<String>] values for geographic_search Solr field for this document or [] if none
215
217
  def sw_geographic_search(sep = ' ')
216
218
  result = term_values([:subject, :geographic]) || []
217
-
219
+
218
220
  # hierarchicalGeographic has sub elements
219
- @mods_ng_xml.subject.hierarchicalGeographic.each { |hg_node|
221
+ @mods_ng_xml.subject.hierarchicalGeographic.each { |hg_node|
220
222
  hg_vals = []
221
- hg_node.element_children.each { |e|
223
+ hg_node.element_children.each { |e|
222
224
  hg_vals << e.text unless e.text.empty?
223
225
  }
224
226
  result << hg_vals.join(sep) unless hg_vals.empty?
@@ -226,14 +228,14 @@ module Stanford
226
228
 
227
229
  trans_code_vals = @mods_ng_xml.subject.geographicCode.translated_value
228
230
  if trans_code_vals
229
- trans_code_vals.each { |val|
231
+ trans_code_vals.each { |val|
230
232
  result << val if !result.include?(val)
231
233
  }
232
234
  end
233
235
 
234
- result
236
+ result
235
237
  end
236
-
238
+
237
239
  # Values are the contents of:
238
240
  # subject/name/namePart
239
241
  # "Values from namePart subelements should be concatenated in the order they appear (e.g. "Shakespeare, William, 1564-1616")"
@@ -241,13 +243,13 @@ module Stanford
241
243
  # @return [Array<String>] values for names inside subject elements or [] if none
242
244
  def sw_subject_names(sep = ', ')
243
245
  result = []
244
- @mods_ng_xml.subject.name_el.select { |n_el| n_el.namePart }.each { |name_el_w_np|
246
+ @mods_ng_xml.subject.name_el.select { |n_el| n_el.namePart }.each { |name_el_w_np|
245
247
  parts = name_el_w_np.namePart.map { |npn| npn.text unless npn.text.empty? }.compact
246
248
  result << parts.join(sep).strip unless parts.empty?
247
249
  }
248
250
  result
249
251
  end
250
-
252
+
251
253
  # Values are the contents of:
252
254
  # subject/titleInfo/(subelements)
253
255
  # @param [String] sep - the separator string for joining titleInfo sub elements
@@ -260,7 +262,7 @@ module Stanford
260
262
  }
261
263
  result
262
264
  end
263
-
265
+
264
266
  # Values are the contents of:
265
267
  # mods/genre
266
268
  # mods/subject/topic
@@ -279,13 +281,13 @@ module Stanford
279
281
  # subject/title
280
282
  # subject/occupation
281
283
  # with trailing comma, semicolon, and backslash (and any preceding spaces) removed
282
- # @return [Array<String>] values for the topic_facet Solr field for this document or nil if none
284
+ # @return [Array<String>] values for the topic_facet Solr field for this document or nil if none
283
285
  def topic_facet
284
286
  vals = subject_topics ? Array.new(subject_topics) : []
285
287
  vals.concat(subject_names) if subject_names
286
288
  vals.concat(subject_titles) if subject_titles
287
289
  vals.concat(subject_occupations) if subject_occupations
288
- vals.map! { |val|
290
+ vals.map! { |val|
289
291
  v = val.sub(/[\\,;]$/, '')
290
292
  v.strip
291
293
  }
@@ -293,13 +295,13 @@ module Stanford
293
295
  end
294
296
 
295
297
  # geographic_search values with trailing comma, semicolon, and backslash (and any preceding spaces) removed
296
- # @return [Array<String>] values for the geographic_facet Solr field for this document or nil if none
298
+ # @return [Array<String>] values for the geographic_facet Solr field for this document or nil if none
297
299
  def geographic_facet
298
300
  geographic_search.map { |val| val.sub(/[\\,;]$/, '').strip } unless !geographic_search
299
301
  end
300
302
 
301
303
  # subject/temporal values with trailing comma, semicolon, and backslash (and any preceding spaces) removed
302
- # @return [Array<String>] values for the era_facet Solr field for this document or nil if none
304
+ # @return [Array<String>] values for the era_facet Solr field for this document or nil if none
303
305
  def era_facet
304
306
  subject_temporal.map { |val| val.sub(/[\\,;]$/, '').strip } unless !subject_temporal
305
307
  end
@@ -316,7 +318,7 @@ module Stanford
316
318
  # TODO: this should go into stanford-mods ... but then we have to set that gem up with a Logger
317
319
  # print a message for any unrecognized encodings
318
320
  xvals = self.subject.geographicCode.translated_value
319
- codes = self.term_values([:subject, :geographicCode])
321
+ codes = self.term_values([:subject, :geographicCode])
320
322
  if codes && codes.size > xvals.size
321
323
  self.subject.geographicCode.each { |n|
322
324
  if n.authority != 'marcgac' && n.authority != 'marccountry'
@@ -325,7 +327,7 @@ module Stanford
325
327
  }
326
328
  end
327
329
 
328
- # FIXME: stanford-mods should be returning [], not nil ...
330
+ # FIXME: stanford-mods should be returning [], not nil ...
329
331
  return nil if !result || result.empty?
330
332
  result
331
333
  end
@@ -356,14 +358,14 @@ module Stanford
356
358
  vals.concat(gvals) if gvals
357
359
 
358
360
  # print a message for any temporal encodings
359
- self.subject.temporal.each { |n|
361
+ self.subject.temporal.each { |n|
360
362
  sw_logger.info("#{druid} has subject temporal element with untranslated encoding: #{n.to_xml}") if !n.encoding.empty?
361
363
  }
362
364
 
363
365
  vals.empty? ? nil : vals
364
366
  end
365
367
  end
366
-
368
+
367
369
  # Values are the contents of:
368
370
  # all subject subelements except subject/cartographic plus genre top level element
369
371
  # @return [Array<String>] values for the subject_all_search Solr field for this document or nil if none
@@ -388,7 +390,7 @@ module Stanford
388
390
  # @return [String] value for the pub_date_display Solr field for this document or nil if none
389
391
  def pub_date_display
390
392
  return dates_no_marc_encoding.first unless dates_no_marc_encoding.empty?
391
- return dates_marc_encoding.first unless dates_marc_encoding.empty?
393
+ return dates_marc_encoding.first unless dates_marc_encoding.empty?
392
394
  return nil
393
395
  end
394
396
 
@@ -396,18 +398,18 @@ module Stanford
396
398
  # If that doesn't exist, look in the dates without encoding=marc array. Otherwise return nil
397
399
  # @return [Array<String>] values for the date Solr field for this document or nil if none
398
400
  def pub_dates
399
- return dates_marc_encoding unless dates_marc_encoding.empty?
401
+ return dates_marc_encoding unless dates_marc_encoding.empty?
400
402
  return dates_no_marc_encoding unless dates_no_marc_encoding.empty?
401
403
  return nil
402
404
  end
403
-
405
+
404
406
  def is_number?(object)
405
407
  true if Integer(object) rescue false
406
408
  end
407
409
  def is_date?(object)
408
410
  true if Date.parse(object) rescue false
409
411
  end
410
-
412
+
411
413
  # Get the publish year from mods
412
414
  # @return [String] 4 character year or nil if no valid date was found
413
415
  def pub_year
@@ -423,7 +425,7 @@ module Stanford
423
425
  year = []
424
426
  pruned_dates = []
425
427
  dates.each do |f_date|
426
- #remove ? and []
428
+ #remove ? and []
427
429
  pruned_dates << f_date.gsub('?','').gsub('[','').gsub(']','')
428
430
  end
429
431
  #try to find a date starting with the most normal date formats and progressing to more wonky ones
@@ -444,7 +446,7 @@ module Stanford
444
446
  @pub_year=''
445
447
  return nil
446
448
  end
447
-
449
+
448
450
  #creates a date suitable for sorting. Guarnteed to be 4 digits or nil
449
451
  def pub_date_sort
450
452
  pd=nil
@@ -455,20 +457,16 @@ module Stanford
455
457
  end
456
458
  pd=pd.gsub('--','00')
457
459
  end
458
- raise "pub_date_sort was about to return a non 4 digit value #{pd}!" if pd and pd.length !=4
460
+ raise "pub_date_sort was about to return a non 4 digit value #{pd}!" if pd and pd.length !=4
459
461
  pd
460
462
  end
461
-
463
+
462
464
  #The year the object was published, , filtered based on max_pub_date and min_pub_date from the config file
463
465
  #@return [String] 4 character year or nil
464
466
  def pub_date
465
- val=pub_year
466
- if val
467
- return val
468
- end
469
- nil
467
+ pub_year || nil
470
468
  end
471
-
469
+
472
470
  #Values for the pub date facet. This is less strict than the 4 year date requirements for pub_date
473
471
  #@return <Array[String]> with values for the pub date facet
474
472
  def pub_date_facet
@@ -488,13 +486,13 @@ module Stanford
488
486
  nil
489
487
  end
490
488
  end
491
-
489
+
492
490
  # ---- end PUBLICATION (place, year) ----
493
491
 
494
492
  def sw_logger
495
493
  @logger ||= Logger.new(STDOUT)
496
494
  end
497
-
495
+
498
496
  # select one or more format values from the controlled vocabulary here:
499
497
  # http://searchworks-solr-lb.stanford.edu:8983/solr/select?facet.field=format&rows=0&facet.sort=index
500
498
  # @return <Array[String]> value in the SearchWorks controlled vocabulary
@@ -526,8 +524,8 @@ module Stanford
526
524
  when 'text'
527
525
  val << 'Book' if issuance and issuance.include? 'monographic'
528
526
  book_genres = ['book chapter', 'Book chapter', 'Book Chapter',
529
- 'issue brief', 'Issue brief', 'Issue Brief',
530
- 'librettos', 'Librettos',
527
+ 'issue brief', 'Issue brief', 'Issue Brief',
528
+ 'librettos', 'Librettos',
531
529
  'project report', 'Project report', 'Project Report',
532
530
  'technical report', 'Technical report', 'Technical Report',
533
531
  'working paper', 'Working paper', 'Working Paper']
@@ -555,6 +553,19 @@ module Stanford
555
553
  def format_main
556
554
  val = []
557
555
  types = self.term_values(:typeOfResource)
556
+ article_genres = ['article', 'Article',
557
+ 'book chapter', 'Book chapter', 'Book Chapter',
558
+ 'issue brief', 'Issue brief', 'Issue Brief',
559
+ 'project report', 'Project report', 'Project Report',
560
+ 'student project report', 'Student project report', 'Student Project report', 'Student Project Report',
561
+ 'technical report', 'Technical report', 'Technical Report',
562
+ 'working paper', 'Working paper', 'Working Paper'
563
+ ]
564
+ book_genres = ['conference publication', 'Conference publication', 'Conference Publication',
565
+ 'instruction', 'Instruction',
566
+ 'librettos', 'Librettos',
567
+ 'thesis', 'Thesis'
568
+ ]
558
569
  if types
559
570
  genres = self.term_values(:genre)
560
571
  issuance = self.term_values([:origin_info,:issuance])
@@ -581,22 +592,9 @@ module Stanford
581
592
  when 'still image'
582
593
  val << 'Image'
583
594
  when 'text'
584
- article_genres = ['article', 'Article',
585
- 'book chapter', 'Book chapter', 'Book Chapter',
586
- 'issue brief', 'Issue brief', 'Issue Brief',
587
- 'project report', 'Project report', 'Project Report',
588
- 'student project report', 'Student project report', 'Student Project report', 'Student Project Report',
589
- 'technical report', 'Technical report', 'Technical Report',
590
- 'working paper', 'Working paper', 'Working Paper'
591
- ]
592
- val << 'Book' if genres and !(genres & article_genres).empty?
595
+ val << 'Book' if genres and !(genres & article_genres).empty?
593
596
  val << 'Book' if issuance and issuance.include? 'monographic'
594
- book_genres = ['conference publication', 'Conference publication', 'Conference Publication',
595
- 'instruction', 'Instruction',
596
- 'librettos', 'Librettos',
597
- 'thesis', 'Thesis'
598
- ]
599
- val << 'Book' if genres and !(genres & book_genres).empty?
597
+ val << 'Book' if genres and !(genres & book_genres).empty?
600
598
  val << 'Journal/Periodical' if issuance and issuance.include? 'continuing'
601
599
  when 'three dimensional object'
602
600
  val << 'Object'
@@ -671,13 +669,13 @@ module Stanford
671
669
  def subject_topics
672
670
  @subject_topics ||= self.term_values([:subject, :topic])
673
671
  end
674
-
672
+
675
673
  #get a 4 digit year like 1865 from the date array
676
674
  def get_plain_four_digit_year dates
677
675
  dates.each do |f_date|
678
676
  matches=f_date.scan(/\d{4}/)
679
677
  if matches.length == 1
680
- @pub_year=matches.first
678
+ @pub_year=matches.first
681
679
  return matches.first
682
680
  else
683
681
  #if there are multiples, check for ones with CE after them
@@ -687,15 +685,15 @@ module Stanford
687
685
  pos = pos ? pos.to_i : 0
688
686
  if f_date.include?(match+' CE') or pos > 0
689
687
  @pub_year=match
690
- return match
691
- end
688
+ return match
689
+ end
692
690
  end
693
691
  return matches.first
694
692
  end
695
693
  end
696
694
  return nil
697
695
  end
698
-
696
+
699
697
  # If a year has a "u" in it, replace instances of u with 0
700
698
  # @param [String] dates
701
699
  # @return String
@@ -714,7 +712,7 @@ module Stanford
714
712
  end
715
713
  return nil
716
714
  end
717
-
715
+
718
716
  #get a double digit century like '12th century' from the date array
719
717
  def get_double_digit_century dates
720
718
  dates.each do |f_date|
@@ -732,13 +730,13 @@ module Stanford
732
730
  if f_date.include?(match+' CE') or pos > 0
733
731
  @pub_year=((match[0,2].to_i) - 1).to_s+'--'
734
732
  return @pub_year
735
- end
733
+ end
736
734
  end
737
735
  end
738
736
  end
739
737
  return nil
740
738
  end
741
-
739
+
742
740
  #get a 3 digit year like 965 from the date array
743
741
  def get_three_digit_year dates
744
742
  dates.each do |f_date|
@@ -753,14 +751,14 @@ module Stanford
753
751
  def get_bc_year dates
754
752
  dates.each do |f_date|
755
753
  matches=f_date.scan(/\d{3} B.C./)
756
- if matches.length > 0
754
+ if matches.length > 0
757
755
  bc_year=matches.first[0..2]
758
756
  return (bc_year.to_i-1000).to_s
759
757
  end
760
758
  end
761
759
  return nil
762
760
  end
763
-
761
+
764
762
  #get a single digit century like '9th century' from the date array
765
763
  def get_single_digit_century dates
766
764
  dates.each do |f_date|
@@ -778,10 +776,10 @@ module Stanford
778
776
  if f_date.include?(match+' CE') or pos > 0
779
777
  @pub_year=((match[0,1].to_i) - 1).to_s+'--'
780
778
  return @pub_year
781
- end
779
+ end
782
780
  end
783
781
  end
784
- end
782
+ end
785
783
  return nil
786
784
  end
787
785
 
@@ -801,7 +799,7 @@ module Stanford
801
799
  end
802
800
  end
803
801
 
804
- # Populate @dates_marc_encoding and @dates_no_marc_encoding from dateIssued and dateCreated tags from origin_info
802
+ # Populate @dates_marc_encoding and @dates_no_marc_encoding from dateIssued and dateCreated tags from origin_info
805
803
  # with and without encoding=marc
806
804
  def parse_dates_from_originInfo
807
805
  @dates_marc_encoding = []
@@ -1,6 +1,6 @@
1
1
  module Stanford
2
2
  module Mods
3
3
  # this is the Ruby Gem version
4
- VERSION = "1.1.2"
4
+ VERSION = "1.1.3"
5
5
  end
6
6
  end
data/lib/stanford-mods.rb CHANGED
@@ -7,11 +7,11 @@ module Stanford
7
7
  module Mods
8
8
 
9
9
  class Record < ::Mods::Record
10
-
10
+
11
11
  # the first encountered <mods><name> element with marcrelator flavor role of 'Creator' or 'Author'.
12
12
  # if no marcrelator 'Creator' or 'Author', the first name without a role.
13
13
  # if no name without a role, then nil
14
- # @return [String] a name in the display_value_w_date form
14
+ # @return [String] a name in the display_value_w_date form
15
15
  # see Mods::Record.name in nom_terminology for details on the display_value algorithm
16
16
  def main_author_w_date
17
17
  result = nil
@@ -21,10 +21,10 @@ module Stanford
21
21
  first_wo_role ||= n
22
22
  end
23
23
  n.role.each { |r|
24
- if r.authority.include?('marcrelator') &&
24
+ if r.authority.include?('marcrelator') &&
25
25
  (r.value.include?('Creator') || r.value.include?('Author'))
26
26
  result ||= n.display_value_w_date
27
- end
27
+ end
28
28
  }
29
29
  }
30
30
  if !result && first_wo_role
@@ -32,19 +32,19 @@ module Stanford
32
32
  end
33
33
  result
34
34
  end # main_author
35
-
35
+
36
36
  # all names, in display form, except the main_author
37
37
  # names will be the display_value_w_date form
38
38
  # see Mods::Record.name in nom_terminology for details on the display_value algorithm
39
39
  def additional_authors_w_dates
40
40
  results = []
41
- @mods_ng_xml.plain_name.each { |n|
41
+ @mods_ng_xml.plain_name.each { |n|
42
42
  results << n.display_value_w_date
43
43
  }
44
44
  results.delete(main_author_w_date)
45
45
  results
46
46
  end
47
-
47
+
48
48
  end # Record class
49
49
  end # Mods module
50
50
  end # Stanford module