|
|
|
<% contentsArray = Array.new %>
|
|
|
|
<% folders.each do |folder| %>
|
|
|
|
<% if Dir.exists? folder %>
|
|
|
|
<% contents = Dir.children("./" + folder).grep(/#{searchquery}/) %>
|
|
|
|
<% if !contents.empty? %>
|
|
|
|
<% contents.each do |content| %>
|
|
|
|
<% if content.end_with?(".erb") || content.end_with?(".md") || content.end_with?(".bb") %>
|
|
|
|
<% if File.exists?("./" + folder + "/" + content + ".meta") %>
|
|
|
|
<% newPage = Page.new(folder + "/" + content, DateTime.parse(File.read("./" + folder + "/" + content + ".meta"), "%Y.%m.%d")) %>
|
|
|
|
<% else %>
|
|
|
|
<% newPage = Page.new(folder + "/" + content, DateTime.parse("1970.01.01", "%Y.%m.%d")) %>
|
|
|
|
<% end %>
|
|
|
|
<% contentsArray.push(newPage) %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<% if contentsArray.empty? %>
|
|
|
|
<%= erb :throwError, locals: {errorcode: "404", error: "No result", errordescriptor: "No pages matching " + searchquery, returntarget: origin} %>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<% contentsArray.sort_by! { |page| page.getdate } %>
|
|
|
|
|
|
|
|
<% contentsArray.reverse.each do |content| %>
|
|
|
|
<% if content.getpath.end_with?(".erb") || content.getpath.end_with?(".md") || content.getpath.end_with?(".bb") %>
|
|
|
|
<%= erb :blogwindow, locals: {file: "./" + content.getpath, date: content.getdate.strftime("%Y.%m.%d")} %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|