Mercurial Hosting > luan
view blog/src/index.html.luan @ 604:b73f005f3735 0.13
table constructor now uses end_of_line as a delimiter
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 24 Nov 2015 16:29:27 -0700 |
parents | 50540f0813e2 |
children | ca169567ce07 |
line wrap: on
line source
local Luan = require "luan:Luan" local error = Luan.error local ipairs = Luan.ipairs or error() local Time = require "luan:Time" local Io = require "luan:Io" local Http = require "luan:http/Http" local Post = require "site:/lib/Post" return function() local query = Http.request.parameter.query Io.stdout = Http.response.text_writer() %> <html> <head> <style> @import "/site.css"; </style> </head> <body> <h1><a href="/">Demo Blog App</a></h1> <form> <input name=query type=text value="<%= query or "" %>"> <input type=submit value=Search> </form> <div><a href="new">Make New Post</a></div> <% local posts = query and Post.search(query) or Post.get_all() for _, post in ipairs(posts) do %> <a name="p<%= post.id %>"> <h2><%= post.subject %></h2> <p><%= Time.format(post.date) %> - <a href="edit?post=<%= post.id %>">Edit</a></p> <pre><%= post.content %></pre> <hr> <% end %> </body> </html> <% end