Provide simple API for tags

Closes #6
This commit is contained in:
Kyle Fuller
2014-10-26 18:16:27 +00:00
parent 771236953f
commit 67eca80d61
4 changed files with 50 additions and 0 deletions

View File

@@ -41,6 +41,12 @@ public class TokenParser {
tags[name] = parser
}
public func registerSimpleTag(name:String, handler:((Context) -> (Stencil.Result))) {
registerTag(name, parser: { (parser, token) -> TokenParser.Result in
return .Success(node:SimpleNode(handler: handler))
})
}
public func parse() -> Results {
return parse(nil)
}