From 9b4c7b3fdc26440b5482951b3ea92901d10c619a Mon Sep 17 00:00:00 2001 From: nixel2007 Date: Wed, 4 Mar 2015 00:15:45 +0300 Subject: [PATCH] Adds escaping in {change} find --- scripts/copy-i18n-tags.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/copy-i18n-tags.coffee b/scripts/copy-i18n-tags.coffee index 2003b7bff..3cf407004 100644 --- a/scripts/copy-i18n-tags.coffee +++ b/scripts/copy-i18n-tags.coffee @@ -45,7 +45,8 @@ for file in dir when not (file in ['locale.coffee', 'en.coffee']) if commentsMap[enCat]? and commentsMap[enCat][enTag]? comment = " \##{commentsMap[enCat][enTag]}" - if fileSource.search(new RegExp("#? #{enTag}: \"#{tag}\".*\{change\}.*")) >= 0 and comment.search(/.*\{change\}/) < 0 + escapedTag = tag.replace /[-\/\\^$*+?.()|[\]{}]/g, "\\$&" + if fileSource.search(new RegExp("#? #{enTag}: \"#{escapedTag}\".*\{change\}.*")) >= 0 and comment.search(/.*\{change\}/) < 0 comment = " \#" + comment if comment is "" comment = comment + " {change}"