annotate src/lib/Shared.luan @ 0:fddd11ae516c

start
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 23 Oct 2024 13:13:07 -0600
parents
children b116b6ef07bf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 local ipairs = Luan.ipairs or error()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 local Shared = {}
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 function Shared.head()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 <meta name="viewport" content="width=device-width, initial-scale=1">
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 <style>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 @import "/site.css";
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 </style>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 <%
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 end
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 local function header(crumbs)
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 <div header>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 <a href="/">Reactionary Chat</a>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 <% for _, crumb in ipairs(crumbs or {}) do %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 / <%=crumb%>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 <% end %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 </div>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 <%
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 end
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 Shared.header = header
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 function Shared.private_header()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 header{
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 [[<a href="/private/">private</a>]]
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 [[<a href="/private/tools/">tools</a>]]
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 }
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 end
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 return Shared