lib/stanford-mods/searchworks.rb in stanford-mods-1.1.4 vs lib/stanford-mods/searchworks.rb in stanford-mods-1.1.5
- old
+ new
@@ -189,11 +189,11 @@
if outer_node
nonSort = outer_node.nonSort.text.strip.empty? ? nil : outer_node.nonSort.text.strip
end
val = '' + ( sw_full_title ? sw_full_title : '')
- val.sub!(Regexp.new("^" + nonSort), '') if nonSort
+ val.sub!(Regexp.new("^" + Regexp.escape(nonSort)), '') if nonSort
val.gsub!(/[[:punct:]]*/, '').strip
val.squeeze(" ").strip
end
#remove trailing commas
@@ -423,10 +423,10 @@
dates = pub_dates
if dates
year = []
pruned_dates = []
dates.each do |f_date|
- #remove ? and []
+ #remove ? and []
if (f_date.length == 4 && f_date.end_with?('?'))
pruned_dates << f_date.gsub('?','0')
else
pruned_dates << f_date.gsub('?','').gsub('[','').gsub(']','')
end