import strutils template html(name, matter: untyped) = proc name(): string = result = "" matter result.add("") template nestedTag(tag: untyped) = template tag(matter: typed) = result.add("<" & astToStr(tag) & ">") matter result.add("") template simpleTag(tag: untyped) = template tag(matter: untyped) = result.add("<$1>$2" % [astToStr(tag), matter]) nestedTag body nestedTag head nestedTag ul simpleTag title simpleTag li html mainPage: head: title "now look at this" body: ul: li "Nim is quite capable" echo mainPage()