Html 处理标记文件的Nanoc规则
我当前的规则文件如下所示:Html 处理标记文件的Nanoc规则,html,ruby,markdown,nanoc,Html,Ruby,Markdown,Nanoc,我当前的规则文件如下所示: #!/usr/bin/env ruby ### COMPILATION RULES # Don’t filter or layout assets compile %r{^/(favicon|robots|crypto/.*|stylesheets/.*|javascript/.*|plugins/.*|fonts/.*|images/.*|photos/.*|keybase.txt)/$} do end # compile '/' do # filter
#!/usr/bin/env ruby
### COMPILATION RULES
# Don’t filter or layout assets
compile %r{^/(favicon|robots|crypto/.*|stylesheets/.*|javascript/.*|plugins/.*|fonts/.*|images/.*|photos/.*|keybase.txt)/$} do
end
# compile '/' do
# filter :erb
# layout 'default'
# end
compile '*' do
if item.binary?
# don’t filter binary items
else
layout item[:layout] || 'default'
end
end
# Sitemap, RSS feed, and htaccess get filtered with erb, but get no layout.
compile %r{^/(sitemap|htaccess|feed|card|identity)/$} do
filter :erb
end
# Songs get rendered in the music player
compile %r{^/music/.*/$} do
filter :erb
layout 'player'
end
compile '*' do
case item[:extension]
when 'md'
filter :kramdown
when 'html'
filter :erb
end
layout 'default'
end
route '/photos/*/', :rep => :thumbnail do
item.identifier.chop + '-thumbnail.' + item[:extension]
end
route %r{^/(favicon|robots|sitemap|crypto/.*|stylesheets/.*|javascript/.*|plugins/.*|fonts/.*|images/.*|photos/.*)/$} do
ext = item[:extension]
item.identifier.chop + '.' + ext
end
route '*' do
item.identifier + 'index.html'
end
layout '*', :erb
我想用降价而不是html来编写未来的文件。但是,规则文件似乎没有正确的规则来处理它。以降价方式编写的所有内容看起来都像一个文本转储
我缺少什么?看起来您有两个
为同一模式编译
规则('*'
)。只有第一个将被执行,而另一个将被默默忽略
您应该重新组织规则,以便与特定项匹配的第一个编译
规则就是您希望为其执行的规则
例如,在我自己的规则
文件中,我有这样的安排:
compile '/**/*.md' do
filter :kramdown
end
compile '/**/*' do
write item.identifier.to_s
end
编译“/***.md”do
过滤器:克拉姆敦
结束
编译“/***”do
将item.identifier.写入\u
结束
换句话说,从开始的更具体的规则到结束的更一般的规则。看起来您有两个
为相同的模式编译规则('*'
)。只有第一个将被执行,而另一个将被默默忽略
您应该重新组织规则,以便与特定项匹配的第一个编译
规则就是您希望为其执行的规则
例如,在我自己的规则
文件中,我有这样的安排:
compile '/**/*.md' do
filter :kramdown
end
compile '/**/*' do
write item.identifier.to_s
end
编译“/***.md”do
过滤器:克拉姆敦
结束
编译“/***”do
将item.identifier.写入\u
结束
换句话说,从开始的更具体的规则到结束的更一般的规则。的确,Nanoc会默默地忽略未使用的规则。虽然没有问题,但可能会产生误导;我为此()创建了一个GitHub问题,以使类似的情况更容易检测和解决。虽然没有问题,但可能会产生误导;我为此()创建了一个GitHub问题,以使类似这样的情况更容易检测和解决。