0001 /// A container for template variables. 0002 public class Context{ 0003 var dictionaries
Include.swift:21 public func render(context: Context) throws -> String {Inheritence.swift:62 func render(context: Context) throws -> String {Inheritence.swift:107 func render(context: Context) throws -> String {Namespace.swift:36 public func registerSimpleTag(name: String, handler: Context throws -> String) {Node.swift:17 func render(context:Context) throws -> StringNode.swift:21 public func renderNodes(nodes:[NodeType], _ context:Context) throws -> String {Node.swift:26 let handler:Context throws -> StringNode.swift:28 public init(handler:Context throws -> String) {Node.swift:32 public func render(context: Context) throws -> String {Node.swift:44 public func render(context:Context) throws -> String {Node.swift:50 func resolve(context: Context) throws -> Any?Node.swift:64 public func render(context: Context) throws -> String {Node.swift:102 public func render(context: Context) throws -> String {Node.swift:161 public func render(context: Context) throws -> String {Node.swift:242 public func render(context: Context) throws -> String {Template.swift:39 public func render(context: Context? = nil, namespace: Namespace? = nil) throws -> String {Template.swift:42 return try renderNodes(nodes, context ?? Context())Variable.swift:27 func resolve(context: Context) throws -> Any? {Variable.swift:50 public func resolve(context: Context) throws -> Any? {Variable.swift:59 if let context = current as? Context {:[[String: Any]] 0004 0005 /// Initialise a Context with a dictionary 0006 public init(dictionary:[String: Any]) { 0007 dictionaries = [dictionary] 0008 } 0009 0010 /// Initialise an empty Context 0011 public init
Context.swift:7 dictionaries = [dictionary]Context.swift:12 dictionaries = []Context.swift:18 for dictionary in Array(dictionaries.reverse()) {Context.swift:29 if let dictionary = dictionaries.popLast() {Context.swift:32 dictionaries.append(mutable_dictionary)Context.swift:39 dictionaries.append(dictionary ?? [:])Context.swift:44 return dictionaries.popLast()() { 0012 dictionaries = [] 0013 } 0014 0015 public subscript
Template.swift:42 return try renderNodes(nodes, context ?? Context())(key: String) -> Any? { 0016 /// Retrieves a variable's value, starting at the current context and going upwards 0017 get { 0018 for dictionary in Array(dictionaries.reverse()) { 0019 if let value = dictionary[key] { 0020 return value 0021 } 0022 } 0023 0024 return nil 0025 } 0026 0027 /// Set a variable in the current context, deleting the variable if it's nil 0028 set(value) { 0029 if let dictionary = dictionaries.popLast() { 0030 var mutable_dictionary = dictionary 0031 mutable_dictionary[key] = value 0032 dictionaries.append(mutable_dictionary) 0033 } 0034 } 0035 } 0036 0037 /// Push a new level into the Context 0038 public func push
Include.swift:22 guard let loader = context["loader"] as? TemplateLoader else {Inheritence.swift:63 guard let loader = context["loader"] as? TemplateLoader else {Inheritence.swift:108 if let blockContext = context[BlockContext.contextKey] as? BlockContext, node = blockContext.pop(name) {Variable.swift:60 current = context[bit](dictionary: [String: Any]? = nil) { 0039 dictionaries.append(dictionary ?? [:]) 0040 } 0041 0042 /// Pop the last level off of the Context 0043 public func pop
Context.swift:49 push(dictionary)Inheritence.swift:77 context.push([BlockContext.contextKey: blockContext])Node.swift:254 context.push()() -> [String: Any]? { 0044 return dictionaries.popLast() 0045 } 0046 0047 /// Push a new level onto the context for the duration of the execution of the given closure 0048 public func push
Context.swift:51 pop()Inheritence.swift:79 context.pop()Node.swift:261 context.pop()<Result>(dictionary: [String: Any]? = nil, @noescape closure: (() throws -> Result)) rethrows -> Result { 0049 push(dictionary) 0050 let result = try closure() 0051 pop() 0052 return result 0053 } 0054 } 0055
Node.swift:173 return try context.push([loopVariable: item, "forloop": forContext]) {Node.swift:179 return try context.push {