Template inheritance (#9)
* Move all context variables into HBMustacheContext * Add support for reading inherited sections * Render inherited tokens * Test inheritance spec, fix two minor issues * fix warning * swift format
This commit is contained in:
@@ -30,6 +30,16 @@ public final class HBMustacheLibrary {
|
||||
self.templates[name] = template
|
||||
}
|
||||
|
||||
/// Register template under name
|
||||
/// - Parameters:
|
||||
/// - mustache: Mustache text
|
||||
/// - name: Name of template
|
||||
public func register(_ mustache: String, named name: String) throws {
|
||||
let template = try HBMustacheTemplate(string: mustache)
|
||||
template.setLibrary(self)
|
||||
self.templates[name] = template
|
||||
}
|
||||
|
||||
/// Return template registed with name
|
||||
/// - Parameter name: name to search for
|
||||
/// - Returns: Template
|
||||
|
||||
Reference in New Issue
Block a user