Skip to content

Instantly share code, notes, and snippets.

@onionhammer
Created January 2, 2014 17:06
Show Gist options
  • Save onionhammer/8222475 to your computer and use it in GitHub Desktop.
Save onionhammer/8222475 to your computer and use it in GitHub Desktop.
import templates, macros
template master(content: stmt): stmt {.immediate.} =
template body = content
tmpli html"""
<html>
<body>
${ body() }
</body>
</html>
"""
proc body(items = 5): string =
master: tmpl html"""
<ul>
$for i in 0.. items {
<li>this is my content! $i</li>
}
</ul>
"""
when isMainModule:
echo body(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment