removed trailing witespaces
This commit is contained in:
@@ -42,9 +42,9 @@ class DefaultExtension: Extension {
|
|||||||
registerTag("for", parser: ForNode.parse)
|
registerTag("for", parser: ForNode.parse)
|
||||||
registerTag("if", parser: IfNode.parse)
|
registerTag("if", parser: IfNode.parse)
|
||||||
registerTag("ifnot", parser: IfNode.parse_ifnot)
|
registerTag("ifnot", parser: IfNode.parse_ifnot)
|
||||||
#if !os(Linux)
|
#if !os(Linux)
|
||||||
registerTag("now", parser: NowNode.parse)
|
registerTag("now", parser: NowNode.parse)
|
||||||
#endif
|
#endif
|
||||||
registerTag("include", parser: IncludeNode.parse)
|
registerTag("include", parser: IncludeNode.parse)
|
||||||
registerTag("extends", parser: ExtendsNode.parse)
|
registerTag("extends", parser: ExtendsNode.parse)
|
||||||
registerTag("block", parser: BlockNode.parse)
|
registerTag("block", parser: BlockNode.parse)
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ class ForNode : NodeType {
|
|||||||
let components = token.components()
|
let components = token.components()
|
||||||
|
|
||||||
guard components.count >= 3 && components[2] == "in" &&
|
guard components.count >= 3 && components[2] == "in" &&
|
||||||
(components.count == 4 || (components.count >= 6 && components[4] == "where")) else {
|
(components.count == 4 || (components.count >= 6 && components[4] == "where")) else {
|
||||||
throw TemplateSyntaxError("'for' statements should use the following syntax 'for x in y where condition'.")
|
throw TemplateSyntaxError("'for' statements should use the following syntax 'for x in y where condition'.")
|
||||||
}
|
}
|
||||||
|
|
||||||
let loopVariables = components[1].characters
|
let loopVariables = components[1].characters
|
||||||
@@ -134,14 +134,14 @@ class ForNode : NodeType {
|
|||||||
"last": index == (count - 1),
|
"last": index == (count - 1),
|
||||||
"counter": index + 1,
|
"counter": index + 1,
|
||||||
"counter0": index,
|
"counter0": index,
|
||||||
]
|
]
|
||||||
|
|
||||||
return try context.push(dictionary: ["forloop": forContext]) {
|
return try context.push(dictionary: ["forloop": forContext]) {
|
||||||
return try push(value: item, context: context) {
|
return try push(value: item, context: context) {
|
||||||
try renderNodes(nodes, context)
|
try renderNodes(nodes, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.joined(separator: "")
|
}.joined(separator: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
return try context.push {
|
return try context.push {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ enum IfToken {
|
|||||||
case .variable(_):
|
case .variable(_):
|
||||||
return 0
|
return 0
|
||||||
case .end:
|
case .end:
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ struct Lexer {
|
|||||||
"{{": "}}",
|
"{{": "}}",
|
||||||
"{%": "%}",
|
"{%": "%}",
|
||||||
"{#": "#}",
|
"{#": "#}",
|
||||||
]
|
]
|
||||||
|
|
||||||
while !scanner.isEmpty {
|
while !scanner.isEmpty {
|
||||||
if let text = scanner.scan(until: ["{{", "{%", "{#"]) {
|
if let text = scanner.scan(until: ["{{", "{%", "{#"]) {
|
||||||
|
|||||||
@@ -95,11 +95,11 @@ public struct Variable : Equatable, Resolvable {
|
|||||||
current = array.count
|
current = array.count
|
||||||
}
|
}
|
||||||
} else if let object = current as? NSObject { // NSKeyValueCoding
|
} else if let object = current as? NSObject { // NSKeyValueCoding
|
||||||
#if os(Linux)
|
#if os(Linux)
|
||||||
return nil
|
return nil
|
||||||
#else
|
#else
|
||||||
current = object.value(forKey: bit)
|
current = object.value(forKey: bit)
|
||||||
#endif
|
#endif
|
||||||
} else if let value = current {
|
} else if let value = current {
|
||||||
current = Mirror(reflecting: value).getValue(for: bit)
|
current = Mirror(reflecting: value).getValue(for: bit)
|
||||||
if current == nil {
|
if current == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user