Add attribution to all source code
This commit is contained in:
@@ -104,6 +104,14 @@ closure_body_length:
|
|||||||
conditional_returns_on_newline:
|
conditional_returns_on_newline:
|
||||||
if_only: true
|
if_only: true
|
||||||
|
|
||||||
|
file_header:
|
||||||
|
required_pattern: |
|
||||||
|
\/\/
|
||||||
|
\/\/ Stencil
|
||||||
|
\/\/ Copyright © 2022 Stencil
|
||||||
|
\/\/ MIT Licence
|
||||||
|
\/\/
|
||||||
|
|
||||||
indentation_width:
|
indentation_width:
|
||||||
indentation_width: 2
|
indentation_width: 2
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
/// A container for template variables.
|
/// A container for template variables.
|
||||||
public class Context {
|
public class Context {
|
||||||
var dictionaries: [[String: Any?]]
|
var dictionaries: [[String: Any?]]
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
/// Marker protocol so we can know which types support `@dynamicMemberLookup`. Add this to your own types that support
|
/// Marker protocol so we can know which types support `@dynamicMemberLookup`. Add this to your own types that support
|
||||||
/// lookup by String.
|
/// lookup by String.
|
||||||
public protocol DynamicMemberLookup {
|
public protocol DynamicMemberLookup {
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
/// Container for environment data, such as registered extensions
|
/// Container for environment data, such as registered extensions
|
||||||
public struct Environment {
|
public struct Environment {
|
||||||
/// The class for loading new templates
|
/// The class for loading new templates
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
public class TemplateDoesNotExist: Error, CustomStringConvertible {
|
public class TemplateDoesNotExist: Error, CustomStringConvertible {
|
||||||
let templateNames: [String]
|
let templateNames: [String]
|
||||||
let loader: Loader?
|
let loader: Loader?
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
public protocol Expression: CustomStringConvertible, Resolvable {
|
public protocol Expression: CustomStringConvertible, Resolvable {
|
||||||
func evaluate(context: Context) throws -> Bool
|
func evaluate(context: Context) throws -> Bool
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
/// Container for registered tags and filters
|
/// Container for registered tags and filters
|
||||||
open class Extension {
|
open class Extension {
|
||||||
typealias TagParser = (TokenParser, Token) throws -> NodeType
|
typealias TagParser = (TokenParser, Token) throws -> NodeType
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
class FilterNode: NodeType {
|
class FilterNode: NodeType {
|
||||||
let resolvable: Resolvable
|
let resolvable: Resolvable
|
||||||
let nodes: [NodeType]
|
let nodes: [NodeType]
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
func capitalise(_ value: Any?) -> Any? {
|
func capitalise(_ value: Any?) -> Any? {
|
||||||
if let array = value as? [Any?] {
|
if let array = value as? [Any?] {
|
||||||
return array.map { stringify($0).capitalized }
|
return array.map { stringify($0).capitalized }
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class ForNode: NodeType {
|
class ForNode: NodeType {
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
enum Operator {
|
enum Operator {
|
||||||
case infix(String, Int, InfixOperator.Type)
|
case infix(String, Int, InfixOperator.Type)
|
||||||
case prefix(String, Int, PrefixOperator.Type)
|
case prefix(String, Int, PrefixOperator.Type)
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import PathKit
|
import PathKit
|
||||||
|
|
||||||
class IncludeNode: NodeType {
|
class IncludeNode: NodeType {
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
class BlockContext {
|
class BlockContext {
|
||||||
class var contextKey: String { "block_context" }
|
class var contextKey: String { "block_context" }
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/// A structure used to represent a template variable, and to resolve it in a given context.
|
/// A structure used to represent a template variable, and to resolve it in a given context.
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
typealias Line = (content: String, number: UInt, range: Range<String.Index>)
|
typealias Line = (content: String, number: UInt, range: Range<String.Index>)
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import PathKit
|
import PathKit
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/// Represents a parsed node
|
/// Represents a parsed node
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
#if !os(Linux)
|
#if !os(Linux)
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
/// Creates a checker that will stop parsing if it encounters a list of tags.
|
/// Creates a checker that will stop parsing if it encounters a list of tags.
|
||||||
/// Useful for example for scanning until a given "end"-node.
|
/// Useful for example for scanning until a given "end"-node.
|
||||||
public func until(_ tags: [String]) -> ((TokenParser, Token) -> Bool) {
|
public func until(_ tags: [String]) -> ((TokenParser, Token) -> Bool) {
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import PathKit
|
import PathKit
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
extension String {
|
extension String {
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct TrimBehaviour: Equatable {
|
public struct TrimBehaviour: Equatable {
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
typealias Number = Float
|
typealias Number = Float
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import PathKit
|
import PathKit
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import PathKit
|
import PathKit
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import PathKit
|
import PathKit
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
import Stencil
|
import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import PathKit
|
import PathKit
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import PathKit
|
import PathKit
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import PathKit
|
import PathKit
|
||||||
import Spectre
|
import Spectre
|
||||||
import Stencil
|
import Stencil
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import PathKit
|
import PathKit
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import PathKit
|
import PathKit
|
||||||
import Spectre
|
import Spectre
|
||||||
import Stencil
|
import Stencil
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
import Stencil
|
import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
import Stencil
|
import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Stencil
|
||||||
|
// Copyright © 2022 Stencil
|
||||||
|
// MIT Licence
|
||||||
|
//
|
||||||
|
|
||||||
import Spectre
|
import Spectre
|
||||||
@testable import Stencil
|
@testable import Stencil
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
Reference in New Issue
Block a user