Remove unnessecary uses of Foundation
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
"StencilSpecs/Nodes/*.swift"
|
||||
],
|
||||
"dependencies": {
|
||||
"Spectre": [ "~> 0.4.1" ],
|
||||
"Spectre": [ "~> 0.5.0" ],
|
||||
"PathKit": [ "~> 0.5.0" ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
//
|
||||
// Stencil.h
|
||||
// Stencil
|
||||
//
|
||||
// Created by Kyle Fuller on 23/10/2014.
|
||||
// Copyright (c) 2014 Cocode. All rights reserved.
|
||||
// See LICENSE for more details.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for Stencil.
|
||||
FOUNDATION_EXPORT double StencilVersionNumber;
|
||||
|
||||
//! Project version string for Stencil.
|
||||
FOUNDATION_EXPORT const unsigned char StencilVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <Stencil/PublicHeader.h>
|
||||
@@ -1,6 +1,7 @@
|
||||
import Foundation
|
||||
import PathKit
|
||||
|
||||
|
||||
// A class for loading a template from disk
|
||||
public class TemplateLoader {
|
||||
public let paths: [Path]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import Foundation
|
||||
import PathKit
|
||||
|
||||
|
||||
@@ -6,7 +5,7 @@ public class IncludeNode : NodeType {
|
||||
public let templateName: String
|
||||
|
||||
public class func parse(parser: TokenParser, token: Token) throws -> NodeType {
|
||||
let bits = token.contents.componentsSeparatedByString("\"")
|
||||
let bits = token.contents.characters.split("\"", allowEmptySlices: true).map(String.init)
|
||||
|
||||
guard bits.count == 3 else {
|
||||
throw TemplateSyntaxError("'include' tag takes one argument, the template file to be included")
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
class BlockContext {
|
||||
class var contextKey: String { return "block_context" }
|
||||
|
||||
@@ -14,8 +12,10 @@ class BlockContext {
|
||||
}
|
||||
}
|
||||
|
||||
func any<Element>(elements:[Element], closure:(Element -> Bool)) -> Element? {
|
||||
for element in elements {
|
||||
|
||||
extension CollectionType {
|
||||
func any(closure: Generator.Element -> Bool) -> Generator.Element? {
|
||||
for element in self {
|
||||
if closure(element) {
|
||||
return element
|
||||
}
|
||||
@@ -23,6 +23,8 @@ func any<Element>(elements:[Element], closure:(Element -> Bool)) -> Element? {
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ExtendsNode : NodeType {
|
||||
let templateName: String
|
||||
@@ -36,18 +38,18 @@ class ExtendsNode : NodeType {
|
||||
}
|
||||
|
||||
let parsedNodes = try parser.parse()
|
||||
guard (any(parsedNodes) { $0 is ExtendsNode }) == nil else {
|
||||
guard (parsedNodes.any { $0 is ExtendsNode }) == nil else {
|
||||
throw TemplateSyntaxError("'extends' cannot appear more than once in the same template")
|
||||
}
|
||||
|
||||
let blockNodes = parsedNodes.filter { node in node is BlockNode }
|
||||
|
||||
let nodes = blockNodes.reduce([String:BlockNode](), combine: { (accumulator, node:NodeType) -> [String:BlockNode] in
|
||||
let nodes = blockNodes.reduce([String:BlockNode]()) { (accumulator, node:NodeType) -> [String:BlockNode] in
|
||||
let node = (node as! BlockNode)
|
||||
var dict = accumulator
|
||||
dict[node.name] = node
|
||||
return dict
|
||||
})
|
||||
}
|
||||
|
||||
return ExtendsNode(templateName: bits[1], blocks: nodes)
|
||||
}
|
||||
@@ -75,6 +77,7 @@ class ExtendsNode : NodeType {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class BlockNode : NodeType {
|
||||
let name: String
|
||||
let nodes: [NodeType]
|
||||
|
||||
Reference in New Issue
Block a user