Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 带正则表达式的Nanoc编译规则_Regex_Compilation_Rules_Nanoc - Fatal编程技术网

Regex 带正则表达式的Nanoc编译规则

Regex 带正则表达式的Nanoc编译规则,regex,compilation,rules,nanoc,Regex,Compilation,Rules,Nanoc,我有文件名以controls-开头的文件,例如controls dark.png,但此规则不能捕获它们: compile '/gallery/*/', :rep => :thumbnail do filter :thumbnailize, :width => 200 unless /controls-/.match(item[:filename]) end 为什么这不匹配 因此,最后我将控件变暗.png转换为缩略图,尽管这条规则应该排除它。实际上它正在工作,问题在于路由,所以它

我有文件名以
controls-
开头的文件,例如
controls dark.png
,但此规则不能捕获它们:

compile '/gallery/*/', :rep => :thumbnail do
  filter :thumbnailize, :width => 200 unless /controls-/.match(item[:filename])
end
为什么这不匹配


因此,最后我将
控件变暗.png
转换为缩略图,尽管这条规则应该排除它。

实际上它正在工作,问题在于路由,所以它没有将我的
控件变暗.png
转换为缩略图,只是将其文件名更改为
控制暗缩略图.png

我使用了相同的入住路线,因此:

route '/gallery/*/', :rep => :thumbnail do
unless /controls-/.match(item[:filename])
    item.identifier.chop + '-thumbnail.' + item[:extension]
else
    item.identifier.chop + '.' + item[:extension]
end
现在,文件名中包含
控件-
的文件只会被复制,而不会附加
-thumbnail
后缀