blob: 21192f7ef19ecb91ce51170da4aed759487aea54 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
return [[
<nav>
<% local sorted_headers = {} %>
<% for name,_ in pairs(headers) do %>
<% table.insert(sorted_headers, name) %>
<% end %>
<% table.sort(sorted_headers) %>
<% for _,header in pairs(sorted_headers) do %>
<% local sections = headers[header] %>
<h3><%- header %></h3>
<% local sorted_sections = {} %>
<% local section_map = {} %>
<% for _,section in pairs(sections) do %>
<% table.insert(sorted_sections, section.name) %>
<% section_map[section.name] = section %>
<% end %>
<% table.sort(sorted_sections) %>
<ol>
<% for _,sectionname in ipairs(sorted_sections) do %>
<% local section = section_map[sectionname] %>
<li><a href="<%- section.name %>.html"><%- section.name %></a></li>
<% end %>
</ol>
<% end %>
</nav>
]]
|