10 KiB
Stencil Changelog
Master
Bug Fixes
None
Breaking Changes
None
New Features
None
Internal Changes
None
0.12.1
Internal Changes
- Updated the PathKit dependency to 0.9.0 in CocoaPods, to be in line with SPM.
David Jennes #227
0.12.0
Enhancements
- Added an optional second parameter to the
includetag for passing a sub context to the included file.
Yonas Kolb #214 - Variables now support the subscript notation. For example, if you have a variable
key = "name", and an objectitem = ["name": "John"], then{{ item[key] }}will evaluate to "John".
David Jennes #215 - Adds support for using spaces in filter expression.
Ilya Puchka #178 - Improvements in error reporting.
Ilya Puchka #167
Bug Fixes
- Fixed using quote as a filter parameter.
Ilya Puchka #210
0.11.0 (2018-04-04)
Enhancements
- Added support for resolving superclass properties for not-NSObject subclasses.
Ilya Puchka #152 - The
{% for %}tag can now iterate over tuples, structures and classes via their stored properties.
Ilya Puchka #172 - Added
splitfilter.
Ilya Puchka #187 - Allow default string filters to be applied to arrays.
Ilya Puchka #190 - Similar filters are suggested when unknown filter is used.
Ilya Puchka #186 - Added
indentfilter.
Ilya Puchka #188 - Allow using new lines inside tags.
Ilya Puchka #202 - Added support for iterating arrays of tuples.
Ilya Puchka #177 - Added support for ranges in if-in expression.
Ilya Puchka #193 - Added property
forloop.lengthto get number of items in the loop.
Ilya Puchka #171 - Now you can construct ranges for loops using
a...bsyntax, i.e.for i in 1...array.count.
Ilya Puchka #192
Bug Fixes
- Fixed rendering
{{ block.super }}with several levels of inheritance.
Ilya Puchka #154 - Fixed checking dictionary values for nil in
defaultfilter.
Ilya Puchka #162 - Fixed comparing string variables with string literals, in Swift 4 string literals became
Substringand thus couldn't be directly compared to strings.
Ilya Puchka #168 - Integer literals now resolve into Int values, not Float.
Ilya Puchka #181 - Fixed accessing properties of optional properties via reflection.
Ilya Puchka #204 - No longer render optional values in arrays as
Optional(..).
Ilya Puchka #205 - Fixed subscription tuples by value index, i.e.
{{ tuple.0 }}.
Ilya Puchka #172
0.10.1
Enhancements
- Add support for Xcode 9.1.
0.10.0
Enhancements
- Adds
counter0to for loop context allowing you to get the current index of the for loop 0 indexed. - Introduces a new
DictionaryLoaderfor loading templates from a Swift Dictionary. - Added
inexpression in if tag for strings and arrays of hashable types - You can now access the amount of items in a dictionary using the
countproperty.
Bug Fixes
- Fixes a potential crash when using the
{% for %}template tag with the incorrect amount of arguments. - Fixes a potential crash when using incomplete tokens in a template for
example,
{%%}or{{}}. - Fixes evaluating nil properties as true
0.9.0
Enhancements
-
forblock now can containwhereexpression to filter array items. For example{% for item in items where item > 1 %}is now supported. -
ifblocks may now contain else if (elif) conditions.{% if one or two and not three %} one or two but not three {% elif four %} four {% else %} not one, two, or four {% endif %} -
forblock now allows you to iterate over array of tuples or dictionaries.{% for key,value in thing %} <li>{{ key }}: {{ value }}</li> {% endfor %}
Bug Fixes
- You can now use literal filter arguments which contain quotes. #98
0.8.0
Breaking
-
It is no longer possible to create
Contextobjects. Instead, you can pass a dictionary directly to aTemplatesrendermethod.- try template.render(Context(dictionary: ["name": "Kyle"])) + try template.render(["name": "Kyle"]) -
Template loader are no longer passed into a
Context, instead you will need to pass theLoaderto anEnvironmentand create a template from theEnvironment.let loader = FileSystemLoader(paths: ["templates/"]) - let template = loader.loadTemplate(name: "index.html") - try template.render(Context(dictionary: ["loader": loader])) + let environment = Environment(loader: loader) + try environment.renderTemplate(name: "index.html") -
Loaders will now throw aTemplateDoesNotExisterror when a template is not found. -
Namespacehas been removed and replaced by extensions. You can create an extension including any custom template tags and filters. A collection of extensions can be passed to anEnvironment.
Enhancements
-
Environmentis a new way to load templates. You can configure an environment with custom template filters, tags and loaders and then create a template from an environment.Environment also provides a convenience method to render a template directly.
-
FileSystemLoaderwill now ensure that template paths are within the base path. Any template names that try to escape the base path will raise aSuspiciousFileOperationerror. -
New
{% filter %}tag allowing you to perform a filter across the contents of a block.{% filter lowercase %} This Text Will Be Lowercased. {% endfilter %} -
You can now use
{{ block.super }}to render a super block from another{% block %}. -
Environmentallows you to provide a customTemplatesubclass, allowing new template to use a specific subclass. -
If expressions may now contain filters on variables. For example
{% if name|uppercase == "TEST" %}is now supported.
Deprecations
-
Templateinitialisers have been deprecated in favour of using a template loader such asFileSystemLoaderinside anEnvironment. -
The use of whitespace inside variable filter expression is now deprecated.
- {{ name | uppercase }} + {{ name|uppercase }}
Bug Fixes
- Restores compatibility with ARM based platforms such as iOS. Stencil 0.7
introduced compilation errors due to using the
Float80type which is not available.
0.7.1
Bug Fixes
- Fixes an issue where using
{% if %}statements which use operators would throw a syntax error.
0.7.0
Breaking
-
TemplateLoaderhas been renamed toFileSystemLoader. TheloadTemplate(s)methods are now throwing and now take labels for thenameandnamesarguments. -
Many internal classes are no longer public. Some APIs were previously accessible due to earlier versions of Swift requiring the types to be public to be able to test. Now we have access to
@testablethese can correctly be private. -
{% ifnot %}tag is now deprecated, please use{% if not %}instead.
Enhancements
-
Variable lookup now supports introspection of Swift types. You can now lookup values of Swift structures and classes inside a Context.
-
If tags can now use prefix and infix operators such as
not,and,or,==,!=,>,>=,<and<=.{% if one or two and not three %} -
You may now register custom template filters which make use of arguments.
-
There is now a
defaultfilter.Hello {{ name|default:"World" }} -
There is now a
joinfilter.{{ value|join:", " }} -
{% for %}tag now supports filters.{% for user in non_admins|default:admins %} {{ user }} {% endfor %}
Bug Fixes
-
Variables (
{{ variable.5 }}) that reference an array index at an unknown index will now resolve tonilinstead of causing a crash.
#72 -
Templates can now extend templates that extend other templates.
#60 -
If comparisons will now treat 0 and below numbers as negative.
0.6.0
Enhancements
- Adds support for Swift 3.0.