summaryrefslogtreecommitdiff
path: root/lib/page_index.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/page_index.rb')
-rw-r--r--lib/page_index.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/page_index.rb b/lib/page_index.rb
index 43bf367..31d4682 100644
--- a/lib/page_index.rb
+++ b/lib/page_index.rb
@@ -28,13 +28,15 @@ class IndexPage < LocalPage
@ls ||= Dir::entries(local_infile)
.select{|fname|not fname.start_with?(".")}
.map{|fname|"#{local_infile}/#{fname}"}
- .select{|path|Dir::exist?(path) or Config::get.html_suffixes.include?(File::extname(path).gsub(/^[.]/, ''))}
end
def index_pages
if @pages.nil?
@pages = Set[]
for path in _ls
- @pages.add( Dir::exist?(path) ? IndexPage::new(path) : LocalPage::new(path) )
+ page = LocalPage::load(path)
+ unless page.nil?
+ @pages.add(page)
+ end
end
for data in (_metadata['external'] || [])
@pages.add(RemotePage::new(data))
@@ -57,9 +59,9 @@ class IndexPage < LocalPage
def index_link(cururl, depth)
ret = ''
unless depth <= 1
- ret += "<h#{depth}>[#{atom_title}](#{cururl.route_to(url)})</h#{depth}>\n\n"
+ ret += "<section><h#{depth}>[#{atom_title}](#{cururl.route_to(url)})</h#{depth}>\n\n"
end
- for page in index_pages.select{|page|not page.is_a?(IndexPage)}.sort_by{|page|page.atom_published}
+ for page in index_pages.select{|page|not page.is_a?(IndexPage)}.sort_by{|page|page.atom_updated}.reverse
ret += page.index_link(cururl, depth+1)
end
ret += "\n"
@@ -67,6 +69,9 @@ class IndexPage < LocalPage
ret += page.index_link(cururl, depth+1)
end
ret += "\n"
+ unless depth <= 1
+ ret += "</section>\n\n"
+ end
return ret.gsub(/\n\n+/, "\n\n")
end
def index_title