Implement trim whitespace

This commit is contained in:
yonaskolb
2019-11-17 00:41:42 +11:00
committed by David Jennes
parent d4dc631752
commit ef97973e85
10 changed files with 444 additions and 74 deletions

View File

@@ -4,6 +4,8 @@ public struct Environment {
public let templateClass: Template.Type
/// List of registered extensions
public var extensions: [Extension]
/// How to handle whitespace
public var trimBehaviour: TrimBehaviour
/// Mechanism for loading new files
public var loader: Loader?
@@ -13,14 +15,17 @@ public struct Environment {
/// - loader: Mechanism for loading new files
/// - extensions: List of extension containers
/// - templateClass: Class for newly loaded templates
/// - trimBehaviour: How to handle whitespace
public init(
loader: Loader? = nil,
extensions: [Extension] = [],
templateClass: Template.Type = Template.self
templateClass: Template.Type = Template.self,
trimBehaviour: TrimBehaviour = .nothing
) {
self.templateClass = templateClass
self.loader = loader
self.extensions = extensions + [DefaultExtension()]
self.trimBehaviour = trimBehaviour
}
/// Load a template with the given name