Created
February 18, 2013 17:44
-
-
Save delihiros/4979159 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/io | |
Map setPair := method(k, v, | |
self atPut(k asMutable removePrefix("\"") removeSuffix("\""), v)) | |
OperatorTable addAssignOperator(":", "setPair") | |
Builder := Object clone do( | |
output := Sequence clone | |
forward := method( | |
output appendSeq("<", call message name, ">\n") | |
call message arguments foreach(arg, | |
content := self doMessage(arg); | |
if(content type == "Map", | |
content foreach(k, v, | |
output removeSuffix(">\n") appendSeq(" \"", k, "\"=\"", v, "\">\n") | |
) | |
) | |
) | |
if(content type == "Sequence", output appendSeq(content, "\n")) | |
output appendSeq("</", call message name, ">\n") | |
self | |
) | |
curlyBrackets := method( | |
self r := Map clone | |
call message arguments foreach(arg, | |
r doMessage(arg)) | |
r) | |
) | |
Builder html( | |
head( | |
title("Gekogeko.org") | |
) | |
body( | |
div({"id" : "message"}, | |
h1("hello"), | |
p("hello, world!")) | |
div({"id" : "menu"}, | |
ul( | |
li("delihiros") | |
li("ronyaaaa") | |
li("hgoe"))))) output println |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment