Mercurial Hosting > luan
annotate website/src/examples/hi2_simply_html.luan @ 543:9767da72545b
fix mmake
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 08 Jun 2015 01:11:08 -0400 |
parents | 7bc63886d4f2 |
children |
rev | line source |
---|---|
382 | 1 local Io = require "luan:Io" |
388 | 2 local Html = require "luan:Html" |
494
2b9bc97f0439
change luan:web to luan:http
Franklin Schmidt <fschmidt@gmail.com>
parents:
391
diff
changeset
|
3 local Http = require "luan:http/Http" |
382 | 4 |
5 | |
388 | 6 local function form() %> |
391
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
7 <form> |
497
55f9f74f1e55
Http.request is now pure luan
Franklin Schmidt <fschmidt@gmail.com>
parents:
495
diff
changeset
|
8 <label>What is your name?</label> |
391
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
9 <input name="name" margin-bottom="1em"> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
10 <input type=submit> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
11 </form> |
388 | 12 <% end |
13 | |
391
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
14 |
503 | 15 local function hello(name) %> |
391
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
16 <p>Hi <%= name %>!</p> |
388 | 17 <% end |
382 | 18 |
391
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
19 |
505
7bc63886d4f2
web page modules now return a function
Franklin Schmidt <fschmidt@gmail.com>
parents:
503
diff
changeset
|
20 return function() |
382 | 21 Io.stdout = Http.response.text_writer() |
503 | 22 local name = Http.request.parameter.name |
391
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
23 %> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
24 <html> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
25 <head> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
26 <% Html.simply_html_head() %> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
27 </head> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
28 <body> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
29 <div container> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
30 <h1 margin-bottom="1em">Hello</h1> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
31 <% |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
32 if name == nil then |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
33 form() |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
34 else |
503 | 35 hello(name) |
391
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
36 end |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
37 %> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
38 <p margin-top="2em"><small>This page was made with <a href="http://www.simplyhtml.org/">SimplyHTML</a>.</small></p> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
39 </div> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
40 <% Html.simply_html_body_bottom() %> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
41 </body> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
42 </html> |
2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
Franklin Schmidt <fschmidt@gmail.com>
parents:
388
diff
changeset
|
43 <% |
382 | 44 end |