HBTemplate -> HBMustacheTemplate, escape characters

Add tests for mustache examples
This commit is contained in:
Adam Fowler
2021-03-12 07:43:09 +00:00
parent 55245e960f
commit 7f61c8dd72
7 changed files with 143 additions and 95 deletions

View File

@@ -5,8 +5,8 @@ enum HBMustacheError: Error {
case expectedSectionEnd
}
public class HBTemplate {
public init(_ string: String) throws {
public class HBMustacheTemplate {
public init(string: String) throws {
self.tokens = try Self.parse(string)
}
@@ -17,8 +17,9 @@ public class HBTemplate {
enum Token {
case text(String)
case variable(String)
case section(String, HBTemplate)
case invertedSection(String, HBTemplate)
case unescapedVariable(String)
case section(String, HBMustacheTemplate)
case invertedSection(String, HBMustacheTemplate)
}
let tokens: [Token]