Disable the now tag on Linux
NSDate is unavailable
This commit is contained in:
@@ -13,7 +13,9 @@ public class Namespace {
|
||||
registerTag("for", parser: ForNode.parse)
|
||||
registerTag("if", parser: IfNode.parse)
|
||||
registerTag("ifnot", parser: IfNode.parse_ifnot)
|
||||
#if !os(Linux)
|
||||
registerTag("now", parser: NowNode.parse)
|
||||
#endif
|
||||
registerTag("include", parser: IncludeNode.parse)
|
||||
registerTag("extends", parser: ExtendsNode.parse)
|
||||
registerTag("block", parser: BlockNode.parse)
|
||||
|
||||
@@ -76,6 +76,8 @@ public class VariableNode : NodeType {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if !os(Linux)
|
||||
public class NowNode : NodeType {
|
||||
public let format:Variable
|
||||
|
||||
@@ -114,6 +116,8 @@ public class NowNode : NodeType {
|
||||
return formatter!.stringFromDate(date)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
public class ForNode : NodeType {
|
||||
let variable:Variable
|
||||
|
||||
@@ -4,6 +4,7 @@ import Stencil
|
||||
|
||||
|
||||
func testNowNode() {
|
||||
#if !os(Linux)
|
||||
describe("NowNode") {
|
||||
$0.describe("parsing") {
|
||||
$0.it("parses default format without any now arguments") {
|
||||
@@ -38,4 +39,5 @@ func testNowNode() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -38,9 +38,14 @@ func testTokenParser() {
|
||||
}
|
||||
|
||||
$0.it("can parse a tag token") {
|
||||
let namespace = Namespace()
|
||||
namespace.registerSimpleTag("known") { _ in
|
||||
return ""
|
||||
}
|
||||
|
||||
let parser = TokenParser(tokens: [
|
||||
Token.Block(value: "now"),
|
||||
], namespace: Namespace())
|
||||
Token.Block(value: "known"),
|
||||
], namespace: namespace)
|
||||
|
||||
let nodes = try parser.parse()
|
||||
try expect(nodes.count) == 1
|
||||
|
||||
Reference in New Issue
Block a user