comparison website/src/examples/hi2_simply_html.luan @ 388:12ee9a336b95

add more examples
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 23 Apr 2015 18:54:35 -0600
parents website/src/examples/hi2.luan@8557581740db
children 2f5cc9c2cbf0
comparison
equal deleted inserted replaced
387:23d075ce1e48 388:12ee9a336b95
1 local Io = require "luan:Io"
2 local Html = require "luan:Html"
3 local Http = require "luan:web/Http"
4
5
6 local function form() %>
7 <form>
8 <label>What is you name?</label>
9 <input name="name" margin-bottom="1em">
10 <input type=submit>
11 </form>
12 <% end
13
14 local function hello() %>
15 <p>Hi <%= name %>!</p>
16 <% end
17
18 function service()
19 Io.stdout = Http.response.text_writer()
20 name = Http.request.parameters.name
21 Html.simply_html_page{
22 body = function() %>
23 <div container>
24 <h1 margin-bottom="1em">Hello</h1>
25 <%
26 if name == nil then
27 form()
28 else
29 hello()
30 end
31 %>
32 <p margin-top="2em"><small>This page was made with <a href="http://www.simplyhtml.org/">SimplyHTML</a>.</small></p>
33 </div>
34 <% end;
35 }
36 end