Fix issues in Sources

Sources

sources
This commit is contained in:
David Jennes
2018-09-20 05:10:18 +02:00
parent 799490198f
commit 3f4622f54f
21 changed files with 346 additions and 350 deletions

View File

@@ -14,12 +14,13 @@ open class Extension {
/// Registers a simple template tag with a name and a handler
public func registerSimpleTag(_ name: String, handler: @escaping (Context) throws -> String) {
registerTag(name, parser: { parser, token in
return SimpleNode(token: token, handler: handler)
})
registerTag(name) { _, token in
SimpleNode(token: token, handler: handler)
}
}
/// Registers boolean filter with it's negative counterpart
// swiftlint:disable:next discouraged_optional_boolean
public func registerFilter(name: String, negativeFilterName: String, filter: @escaping (Any?) throws -> Bool?) {
filters[name] = .simple(filter)
filters[negativeFilterName] = .simple {
@@ -44,7 +45,6 @@ open class Extension {
}
}
class DefaultExtension: Extension {
override init() {
super.init()
@@ -77,7 +77,6 @@ class DefaultExtension: Extension {
}
}
protocol FilterType {
func invoke(value: Any?, arguments: [Any?], context: Context) throws -> Any?
}