Mercurial Hosting > freedit
changeset 0:6a1e2749571d
start
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 15 Jun 2022 20:18:36 -0600 |
parents | |
children | 7c64173643c8 |
files | .hgignore serve.sh src/index.html.luan src/lib/Forum.luan src/lib/Shared.luan src/site.css |
diffstat | 6 files changed, 79 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
diff -r 000000000000 -r 6a1e2749571d .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Wed Jun 15 20:18:36 2022 -0600 @@ -0,0 +1,3 @@ +syntax: glob + +err
diff -r 000000000000 -r 6a1e2749571d serve.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serve.sh Wed Jun 15 20:18:36 2022 -0600 @@ -0,0 +1,1 @@ +luan luan:http/serve.luan src 2>&1 | tee err
diff -r 000000000000 -r 6a1e2749571d src/index.html.luan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/index.html.luan Wed Jun 15 20:18:36 2022 -0600 @@ -0,0 +1,30 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Shared = require "site:/lib/Shared.luan" +local head = Shared.head or error() +local header = Shared.header or error() +local footer = Shared.footer or error() +local Forum = require "site:/lib/Forum.luan" + + +return function() + Io.stdout = Http.response.text_writer() +%> +<!doctype html> +<html> + <head> +<% head() %> + <title><%=Forum.title%></title> + </head> + <body> +<% header() %> + <div content> + qqq + </div> +<% footer() %> + </body> +</html> +<% +end
diff -r 000000000000 -r 6a1e2749571d src/lib/Forum.luan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/lib/Forum.luan Wed Jun 15 20:18:36 2022 -0600 @@ -0,0 +1,9 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error + + +local Forum = {} + +Forum.title = "forum title not set" + +return Forum
diff -r 000000000000 -r 6a1e2749571d src/lib/Shared.luan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/lib/Shared.luan Wed Jun 15 20:18:36 2022 -0600 @@ -0,0 +1,33 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local Forum = require "site:/lib/Forum.luan" + + +local Shared = {} + +function Shared.head() +%> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <style> + @import "/site.css"; + </style> +<% +end + +function Shared.header() +%> + <div header> + <a href="/"><%=Forum.title%></a> + </div> +<% +end + +function Shared.footer() +%> + <div footer> + <a href="/config.html">Configuration</a> + </div> +<% +end + +return Shared