Last active
January 1, 2016 23:09
-
-
Save onionhammer/8214287 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import templates | |
let NO_PROC = proc(n:var string) = discard | |
proc master(result: var string, head = NO_PROC, body = NO_PROC, footer = NO_PROC) = tmpl html""" | |
<head> | |
${ head(result) } | |
</head> | |
<body> | |
${ body(result) } | |
$if footer != NO_PROC { | |
<footer> | |
${ footer(result) } | |
</footer> | |
} | |
</body> | |
""" | |
proc content(result: var string) = tmpl html""" | |
$for i in 0.. 5 { | |
<div>test!</div> | |
} | |
""" | |
proc head(result: var string) = | |
tmpl html"""<title>hi!</title>""" | |
# Test things | |
var result = "" | |
master( | |
result, | |
head= head, | |
body= content | |
) | |
echo result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment