Skip to content

Instantly share code, notes, and snippets.

@delihiros
Created February 18, 2013 17:44
Show Gist options
  • Save delihiros/4979159 to your computer and use it in GitHub Desktop.
Save delihiros/4979159 to your computer and use it in GitHub Desktop.
#!/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