Add attribution to all source code

This commit is contained in:
David Jennes
2022-07-29 02:43:02 +02:00
parent 6481534f6c
commit 71879ecdc9
45 changed files with 272 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
/// A container for template variables.
public class Context {
var dictionaries: [[String: Any?]]

View File

@@ -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
/// lookup by String.
public protocol DynamicMemberLookup {

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
/// Container for environment data, such as registered extensions
public struct Environment {
/// The class for loading new templates

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
public class TemplateDoesNotExist: Error, CustomStringConvertible {
let templateNames: [String]
let loader: Loader?

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
public protocol Expression: CustomStringConvertible, Resolvable {
func evaluate(context: Context) throws -> Bool
}

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
/// Container for registered tags and filters
open class Extension {
typealias TagParser = (TokenParser, Token) throws -> NodeType

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
class FilterNode: NodeType {
let resolvable: Resolvable
let nodes: [NodeType]

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
func capitalise(_ value: Any?) -> Any? {
if let array = value as? [Any?] {
return array.map { stringify($0).capitalized }

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Foundation
class ForNode: NodeType {

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
enum Operator {
case infix(String, Int, InfixOperator.Type)
case prefix(String, Int, PrefixOperator.Type)

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import PathKit
class IncludeNode: NodeType {

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
class BlockContext {
class var contextKey: String { "block_context" }

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Foundation
/// A structure used to represent a template variable, and to resolve it in a given context.

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Foundation
typealias Line = (content: String, number: UInt, range: Range<String.Index>)

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Foundation
import PathKit

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Foundation
/// Represents a parsed node

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
#if !os(Linux)
import Foundation

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
/// Creates a checker that will stop parsing if it encounters a list of tags.
/// Useful for example for scanning until a given "end"-node.
public func until(_ tags: [String]) -> ((TokenParser, Token) -> Bool) {

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Foundation
import PathKit

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Foundation
extension String {

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Foundation
public struct TrimBehaviour: Equatable {

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Foundation
typealias Number = Float