62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/mods_display/fields/imprint.rb', line 62
def place_terms(element)
return [] unless element.respond_to?(:place) &&
element.place.respond_to?(:placeTerm)
if unencoded_place_terms?(element)
element.xpath('mods:place/mods:placeTerm', mods: MODS_NS).select do |term|
!term.attributes['type'].respond_to?(:value) ||
term.attributes['type'].value == 'text'
end.compact
else
element.xpath('mods:place/mods:placeTerm', mods: MODS_NS).map do |term|
next unless term.attributes['type'].respond_to?(:value) &&
term.attributes['type'].value == 'code' &&
term.attributes['authority'].respond_to?(:value) &&
term.attributes['authority'].value == 'marccountry' &&
country_codes.include?(term.text.strip)
term = term.clone
term.content = country_codes[term.text.strip]
term
end.compact
end
end
|