Little bit of cleaning up code

This commit is contained in:
Simon Kagedal Reimer 2015-03-12 10:39:03 -04:00
parent 68fcc024a4
commit 6a0e2acebd

View File

@ -81,18 +81,16 @@ class Page
@site = site @site = site
@path = path @path = path
canon = canonical relative_path = @path.relative_path_from(@site.pages_dir);
@out_path = @site.output_dir + canon + Pathname("index.html") a = relative_path.each_filename.map do |x|
@url = '/' + canon + '/' x.sub(/^[0-9]*[-_]/, '')
@sort_url = @path.to_s.sub(/\.html$/, '')
end end
a[-1].sub!(/\.html$/, '')
s = a.join('/')
def canonical() @out_path = @site.output_dir + Pathname(s) + Pathname("index.html")
remove_numbers = lambda {|x| x.sub(/^[0-9]*[-_]/, '') } @url = "/#s/"
path = @path.relative_path_from(@site.pages_dir) @sort_url = @path.to_s.sub(/\.html$/, '')
a = path.each_filename.map(&remove_numbers)
a[-1] = a[-1].sub(/\.html$/, '')
a.join('/')
end end
def related_to?(p) def related_to?(p)