diff --git a/CHANGELOG.md b/CHANGELOG.md index c9598f0..b0062f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,9 @@ ### Breaking -- `TemplateLoader` is now a protocol with the file system based loader now - called `FileSystemLoader`. You will need to use `FileSystemLoader` instead. - -- `TemplateLoader` `loadTemplate` methods are now throwing and now take labels - for the `name` and `names` arguments. +- `TemplateLoader` has been renamed to `FileSystemLoader`. The + `loadTemplate(s)` methods are now throwing and now take labels for the `name` + and `names` arguments. - Many internal classes are no longer private. Some APIs were previously accessible due to earlier versions of Swift requiring the types to be public diff --git a/Sources/Include.swift b/Sources/Include.swift index 7de0df8..97c2359 100644 --- a/Sources/Include.swift +++ b/Sources/Include.swift @@ -19,7 +19,7 @@ class IncludeNode : NodeType { } func render(_ context: Context) throws -> String { - guard let loader = context["loader"] as? TemplateLoader else { + guard let loader = context["loader"] as? Loader else { throw TemplateSyntaxError("Template loader not in context") } diff --git a/Sources/Inheritence.swift b/Sources/Inheritence.swift index 75f728b..428fe1c 100644 --- a/Sources/Inheritence.swift +++ b/Sources/Inheritence.swift @@ -59,7 +59,7 @@ class ExtendsNode : NodeType { } func render(_ context: Context) throws -> String { - guard let loader = context["loader"] as? TemplateLoader else { + guard let loader = context["loader"] as? Loader else { throw TemplateSyntaxError("Template loader not in context") } diff --git a/Sources/TemplateLoader.swift b/Sources/TemplateLoader.swift index 8decb00..d9a7d94 100644 --- a/Sources/TemplateLoader.swift +++ b/Sources/TemplateLoader.swift @@ -2,13 +2,13 @@ import Foundation import PathKit -public protocol TemplateLoader { +public protocol Loader { func loadTemplate(name: String) throws -> Template? func loadTemplate(names: [String]) throws -> Template? } -extension TemplateLoader { +extension Loader { func loadTemplate(names: [String]) throws -> Template? { for name in names { let template = try loadTemplate(name: name) @@ -24,7 +24,7 @@ extension TemplateLoader { // A class for loading a template from disk -public class FileSystemLoader: TemplateLoader { +public class FileSystemLoader: Loader { public let paths: [Path] public init(paths: [Path]) {