2014-07-28 03:58:17 +02:00
|
|
|
require "pathname"
|
|
|
|
|
2013-10-09 12:30:53 +02:00
|
|
|
module SassHelpers
|
|
|
|
def page_title
|
|
|
|
title = "Sass: "
|
|
|
|
if data.page.title
|
|
|
|
title << data.page.title
|
|
|
|
else
|
2014-07-28 10:39:37 +02:00
|
|
|
title << "Syntactically Awesome Style Sheets"
|
2013-10-09 12:30:53 +02:00
|
|
|
end
|
|
|
|
title
|
|
|
|
end
|
|
|
|
|
|
|
|
def copyright_years(start_year)
|
|
|
|
end_year = Date.today.year
|
|
|
|
if start_year == end_year
|
|
|
|
start_year.to_s
|
|
|
|
else
|
2014-07-28 03:58:17 +02:00
|
|
|
start_year.to_s + '–' + end_year.to_s
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def pages_for_group(group_name)
|
|
|
|
group = data.nav.find do |g|
|
|
|
|
g.name == group_name
|
|
|
|
end
|
|
|
|
|
|
|
|
pages = []
|
|
|
|
|
|
|
|
return pages unless group
|
|
|
|
|
|
|
|
if group.directory
|
|
|
|
pages << sitemap.resources.select { |r|
|
|
|
|
r.path.match(%r{^#{group.directory}}) && !r.data.hidden
|
|
|
|
}.map do |r|
|
|
|
|
::Middleman::Util.recursively_enhance({
|
|
|
|
:title => r.data.title,
|
|
|
|
:path => r.url
|
|
|
|
})
|
|
|
|
end.sort_by { |p| p.title }
|
2013-10-09 12:30:53 +02:00
|
|
|
end
|
2014-07-28 03:58:17 +02:00
|
|
|
|
|
|
|
pages << group.pages if group.pages
|
|
|
|
|
|
|
|
pages.flatten
|
2013-10-09 12:30:53 +02:00
|
|
|
end
|
|
|
|
end
|