Merge pull request #326 from stencilproject/feature/attribution

Add attribution #trivial
This commit is contained in:
David Jennes
2022-07-29 03:05:52 +02:00
committed by GitHub
47 changed files with 274 additions and 2 deletions

View File

@@ -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

View File

@@ -1,4 +1,4 @@
Copyright (c) 2018, Kyle Fuller Copyright (c) 2022, Kyle Fuller
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View File

@@ -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?]]

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 /// 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 {

View File

@@ -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

View File

@@ -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?

View File

@@ -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
} }

View File

@@ -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

View File

@@ -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]

View File

@@ -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 }

View File

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

View File

@@ -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)

View File

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

View File

@@ -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" }

View File

@@ -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.

View File

@@ -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>)

View File

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

View File

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

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
#if !os(Linux) #if !os(Linux)
import Foundation 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. /// 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) {

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
@testable import Stencil @testable import Stencil
import XCTest import XCTest

View File

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

View File

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

View File

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

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
@testable import Stencil @testable import Stencil
import XCTest import XCTest

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
@testable import Stencil @testable import Stencil
import XCTest import XCTest

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
import Stencil import Stencil
import XCTest import XCTest

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
@testable import Stencil @testable import Stencil
import XCTest import XCTest

View File

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

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
@testable import Stencil @testable import Stencil
import XCTest import XCTest

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
@testable import Stencil @testable import Stencil
import XCTest import XCTest

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
@testable import Stencil @testable import Stencil
import XCTest import XCTest

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
@testable import Stencil @testable import Stencil
import XCTest import XCTest

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
import Stencil import Stencil
import XCTest import XCTest

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
@testable import Stencil @testable import Stencil
import XCTest import XCTest

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
@testable import Stencil @testable import Stencil
import XCTest import XCTest

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
import Stencil import Stencil
import XCTest import XCTest

View File

@@ -1,3 +1,9 @@
//
// Stencil
// Copyright © 2022 Stencil
// MIT Licence
//
import Spectre import Spectre
@testable import Stencil @testable import Stencil
import XCTest import XCTest

View File

@@ -50,7 +50,7 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = 'Stencil' project = 'Stencil'
copyright = '2016, Kyle Fuller' copyright = '2022, Kyle Fuller'
author = 'Kyle Fuller' author = 'Kyle Fuller'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for