Mercurial Hosting > luan
comparison website/src/examples/hi2_simply_html.luan @ 391:2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 24 Apr 2015 14:05:52 -0600 |
parents | 12ee9a336b95 |
children | 2b9bc97f0439 |
comparison
equal
deleted
inserted
replaced
390:bfbbce690bba | 391:2f5cc9c2cbf0 |
---|---|
2 local Html = require "luan:Html" | 2 local Html = require "luan:Html" |
3 local Http = require "luan:web/Http" | 3 local Http = require "luan:web/Http" |
4 | 4 |
5 | 5 |
6 local function form() %> | 6 local function form() %> |
7 <form> | 7 <form> |
8 <label>What is you name?</label> | 8 <label>What is you name?</label> |
9 <input name="name" margin-bottom="1em"> | 9 <input name="name" margin-bottom="1em"> |
10 <input type=submit> | 10 <input type=submit> |
11 </form> | 11 </form> |
12 <% end | 12 <% end |
13 | 13 |
14 | |
14 local function hello() %> | 15 local function hello() %> |
15 <p>Hi <%= name %>!</p> | 16 <p>Hi <%= name %>!</p> |
16 <% end | 17 <% end |
18 | |
17 | 19 |
18 function service() | 20 function service() |
19 Io.stdout = Http.response.text_writer() | 21 Io.stdout = Http.response.text_writer() |
20 name = Http.request.parameters.name | 22 name = Http.request.parameters.name |
21 Html.simply_html_page{ | 23 %> |
22 body = function() %> | 24 <html> |
23 <div container> | 25 <head> |
24 <h1 margin-bottom="1em">Hello</h1> | 26 <% Html.simply_html_head() %> |
25 <% | 27 </head> |
26 if name == nil then | 28 <body> |
27 form() | 29 <div container> |
28 else | 30 <h1 margin-bottom="1em">Hello</h1> |
29 hello() | 31 <% |
30 end | 32 if name == nil then |
31 %> | 33 form() |
32 <p margin-top="2em"><small>This page was made with <a href="http://www.simplyhtml.org/">SimplyHTML</a>.</small></p> | 34 else |
33 </div> | 35 hello() |
34 <% end; | 36 end |
35 } | 37 %> |
38 <p margin-top="2em"><small>This page was made with <a href="http://www.simplyhtml.org/">SimplyHTML</a>.</small></p> | |
39 </div> | |
40 <% Html.simply_html_body_bottom() %> | |
41 </body> | |
42 </html> | |
43 <% | |
36 end | 44 end |