lib/stanford-mods/searchworks.rb in stanford-mods-1.0.0 vs lib/stanford-mods/searchworks.rb in stanford-mods-1.0.1
- old
+ new
@@ -149,20 +149,27 @@
end
parts.sub!(/\.$/, '') if parts
result = parts ? preParts + ". " + parts : preParts
result += "." if !result.match(/[[:punct:]]$/)
+ result.strip!
result = nil if result.empty?
result
else
nil
end
end
-
+
+ # like sw_full_title without trailing \,/;:.
+ # spec from solrmarc-sw sw_index.properties
+ # title_display = custom, removeTrailingPunct(245abdefghijklmnopqrstuvwxyz, [\\\\,/;:], ([A-Za-z]{4}|[0-9]{3}|\\)|\\,))
# @return [String] value for title_display (like title_full_display without trailing punctuation)
def sw_title_display
result = sw_full_title ? sw_full_title : nil
- result.sub!(/[[:punct:]]$/, '') if result
+ if result
+ result.sub!(/[\.,;:\/\\]+$/, '')
+ result.strip!
+ end
result
end
# this includes all titles except
# @return [Array<String>] values for title_variant_search