0001 // The MIT License 0002 // 0003 // Copyright (c) 2015 Gwendal Roué 0004 // 0005 // Permission is hereby granted, free of charge, to any person obtaining a copy 0006 // of this software and associated documentation files (the "Software"), to deal 0007 // in the Software without restriction, including without limitation the rights 0008 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 0009 // copies of the Software, and to permit persons to whom the Software is 0010 // furnished to do so, subject to the following conditions: 0011 // 0012 // The above copyright notice and this permission notice shall be included in 0013 // all copies or substantial portions of the Software. 0014 // 0015 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0016 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0017 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 0018 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 0019 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 0020 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 0021 // THE SOFTWARE. 0022 0023 0024 // ============================================================================= 0025 // MARK: - ContentType 0026 0027 /** 0028 GRMustache distinguishes Text from HTML. 0029 0030 Content type applies to both *templates*, and *renderings*: 0031 0032 - In a HTML template, `{{name}}` tags escape Text renderings, but do not escape 0033 HTML renderings. 0034 0035 - In a Text template, `{{name}}` tags do not escape anything. 0036 0037 The content type of a template comes from `Configuration.contentType` or 0038 `{{% CONTENT_TYPE:... }}` pragma tags. See the documentation of 0039 `Configuration.contentType` for a full discussion. 0040 0041 The content type of rendering is discussed with the `Rendering` type. 0042 0043 See also: 0044 0045 - Configuration.contentType 0046 - Rendering 0047 */ 0048 public enum ContentType{ 0049 case Text
TemplateCompiler.swift:28 init(contentType: ContentType, repository: TemplateRepository, templateID: TemplateID?) {TemplateCompiler.swift:334 var contentType: ContentType {TemplateCompiler.swift:343 init(contentType: ContentType) {TemplateCompiler.swift:357 case Unlocked(ContentType)TemplateCompiler.swift:358 case Locked(ContentType)Configuration.swift:157 public var contentType: ContentTypeBox.swift:828 var contentType: ContentType? = nilCoreFunctions.swift:707 public let contentType: ContentTypeCoreFunctions.swift:720 public init(_ string: String, _ contentType: ContentType = .Text) {Template.swift:91 public var contentType: ContentType {TemplateAST.swift:40 case Defined(nodes: [TemplateASTNode], contentType: ContentType)TemplateAST.swift:59 convenience init(nodes: [TemplateASTNode], contentType: ContentType) {TemplateAST.swift:78 var contentType: ContentType! {TemplateASTNode.swift:87 static func variable(expression expression: Expression, contentType: ContentType, escapesHTML: Bool, token: TemplateToken) -> TemplateASTNode {VariableTag.swift:28 let contentType: ContentTypeVariableTag.swift:30 init(contentType: ContentType, token: TemplateToken) {0050 case HTML
TemplateCompiler.swift:82 compilationState.compilerContentType = .Unlocked(.Text)CoreFunctions.swift:628 templateRepository.configuration.contentType = .TextCoreFunctions.swift:720 public init(_ string: String, _ contentType: ContentType = .Text) {CoreFunctions.swift:733 case .Text:MustacheBox.swift:483 return Rendering("\(value)", .Text)MustacheBox.swift:485 return Rendering("", .Text)RenderingEngine.swift:74 case (.HTML, .Text):RenderingEngine.swift:191 case (.HTML, .Text, true):0051 } 0052 0053 0054 // ============================================================================= 0055 // MARK: - Errors 0056 0057 /// The errors thrown by Mustache.swift 0058 public struct MustacheError
TemplateCompiler.swift:89 compilationState.compilerContentType = .Unlocked(.HTML)Configuration.swift:99 contentType = .HTMLCoreFunctions.swift:731 case .HTML:RenderingEngine.swift:74 case (.HTML, .Text):RenderingEngine.swift:191 case (.HTML, .Text, true):: ErrorType { 0059 0060 /// MustacheError types 0061 public enum Kind
Common.swift:93 func errorWith(message message: String? = nil, templateID: TemplateID? = nil, lineNumber: Int? = nil, underlyingError: ErrorType? = nil) -> MustacheError {Common.swift:94 return MustacheError(Common.swift:103 extension MustacheError : CustomStringConvertible {TemplateCompiler.swift:41 throw MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: openingToken.templateID, lineNumber: openingToken.lineNumber)TemplateCompiler.swift:43 throw MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: openingToken.templateID, lineNumber: openingToken.lineNumber)TemplateCompiler.swift:45 throw MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: openingToken.templateID, lineNumber: openingToken.lineNumber)TemplateCompiler.swift:47 throw MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: openingToken.templateID, lineNumber: openingToken.lineNumber)TemplateCompiler.swift:84 throw MustacheError(kind: .ParseError, message:"CONTENT_TYPE:TEXT pragma tag must prepend any Mustache variable, section, or partial tag.", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:91 throw MustacheError(kind: .ParseError, message:"CONTENT_TYPE:HTML pragma tag must prepend any Mustache variable, section, or partial tag.", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:94 throw MustacheError(kind: .ParseError, message:"Syntax should be \"CONTENT_TYPE : TEXT\" or \"CONTENT_TYPE : HTML\"", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:117 throw MustacheError(kind: .ParseError, message:"Illegal tag inside a partial override tag.", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:124 } catch let error as MustacheError {TemplateCompiler.swift:127 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:134 throw MustacheError(kind: .ParseError, message: "Illegal tag inside a partial override tag: \(token.templateSubstring)", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:141 } catch let error as MustacheError {TemplateCompiler.swift:144 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:151 throw MustacheError(kind: .ParseError, message: "Illegal tag inside a partial override tag: \(token.templateSubstring)", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:158 } catch let error as MustacheError {TemplateCompiler.swift:161 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:168 throw MustacheError(kind: .ParseError, message: "Illegal tag inside a partial override tag: \(token.templateSubstring)", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:175 } catch let error as MustacheError {TemplateCompiler.swift:178 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:197 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:204 } catch let error as MustacheError {TemplateCompiler.swift:209 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:212 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:234 } catch let error as MustacheError {TemplateCompiler.swift:239 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:242 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:270 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:279 throw MustacheError(kind: .ParseError, message: "Content type mismatch", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:300 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:397 throw MustacheError(kind: .ParseError, message: "Missing block name", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:400 throw MustacheError(kind: .ParseError, message: "Invalid block name", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:410 throw MustacheError(kind: .ParseError, message: "Missing template name", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:413 throw MustacheError(kind: .ParseError, message: "Invalid template name", templateID: token.templateID, lineNumber: token.lineNumber)EachFilter.swift:96 throw MustacheError(kind: .RenderError, message: "Non-enumerable argument in each filter: \(box.value)")ZipFilter.swift:40 throw MustacheError(kind: .RenderError, message: "Non-enumerable argument in zip filter: `\(box.value)`")ExpressionParser.swift:334 throw MustacheError(kind: .ParseError, message: "Missing expression")ExpressionParser.swift:338 throw MustacheError(kind: .ParseError, message: "Invalid expression `\(string)`: \(description)")TemplateParser.swift:285 let error = MustacheError(kind: .ParseError, message: "Invalid set delimiters tag", templateID: templateID, lineNumber: startLineNumber)TemplateParser.swift:326 let error = MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: templateID, lineNumber: startLineNumber)TemplateParser.swift:329 let error = MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: templateID, lineNumber: startLineNumber)TemplateParser.swift:332 let error = MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: templateID, lineNumber: startLineNumber)Box.swift:863 throw MustacheError(kind: .RenderError, message: "Content type mismatch")CoreFunctions.swift:148 throw MustacheError(kind: .RenderError, message: "Too many arguments")CoreFunctions.swift:182 throw MustacheError(kind: .RenderError, message: "Too many arguments")CoreFunctions.swift:268 throw MustacheError(kind: .RenderError, message: "Too many arguments")ExpressionInvocation.swift:54 throw MustacheError(kind: .RenderError, message: "Missing filter")ExpressionInvocation.swift:56 throw MustacheError(kind: .RenderError, message: "Not a filter")RenderingEngine.swift:135 } catch let error as MustacheError {RenderingEngine.swift:144 throw MustacheError(kind: .RenderError, message: "Could not evaluate \(tag)", templateID: tag.templateID, lineNumber: tag.lineNumber, underlyingError: error)TemplateRepository.swift:239 throw MustacheError(kind: .TemplateNotFound, message: "Missing dataSource", templateID: baseTemplateID)TemplateRepository.swift:244 throw MustacheError(kind: .TemplateNotFound, message: "Template not found: \"\(name)\" from \(baseTemplateID)", templateID: baseTemplateID)TemplateRepository.swift:246 throw MustacheError(kind: .TemplateNotFound, message: "Template not found: \"\(name)\"")TemplateRepository.swift:325 throw MustacheError(kind: .TemplateNotFound, templateID: templateID): Int { 0062 case TemplateNotFound
Common.swift:68 public let kind: KindCommon.swift:85 public init(kind: Kind, message: String? = nil, templateID: TemplateID? = nil, lineNumber: Int? = nil, underlyingError: ErrorType? = nil) {0063 case ParseError
Common.swift:125 case .TemplateNotFound:TemplateRepository.swift:239 throw MustacheError(kind: .TemplateNotFound, message: "Missing dataSource", templateID: baseTemplateID)TemplateRepository.swift:244 throw MustacheError(kind: .TemplateNotFound, message: "Template not found: \"\(name)\" from \(baseTemplateID)", templateID: baseTemplateID)TemplateRepository.swift:246 throw MustacheError(kind: .TemplateNotFound, message: "Template not found: \"\(name)\"")TemplateRepository.swift:325 throw MustacheError(kind: .TemplateNotFound, templateID: templateID)0064 case RenderError
Common.swift:127 case .ParseError:TemplateCompiler.swift:41 throw MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: openingToken.templateID, lineNumber: openingToken.lineNumber)TemplateCompiler.swift:43 throw MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: openingToken.templateID, lineNumber: openingToken.lineNumber)TemplateCompiler.swift:45 throw MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: openingToken.templateID, lineNumber: openingToken.lineNumber)TemplateCompiler.swift:47 throw MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: openingToken.templateID, lineNumber: openingToken.lineNumber)TemplateCompiler.swift:84 throw MustacheError(kind: .ParseError, message:"CONTENT_TYPE:TEXT pragma tag must prepend any Mustache variable, section, or partial tag.", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:91 throw MustacheError(kind: .ParseError, message:"CONTENT_TYPE:HTML pragma tag must prepend any Mustache variable, section, or partial tag.", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:94 throw MustacheError(kind: .ParseError, message:"Syntax should be \"CONTENT_TYPE : TEXT\" or \"CONTENT_TYPE : HTML\"", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:117 throw MustacheError(kind: .ParseError, message:"Illegal tag inside a partial override tag.", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:127 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:134 throw MustacheError(kind: .ParseError, message: "Illegal tag inside a partial override tag: \(token.templateSubstring)", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:144 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:151 throw MustacheError(kind: .ParseError, message: "Illegal tag inside a partial override tag: \(token.templateSubstring)", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:161 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:168 throw MustacheError(kind: .ParseError, message: "Illegal tag inside a partial override tag: \(token.templateSubstring)", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:178 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:197 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:209 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:212 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:239 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:242 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:270 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:279 throw MustacheError(kind: .ParseError, message: "Content type mismatch", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:300 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:397 throw MustacheError(kind: .ParseError, message: "Missing block name", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:400 throw MustacheError(kind: .ParseError, message: "Invalid block name", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:410 throw MustacheError(kind: .ParseError, message: "Missing template name", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:413 throw MustacheError(kind: .ParseError, message: "Invalid template name", templateID: token.templateID, lineNumber: token.lineNumber)ExpressionParser.swift:334 throw MustacheError(kind: .ParseError, message: "Missing expression")ExpressionParser.swift:338 throw MustacheError(kind: .ParseError, message: "Invalid expression `\(string)`: \(description)")TemplateParser.swift:285 let error = MustacheError(kind: .ParseError, message: "Invalid set delimiters tag", templateID: templateID, lineNumber: startLineNumber)TemplateParser.swift:326 let error = MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: templateID, lineNumber: startLineNumber)TemplateParser.swift:329 let error = MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: templateID, lineNumber: startLineNumber)TemplateParser.swift:332 let error = MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: templateID, lineNumber: startLineNumber)0065 } 0066 0067 /// The error type 0068 public let kind
Common.swift:133 case .RenderError:EachFilter.swift:96 throw MustacheError(kind: .RenderError, message: "Non-enumerable argument in each filter: \(box.value)")ZipFilter.swift:40 throw MustacheError(kind: .RenderError, message: "Non-enumerable argument in zip filter: `\(box.value)`")Box.swift:863 throw MustacheError(kind: .RenderError, message: "Content type mismatch")CoreFunctions.swift:148 throw MustacheError(kind: .RenderError, message: "Too many arguments")CoreFunctions.swift:182 throw MustacheError(kind: .RenderError, message: "Too many arguments")CoreFunctions.swift:268 throw MustacheError(kind: .RenderError, message: "Too many arguments")ExpressionInvocation.swift:54 throw MustacheError(kind: .RenderError, message: "Missing filter")ExpressionInvocation.swift:56 throw MustacheError(kind: .RenderError, message: "Not a filter")RenderingEngine.swift:144 throw MustacheError(kind: .RenderError, message: "Could not evaluate \(tag)", templateID: tag.templateID, lineNumber: tag.lineNumber, underlyingError: error): Kind 0069 0070 /// Eventual error message 0071 public let message
Common.swift:86 self.kind = kindCommon.swift:95 kind: self.kind,Common.swift:124 switch kind {: String? 0072 0073 /// TemplateID of the eventual template at the origin of the error 0074 public let templateID
Common.swift:87 self.message = messageCommon.swift:96 message: message ?? self.message,Common.swift:141 if let message = message {RenderingEngine.swift:137 if let oldMessage = error.message {: String? 0075 0076 /// Eventual line number where the error occurred. 0077 public let lineNumber
Common.swift:88 self.templateID = templateIDCommon.swift:97 templateID: templateID ?? self.templateID,Common.swift:106 if let templateID = templateID {: Int? 0078 0079 /// Eventual underlying error 0080 public let underlyingError
Common.swift:89 self.lineNumber = lineNumberCommon.swift:98 lineNumber: lineNumber ?? self.lineNumber,Common.swift:107 if let lineNumber = lineNumber {Common.swift:113 if let lineNumber = lineNumber {: ErrorType? 0081 0082 0083 // Not public 0084 0085 public init
Common.swift:90 self.underlyingError = underlyingErrorCommon.swift:99 underlyingError: underlyingError ?? self.underlyingError)Common.swift:149 if let underlyingError = underlyingError {(kind: Kind, message: String? = nil, templateID: TemplateID? = nil, lineNumber: Int? = nil, underlyingError: ErrorType? = nil) { 0086 self.kind = kind 0087 self.message = message 0088 self.templateID = templateID 0089 self.lineNumber = lineNumber 0090 self.underlyingError = underlyingError 0091 } 0092 0093 func errorWith
Common.swift:94 return MustacheError(TemplateCompiler.swift:41 throw MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: openingToken.templateID, lineNumber: openingToken.lineNumber)TemplateCompiler.swift:43 throw MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: openingToken.templateID, lineNumber: openingToken.lineNumber)TemplateCompiler.swift:45 throw MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: openingToken.templateID, lineNumber: openingToken.lineNumber)TemplateCompiler.swift:47 throw MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: openingToken.templateID, lineNumber: openingToken.lineNumber)TemplateCompiler.swift:84 throw MustacheError(kind: .ParseError, message:"CONTENT_TYPE:TEXT pragma tag must prepend any Mustache variable, section, or partial tag.", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:91 throw MustacheError(kind: .ParseError, message:"CONTENT_TYPE:HTML pragma tag must prepend any Mustache variable, section, or partial tag.", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:94 throw MustacheError(kind: .ParseError, message:"Syntax should be \"CONTENT_TYPE : TEXT\" or \"CONTENT_TYPE : HTML\"", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:117 throw MustacheError(kind: .ParseError, message:"Illegal tag inside a partial override tag.", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:127 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:134 throw MustacheError(kind: .ParseError, message: "Illegal tag inside a partial override tag: \(token.templateSubstring)", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:144 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:151 throw MustacheError(kind: .ParseError, message: "Illegal tag inside a partial override tag: \(token.templateSubstring)", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:161 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:168 throw MustacheError(kind: .ParseError, message: "Illegal tag inside a partial override tag: \(token.templateSubstring)", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:178 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:197 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:209 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:212 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:239 throw MustacheError(kind: .ParseError, templateID: token.templateID, lineNumber: token.lineNumber, underlyingError: error)TemplateCompiler.swift:242 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:270 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:279 throw MustacheError(kind: .ParseError, message: "Content type mismatch", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:300 throw MustacheError(kind: .ParseError, message: "Unmatched closing tag", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:397 throw MustacheError(kind: .ParseError, message: "Missing block name", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:400 throw MustacheError(kind: .ParseError, message: "Invalid block name", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:410 throw MustacheError(kind: .ParseError, message: "Missing template name", templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:413 throw MustacheError(kind: .ParseError, message: "Invalid template name", templateID: token.templateID, lineNumber: token.lineNumber)EachFilter.swift:96 throw MustacheError(kind: .RenderError, message: "Non-enumerable argument in each filter: \(box.value)")ZipFilter.swift:40 throw MustacheError(kind: .RenderError, message: "Non-enumerable argument in zip filter: `\(box.value)`")ExpressionParser.swift:334 throw MustacheError(kind: .ParseError, message: "Missing expression")ExpressionParser.swift:338 throw MustacheError(kind: .ParseError, message: "Invalid expression `\(string)`: \(description)")TemplateParser.swift:285 let error = MustacheError(kind: .ParseError, message: "Invalid set delimiters tag", templateID: templateID, lineNumber: startLineNumber)TemplateParser.swift:326 let error = MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: templateID, lineNumber: startLineNumber)TemplateParser.swift:329 let error = MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: templateID, lineNumber: startLineNumber)TemplateParser.swift:332 let error = MustacheError(kind: .ParseError, message: "Unclosed Mustache tag", templateID: templateID, lineNumber: startLineNumber)Box.swift:863 throw MustacheError(kind: .RenderError, message: "Content type mismatch")CoreFunctions.swift:148 throw MustacheError(kind: .RenderError, message: "Too many arguments")CoreFunctions.swift:182 throw MustacheError(kind: .RenderError, message: "Too many arguments")CoreFunctions.swift:268 throw MustacheError(kind: .RenderError, message: "Too many arguments")ExpressionInvocation.swift:54 throw MustacheError(kind: .RenderError, message: "Missing filter")ExpressionInvocation.swift:56 throw MustacheError(kind: .RenderError, message: "Not a filter")RenderingEngine.swift:144 throw MustacheError(kind: .RenderError, message: "Could not evaluate \(tag)", templateID: tag.templateID, lineNumber: tag.lineNumber, underlyingError: error)TemplateRepository.swift:239 throw MustacheError(kind: .TemplateNotFound, message: "Missing dataSource", templateID: baseTemplateID)TemplateRepository.swift:244 throw MustacheError(kind: .TemplateNotFound, message: "Template not found: \"\(name)\" from \(baseTemplateID)", templateID: baseTemplateID)TemplateRepository.swift:246 throw MustacheError(kind: .TemplateNotFound, message: "Template not found: \"\(name)\"")TemplateRepository.swift:325 throw MustacheError(kind: .TemplateNotFound, templateID: templateID)(message message: String? = nil, templateID: TemplateID? = nil, lineNumber: Int? = nil, underlyingError: ErrorType? = nil) -> MustacheError { 0094 return MustacheError( 0095 kind: self.kind, 0096 message: message ?? self.message, 0097 templateID: templateID ?? self.templateID, 0098 lineNumber: lineNumber ?? self.lineNumber, 0099 underlyingError: underlyingError ?? self.underlyingError) 0100 } 0101 } 0102 0103 extension MustacheError : CustomStringConvertible { 0104 0105 var locationDescription
TemplateCompiler.swift:125 throw error.errorWith(templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:142 throw error.errorWith(templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:159 throw error.errorWith(templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:176 throw error.errorWith(templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:206 throw error.errorWith(templateID: token.templateID, lineNumber: token.lineNumber)TemplateCompiler.swift:236 throw error.errorWith(templateID: token.templateID, lineNumber: token.lineNumber)RenderingEngine.swift:142 throw error.errorWith(message: newMessage, templateID: tag.templateID, lineNumber: tag.lineNumber): String? { 0106 if let templateID = templateID { 0107 if let lineNumber = lineNumber { 0108 return "line \(lineNumber) of template \(templateID)" 0109 } else { 0110 return "template \(templateID)" 0111 } 0112 } else { 0113 if let lineNumber = lineNumber { 0114 return "line \(lineNumber)" 0115 } else { 0116 return nil 0117 } 0118 } 0119 } 0120 0121 /// A textual representation of `self`. 0122 public var description: String { 0123 var description: String 0124 switch kind { 0125 case .TemplateNotFound: 0126 description = "" 0127 case .ParseError: 0128 if let locationDescription = locationDescription { 0129 description = "Parse error at \(locationDescription)" 0130 } else { 0131 description = "Parse error" 0132 } 0133 case .RenderError: 0134 if let locationDescription = locationDescription { 0135 description = "Rendering error at \(locationDescription)" 0136 } else { 0137 description = "Rendering error" 0138 } 0139 } 0140 0141 if let message = message { 0142 if description.characters.count > 0 { 0143 description += ": \(message)" 0144 } else { 0145 description = message 0146 } 0147 } 0148 0149 if let underlyingError = underlyingError { 0150 description += " (\(underlyingError))" 0151 } 0152 0153 return description 0154 } 0155 } 0156 0157 0158 // ============================================================================= 0159 // MARK: - Tag delimiters 0160 0161 /** 0162 A pair of tag delimiters, such as `("{{", "}}")`. 0163 0164 :see Configuration.tagDelimiterPair 0165 :see Tag.tagDelimiterPair 0166 */ 0167 public typealias TagDelimiterPair
Common.swift:128 if let locationDescription = locationDescription {Common.swift:134 if let locationDescription = locationDescription {= (String, String) 0168 0169 0170 // ============================================================================= 0171 // MARK: - HTML escaping 0172 0173 /** 0174 HTML-escapes a string by replacing `<`, `> `, `&`, `'` and `"` with HTML entities. 0175 0176 - parameter string: A string. 0177 - returns: The HTML-escaped string. 0178 */ 0179 public func escapeHTML
Configuration.swift:318 public var tagDelimiterPair: TagDelimiterPairTemplateParser.swift:45 private let tagDelimiterPair: TagDelimiterPairTemplateParser.swift:47 init(tokenConsumer: TemplateTokenConsumer, tagDelimiterPair: TagDelimiterPair) {TemplateParser.swift:349 let tagDelimiterPair : TagDelimiterPairTemplateParser.swift:361 init(tagDelimiterPair : TagDelimiterPair) {TemplateToken.swift:30 case EscapedVariable(content: String, tagDelimiterPair: TagDelimiterPair)TemplateToken.swift:33 case UnescapedVariable(content: String, tagDelimiterPair: TagDelimiterPair)TemplateToken.swift:39 case Section(content: String, tagDelimiterPair: TagDelimiterPair)TemplateToken.swift:42 case InvertedSection(content: String, tagDelimiterPair: TagDelimiterPair)TemplateToken.swift:71 var tagDelimiterPair: TagDelimiterPair? {SectionTag.swift:41 var tagDelimiterPair: TagDelimiterPair { return openingToken.tagDelimiterPair! }Tag.swift:117 var tagDelimiterPair: TagDelimiterPair { get }VariableTag.swift:39 var tagDelimiterPair: TagDelimiterPair { return token.tagDelimiterPair! }(string: String) -> String { 0180 let escapeTable: [Character: String] = [ 0181 "<": "<", 0182 ">": ">", 0183 "&": "&", 0184 "'": "'", 0185 "\"": """, 0186 ] 0187 var escaped = "" 0188 for c in string.characters { 0189 if let escapedString = escapeTable[c] { 0190 escaped += escapedString 0191 } else { 0192 escaped.append(c) 0193 } 0194 } 0195 return escaped 0196 } 0197
HTMLEscapeHelper.swift:41 return Rendering(escapeHTML(rendering.string), rendering.contentType)RenderingEngine.swift:75 buffer.appendContentsOf(escapeHTML(rendering.string))RenderingEngine.swift:192 string = escapeHTML(rendering.string)