提交 b2d94322 编写于 作者: X Xavier Noria

fixes a couple of regexps, the suite showed warnings about them

A couple of things worth mentioning here:

 - "{" is a metacharacter, should be escaped
   if it is meant to match a "{". The code
   worked, though, because the regexp engine
   is tolerant to this, but issued warnings.

 - gsub accepts a string as first argument.
   That's the best idiom to use when your
   pattern has no metacharacters, since gsub
   interprets the string as an exact substring
   to look for, rather than a regexp. The
   benefit is that your pattern is crystal
   clear and needs no backslashes.
上级 cc6fa2f4
...@@ -157,8 +157,8 @@ def build_query(path, exts) ...@@ -157,8 +157,8 @@ def build_query(path, exts)
query.gsub!(/\:#{ext}/, "{#{variants.compact.uniq.join(',')}}") query.gsub!(/\:#{ext}/, "{#{variants.compact.uniq.join(',')}}")
} }
query.gsub!(/\.{html,/, ".{html,text.html,") query.gsub!('.{html,', '.{html,text.html,')
query.gsub!(/\.{text,/, ".{text,text.plain,") query.gsub!('.{text,', '.{text,text.plain,')
File.expand_path(query, @path) File.expand_path(query, @path)
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册