master
muflax 2012-02-06 06:10:28 +01:00
parent 5555ecb943
commit a7069debfb
3 changed files with 7 additions and 4 deletions

View File

@ -2,8 +2,7 @@
<!-- find category index -->
<% cat_match = %r{^/#{@category}/}
cat_index = @site.printed_items.find{|i| i.path.match(cat_match) and i[:is_category]} %>
<% cat_index = @site.printed_items.find{|i| i.is_category? @category and i[:is_category]} %>
<!-- header -->
@ -12,7 +11,7 @@ cat_index = @site.printed_items.find{|i| i.path.match(cat_match) and i[:is_categ
<!-- find items in category -->
<% items = @site.printed_items.select do |i|
i.path.match cat_match and
i.is_category? @category and
not i[:is_category] and
not i.draft? # hide drafts, but make them reachable
end %>

View File

@ -26,6 +26,10 @@ class Nanoc3::Item
def article?
not self[:is_category] and not draft? and cognitive?
end
def is_category? category
!!path.match(%r{^/#{category}/})
end
end
class Nanoc3::Site

View File

@ -35,6 +35,6 @@ class Nanoc3::Item
def mindkiller?
topics = %w{history}
!!self[:mindkiller] || !!path.match(%r{^/(#{topics.join("|")})/})
!!self[:mindkiller] || !!topics.select{|t| is_category? t}
end
end