diff --git a/announcement.gemspec b/announcement.gemspec index 3f33f56..638b0f3 100644 --- a/announcement.gemspec +++ b/announcement.gemspec @@ -116,9 +116,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_announcement_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