Last active
September 26, 2018 01:55
-
-
Save asarazan/c7847a612bb052bce972fdcffcc5fa0d 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
fun html(init: HTML.() -> Unit): HTML { | |
val html = HTML() | |
html.init() | |
return html | |
} | |
fun HTML.head(init: Head.() -> Unit) : Head { | |
val head = Head() | |
head.init() | |
children.add(head) | |
return head | |
} | |
fun HTML.body(init: Body.() -> Unit) : Body { | |
val body = Body() | |
body.init() | |
children.add(body) | |
return body | |
} | |
fun [Parent Object].html(init: [Thing You're Building].() -> Unit): [Thing You're Building] { | |
val thing = ["Thing You're Building"]() | |
thing.init() | |
return thing | |
} | |
fun [Parent Object].head(init: [Thing You're Building].() -> Unit) : [Thing You're Building] { | |
val thing = [Thing You're Building]() | |
thing.init() | |
/* Do some stuff with the parent */ | |
return thing | |
} | |
fun [Parent Object].body(init: [Thing You're Building].() -> Unit) : [Thing You're Building] { | |
val thing = [Thing You're Building]() | |
thing.init() | |
/* Do some stuff with the parent */ | |
return thing | |
} | |
fun html(████: HTML.██ ██ ████): HTML { | |
val ████ = HTML() | |
████.████() | |
return ████ | |
} | |
fun ████.head(████: Head.██ ██ ████) : Head { | |
val ████ = Head() | |
████.████() | |
children.add(████) | |
return ████ | |
} | |
fun ████.body(████: Body.██ ██ ████) : Body { | |
val ████ = Body() | |
████.████() | |
children.add(████) | |
return ████ | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment