aboutsummaryrefslogtreecommitdiff
path: root/navbar.etlua
diff options
context:
space:
mode:
Diffstat (limited to 'navbar.etlua')
-rw-r--r--navbar.etlua25
1 files changed, 25 insertions, 0 deletions
diff --git a/navbar.etlua b/navbar.etlua
new file mode 100644
index 0000000..368ea10
--- /dev/null
+++ b/navbar.etlua
@@ -0,0 +1,25 @@
+<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) %>
+ <% print("sections:",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>