swift format

This commit is contained in:
Adam Fowler
2021-03-15 18:24:06 +00:00
parent 955e1eb9e4
commit 66edcba185
18 changed files with 306 additions and 313 deletions

View File

@@ -4,16 +4,16 @@ public class HBMustacheTemplate {
/// - Parameter string: Template text
/// - Throws: HBMustacheTemplate.Error
public init(string: String) throws {
self.tokens = try Self.parse(string)
tokens = try Self.parse(string)
}
/// Render object using this template
/// - Parameter object: Object to render
/// - Returns: Rendered text
public func render(_ object: Any) -> String {
self.render(object, context: nil)
render(object, context: nil)
}
internal init(_ tokens: [Token]) {
self.tokens = tokens
}
@@ -22,14 +22,14 @@ public class HBMustacheTemplate {
self.library = library
for token in tokens {
switch token {
case .section(_, _, let template), .invertedSection(_, _, let template):
case let .section(_, _, template), let .invertedSection(_, _, template):
template.setLibrary(library)
default:
break
}
}
}
enum Token {
case text(String)
case variable(name: String, method: String? = nil)
@@ -42,4 +42,3 @@ public class HBMustacheTemplate {
let tokens: [Token]
var library: HBMustacheLibrary?
}