%- simple_files = @files.select { |f| f.text? } %>
<%- if defined?(current) -%>
<%- dir = current.full_name[%r{\A[^/]+(?=/)}] || current.page_name -%>
<%- end -%>
<%- unless simple_files.empty? then -%>
Pages
<%- simple_files.group_by do |f| -%>
<%- f.full_name[%r{\A[^/]+(?=/)}] || f.page_name -%>
<%- end.each do |n, files| -%>
<%- f = files.shift -%>
<%- if files.empty? -%>
- <%= h f.page_name %>
<%- next -%>
<%- end -%>
open<% end %>><%
if n == f.page_name
%><%= h n %><%
else
%><%= h n %><% files.unshift(f)
end %>
<%- end -%>
<%- end -%>