@@ -3,29 +3,36 @@ local xml = xml_gen.xml
33
44math.randomseed (os.time ())
55
6- local random_number = xml_gen .component (function (args , children )
7- local min = args .min or 0
8- local max = args .max or 100
9- -- remove these from the args so they dont show up in our HTML attributes later
10- args .min = nil
11- args .max = nil
12-
13- coroutine.yield (xml .p " This is a valid coroutine too!" )
14-
15- return xml .span (args ) {
16- math.random (min , max ),
17- children -- children is a table of all the children passed to the component, this may be empty
6+ local header = xml_gen .component (function (args , kids )
7+ return xml .head {
8+ xml .title {args .title };
9+ xml .meta {
10+ name = " viewport" ,
11+ content = " width=device-width, initial-scale=1"
12+ };
13+ kids ;
14+ args .css_framework ;
1815 }
1916end )
2017
21- local doc = xml .html {
18+ local tw = xml_gen .namespace " tw"
19+
20+ local doc = xml .html {charset = " utf8" } {
21+ header {title = " Hello, World!" , css_framework = xml .link {rel = " stylesheet" , href = " ..." }} {
22+ xml .script {src = " index.lua" };
23+ xml .br ;
24+ };
25+
2226 xml .body {
23- random_number {min = 0 , max = 100 };
24- random_number {max = 10 } {
25- xml .p " This is inside the span!"
27+ xml .h1 {class = " text-center" } " Fritsite" ;
28+ xml .main {class = " container" } {
29+ xml .p " Hello, World!" ;
30+ xml .button {onclick = " say_hi()" } " Say Hi!" ;
2631 };
27- random_number ;
28- }
32+
33+ tw .div {id = " test div" } " hello"
34+ };
2935}
3036
37+
3138print (doc )
0 commit comments