Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ccd9402682 | ||
|
|
9f0b9388d2 | ||
|
|
38f5faec78 | ||
|
|
a724419474 | ||
|
|
12b3a2e9bd | ||
|
|
47a44889ae | ||
|
|
01740c61d3 | ||
|
|
c729a7d58f | ||
|
|
973e190edf | ||
|
|
e134aafe7f | ||
|
|
88fd776a02 | ||
|
|
8480648bd3 | ||
|
|
521a599a60 | ||
|
|
371a4737d9 | ||
|
|
61919c5e8e | ||
|
|
7c635975d1 | ||
|
|
fd107355c2 | ||
|
|
f5f85d95a9 | ||
|
|
22440c5369 |
21
CHANGELOG.md
21
CHANGELOG.md
@@ -1,4 +1,19 @@
|
||||
# Stencil Changelog
|
||||
## 0.14.2
|
||||
|
||||
### Internal Changes
|
||||
|
||||
- Update Spectre (0.10) and PathKit to support Xcode 13.
|
||||
[Astromonkee](https://github.com/astromonkee)
|
||||
[#314](https://github.com/stencilproject/Stencil/pull/314)
|
||||
|
||||
## 0.14.1
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix for crashing range indexes when variable length is 1.
|
||||
[Łukasz Kuczborski](https://github.com/lkuczborski)
|
||||
[#306](https://github.com/stencilproject/Stencil/pull/306)
|
||||
|
||||
|
||||
## 0.14.0
|
||||
|
||||
@@ -15,10 +30,6 @@
|
||||
[Ilya Puchka](https://github.com/ilyapuchka)
|
||||
[#203](https://github.com/stencilproject/Stencil/pull/203)
|
||||
|
||||
### Deprecations
|
||||
|
||||
_None_
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fixed using parenthesis in boolean expressions, they now can be used without spaces around them.
|
||||
|
||||
102
Gemfile.lock
102
Gemfile.lock
@@ -1,97 +1,119 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (3.0.2)
|
||||
activesupport (4.2.11.3)
|
||||
i18n (~> 0.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
addressable (2.7.0)
|
||||
CFPropertyList (3.0.4)
|
||||
rexml
|
||||
activesupport (6.1.4.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
tzinfo (~> 2.0)
|
||||
zeitwerk (~> 2.3)
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
algoliasearch (1.27.3)
|
||||
algoliasearch (1.27.5)
|
||||
httpclient (~> 2.8, >= 2.8.3)
|
||||
json (>= 1.5.1)
|
||||
atomos (0.1.3)
|
||||
claide (1.0.3)
|
||||
cocoapods (1.9.3)
|
||||
activesupport (>= 4.0.2, < 5)
|
||||
cocoapods (1.11.2)
|
||||
addressable (~> 2.8)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
cocoapods-core (= 1.9.3)
|
||||
cocoapods-core (= 1.11.2)
|
||||
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
||||
cocoapods-downloader (>= 1.2.2, < 2.0)
|
||||
cocoapods-downloader (>= 1.4.0, < 2.0)
|
||||
cocoapods-plugins (>= 1.0.0, < 2.0)
|
||||
cocoapods-search (>= 1.0.0, < 2.0)
|
||||
cocoapods-stats (>= 1.0.0, < 2.0)
|
||||
cocoapods-trunk (>= 1.4.0, < 2.0)
|
||||
cocoapods-try (>= 1.1.0, < 2.0)
|
||||
colored2 (~> 3.1)
|
||||
escape (~> 0.0.4)
|
||||
fourflusher (>= 2.3.0, < 3.0)
|
||||
gh_inspector (~> 1.0)
|
||||
molinillo (~> 0.6.6)
|
||||
molinillo (~> 0.8.0)
|
||||
nap (~> 1.0)
|
||||
ruby-macho (~> 1.4)
|
||||
xcodeproj (>= 1.14.0, < 2.0)
|
||||
cocoapods-core (1.9.3)
|
||||
activesupport (>= 4.0.2, < 6)
|
||||
ruby-macho (>= 1.0, < 3.0)
|
||||
xcodeproj (>= 1.21.0, < 2.0)
|
||||
cocoapods-core (1.11.2)
|
||||
activesupport (>= 5.0, < 7)
|
||||
addressable (~> 2.8)
|
||||
algoliasearch (~> 1.0)
|
||||
concurrent-ruby (~> 1.1)
|
||||
fuzzy_match (~> 2.0.4)
|
||||
nap (~> 1.0)
|
||||
netrc (~> 0.11)
|
||||
public_suffix (~> 4.0)
|
||||
typhoeus (~> 1.0)
|
||||
cocoapods-deintegrate (1.0.4)
|
||||
cocoapods-downloader (1.4.0)
|
||||
cocoapods-deintegrate (1.0.5)
|
||||
cocoapods-downloader (1.5.1)
|
||||
cocoapods-plugins (1.0.0)
|
||||
nap
|
||||
cocoapods-search (1.0.0)
|
||||
cocoapods-stats (1.1.0)
|
||||
cocoapods-trunk (1.5.0)
|
||||
cocoapods-search (1.0.1)
|
||||
cocoapods-trunk (1.6.0)
|
||||
nap (>= 0.8, < 2.0)
|
||||
netrc (~> 0.11)
|
||||
cocoapods-try (1.2.0)
|
||||
colored2 (3.1.2)
|
||||
concurrent-ruby (1.1.6)
|
||||
concurrent-ruby (1.1.9)
|
||||
escape (0.0.4)
|
||||
ethon (0.12.0)
|
||||
ffi (>= 1.3.0)
|
||||
faraday (1.0.1)
|
||||
ethon (0.15.0)
|
||||
ffi (>= 1.15.0)
|
||||
faraday (1.8.0)
|
||||
faraday-em_http (~> 1.0)
|
||||
faraday-em_synchrony (~> 1.0)
|
||||
faraday-excon (~> 1.1)
|
||||
faraday-httpclient (~> 1.0.1)
|
||||
faraday-net_http (~> 1.0)
|
||||
faraday-net_http_persistent (~> 1.1)
|
||||
faraday-patron (~> 1.0)
|
||||
faraday-rack (~> 1.0)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ffi (1.13.1)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-em_http (1.0.0)
|
||||
faraday-em_synchrony (1.0.0)
|
||||
faraday-excon (1.1.0)
|
||||
faraday-httpclient (1.0.1)
|
||||
faraday-net_http (1.0.1)
|
||||
faraday-net_http_persistent (1.2.0)
|
||||
faraday-patron (1.0.0)
|
||||
faraday-rack (1.0.0)
|
||||
ffi (1.15.4)
|
||||
fourflusher (2.3.1)
|
||||
fuzzy_match (2.0.4)
|
||||
gh_inspector (1.1.3)
|
||||
httpclient (2.8.3)
|
||||
i18n (0.9.5)
|
||||
i18n (1.8.11)
|
||||
concurrent-ruby (~> 1.0)
|
||||
json (2.3.1)
|
||||
minitest (5.14.1)
|
||||
molinillo (0.6.6)
|
||||
json (2.6.1)
|
||||
minitest (5.14.4)
|
||||
molinillo (0.8.0)
|
||||
multipart-post (2.1.1)
|
||||
nanaimo (0.3.0)
|
||||
nap (1.1.0)
|
||||
netrc (0.11.0)
|
||||
octokit (4.18.0)
|
||||
octokit (4.21.0)
|
||||
faraday (>= 0.9)
|
||||
sawyer (~> 0.8.0, >= 0.5.3)
|
||||
public_suffix (4.0.5)
|
||||
rake (13.0.1)
|
||||
ruby-macho (1.4.0)
|
||||
public_suffix (4.0.6)
|
||||
rake (13.0.6)
|
||||
rexml (3.2.5)
|
||||
ruby-macho (2.5.1)
|
||||
ruby2_keywords (0.0.5)
|
||||
sawyer (0.8.2)
|
||||
addressable (>= 2.3.5)
|
||||
faraday (> 0.8, < 2.0)
|
||||
thread_safe (0.3.6)
|
||||
typhoeus (1.4.0)
|
||||
ethon (>= 0.9.0)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
xcodeproj (1.17.1)
|
||||
tzinfo (2.0.4)
|
||||
concurrent-ruby (~> 1.0)
|
||||
xcodeproj (1.21.0)
|
||||
CFPropertyList (>= 2.3.3, < 4.0)
|
||||
atomos (~> 0.1.3)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
colored2 (~> 3.1)
|
||||
nanaimo (~> 0.3.0)
|
||||
rexml (~> 3.2.4)
|
||||
zeitwerk (2.5.1)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
"repositoryURL": "https://github.com/kylef/PathKit.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "73f8e9dca9b7a3078cb79128217dc8f2e585a511",
|
||||
"version": "1.0.0"
|
||||
"revision": "3bfd2737b700b9a36565a8c94f4ad2b050a5e574",
|
||||
"version": "1.0.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -15,8 +15,8 @@
|
||||
"repositoryURL": "https://github.com/kylef/Spectre.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "f14ff47f45642aa5703900980b014c2e9394b6e5",
|
||||
"version": "0.9.0"
|
||||
"revision": "26cc5e9ae0947092c7139ef7ba612e34646086c7",
|
||||
"version": "0.10.1"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -7,8 +7,8 @@ let package = Package(
|
||||
.library(name: "Stencil", targets: ["Stencil"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/kylef/PathKit.git", from: "1.0.0"),
|
||||
.package(url: "https://github.com/kylef/Spectre.git", from: "0.9.0")
|
||||
.package(url: "https://github.com/kylef/PathKit.git", from: "1.0.1"),
|
||||
.package(url: "https://github.com/kylef/Spectre.git", from: "0.10.1")
|
||||
],
|
||||
targets: [
|
||||
.target(name: "Stencil", dependencies: [
|
||||
|
||||
@@ -7,8 +7,8 @@ let package = Package(
|
||||
.library(name: "Stencil", targets: ["Stencil"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/kylef/PathKit.git", from: "1.0.0"),
|
||||
.package(url: "https://github.com/kylef/Spectre.git", from: "0.9.0")
|
||||
.package(url: "https://github.com/kylef/PathKit.git", from: "1.0.1"),
|
||||
.package(url: "https://github.com/kylef/Spectre.git", from: "0.10.1")
|
||||
],
|
||||
targets: [
|
||||
.target(name: "Stencil", dependencies: [
|
||||
|
||||
@@ -60,7 +60,7 @@ public class VariableNode: NodeType {
|
||||
let elseExpression: Resolvable?
|
||||
|
||||
class func parse(_ parser: TokenParser, token: Token) throws -> NodeType {
|
||||
var components = token.components
|
||||
let components = token.components
|
||||
|
||||
func hasToken(_ token: String, at index: Int) -> Bool {
|
||||
return components.count > (index + 1) && components[index] == token
|
||||
|
||||
@@ -48,7 +48,7 @@ public struct Variable: Equatable, Resolvable {
|
||||
|
||||
/// Resolve the variable in the given context
|
||||
public func resolve(_ context: Context) throws -> Any? {
|
||||
if (variable.hasPrefix("'") && variable.hasSuffix("'")) || (variable.hasPrefix("\"") && variable.hasSuffix("\"")) {
|
||||
if variable.count > 1 && ((variable.hasPrefix("'") && variable.hasSuffix("'")) || (variable.hasPrefix("\"") && variable.hasSuffix("\""))) {
|
||||
// String literal
|
||||
return String(variable[variable.index(after: variable.startIndex) ..< variable.index(before: variable.endIndex)])
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Stencil",
|
||||
"version": "0.14.0",
|
||||
"version": "0.14.2",
|
||||
"summary": "Stencil is a simple and powerful template language for Swift.",
|
||||
"homepage": "https://stencil.fuller.li",
|
||||
"license": {
|
||||
@@ -13,7 +13,7 @@
|
||||
"social_media_url": "https://twitter.com/kylefuller",
|
||||
"source": {
|
||||
"git": "https://github.com/stencilproject/Stencil.git",
|
||||
"tag": "0.14.0"
|
||||
"tag": "0.14.2"
|
||||
},
|
||||
"source_files": [
|
||||
"Sources/*.swift"
|
||||
|
||||
@@ -63,13 +63,25 @@ final class VariableTests: XCTestCase {
|
||||
let result = try variable.resolve(self.context) as? String
|
||||
try expect(result) == "name"
|
||||
}
|
||||
|
||||
it("can resolve a string literal with one double quote") {
|
||||
let variable = Variable("\"")
|
||||
let result = try variable.resolve(self.context) as? String
|
||||
try expect(result).to.beNil()
|
||||
}
|
||||
|
||||
it("can resolve a string literal with single quotes") {
|
||||
let variable = Variable("'name'")
|
||||
let result = try variable.resolve(self.context) as? String
|
||||
try expect(result) == "name"
|
||||
}
|
||||
|
||||
|
||||
it("can resolve a string literal with one single quote") {
|
||||
let variable = Variable("'")
|
||||
let result = try variable.resolve(self.context) as? String
|
||||
try expect(result).to.beNil()
|
||||
}
|
||||
|
||||
it("can resolve an integer literal") {
|
||||
let variable = Variable("5")
|
||||
let result = try variable.resolve(self.context) as? Int
|
||||
|
||||
@@ -58,9 +58,9 @@ author = 'Kyle Fuller'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.14.0'
|
||||
version = '0.14.2'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.14.0'
|
||||
release = '0.14.2'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
@@ -26,7 +26,7 @@ If you're using CocoaPods, you can add Stencil to your ``Podfile`` and then run
|
||||
|
||||
.. code-block:: ruby
|
||||
|
||||
pod 'Stencil', '~> 0.14.0'
|
||||
pod 'Stencil', '~> 0.14.2'
|
||||
|
||||
Carthage
|
||||
--------
|
||||
@@ -37,7 +37,7 @@ Carthage
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
github "stencilproject/Stencil" ~> 0.14.0
|
||||
github "stencilproject/Stencil" ~> 0.14.2
|
||||
|
||||
2) Checkout your dependencies, generate the Stencil Xcode project, and then use Carthage to build Stencil:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user