diff --git a/gallery.gemspec b/gallery.gemspec index 29882bb..06ba66e 100644 --- a/gallery.gemspec +++ b/gallery.gemspec @@ -26,9 +26,10 @@ if bundle_update_flag update_flag = false last_index = widget_info[-1]["filename"].match(/\d+/)[0].to_i rescue nil if !last_index.nil? + idx_regex = /^(\d+[\. \t]*)|[ \t]+$/ default_gallery_widget_info.each do |h| - name_without_index = h["name"]["zh_tw"].sub(/\d+/,'') - widget_info_index = (widget_info.index{|hh| hh["name"]["zh_tw"].include?(name_without_index)} rescue -1) + name_without_index = h["name"]["zh_tw"].gsub(idx_regex,'') + widget_info_index = (widget_info.index{|hh| hh["name"]["zh_tw"].gsub(idx_regex,'') == name_without_index}||-1 rescue -1) if (widget_info_index == -1 || widget_info_index.nil?) update_flag = true copy_h = h.dup