0001    import PathKit
0002    
0003    
0004    public class IncludeNode
Include.swift:14
    return IncludeNode(templateName: Variable(bits[1]))
Namespace.swift:17
    registerTag("include", parser: IncludeNode.parse)
: NodeType { 0005 public let templateName
Include.swift:18
    self.templateName = templateName
Include.swift:26
    guard let templateName = try self.templateName.resolve(context) as? String else {
Include.swift:27
      throw TemplateSyntaxError("'\(self.templateName)' could not be resolved as a string")
: Variable 0006 0007 public class func parse
Namespace.swift:17
    registerTag("include", parser: IncludeNode.parse)
(parser: TokenParser, token: Token) throws -> NodeType { 0008 let bits = token.components() 0009 0010 guard bits.count == 2 else { 0011 throw TemplateSyntaxError("'include' tag takes one argument, the template file to be included") 0012 } 0013 0014 return IncludeNode(templateName: Variable(bits[1])) 0015 } 0016 0017 public init
Include.swift:14
    return IncludeNode(templateName: Variable(bits[1]))
(templateName: Variable) { 0018 self.templateName = templateName 0019 } 0020 0021 public func render(context: Context) throws -> String { 0022 guard let loader = context["loader"] as? TemplateLoader else { 0023 throw TemplateSyntaxError("Template loader not in context") 0024 } 0025 0026 guard let templateName = try self.templateName.resolve(context) as? String else { 0027 throw TemplateSyntaxError("'\(self.templateName)' could not be resolved as a string") 0028 } 0029 0030 guard let template = loader.loadTemplate(templateName) else { 0031 let paths = loader.paths.map { $0.description }.joinWithSeparator(", ") 0032 throw TemplateSyntaxError("'\(templateName)' template not found in \(paths)") 0033 } 0034 0035 return try template.render(context) 0036 } 0037 } 0038 0039