refactor(variable): Deprecate whitespace in filters
This commit is contained in:
40
CHANGELOG.md
40
CHANGELOG.md
@@ -7,24 +7,23 @@
|
|||||||
- It is no longer possible to create `Context` objects. Instead, you can pass a
|
- It is no longer possible to create `Context` objects. Instead, you can pass a
|
||||||
dictionary directly to a `Template`s `render` method.
|
dictionary directly to a `Template`s `render` method.
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
- try template.render(Context(dictionary: ["name": "Kyle"]))
|
- try template.render(Context(dictionary: ["name": "Kyle"]))
|
||||||
+ try template.render(["name": "Kyle"])
|
+ try template.render(["name": "Kyle"])
|
||||||
```
|
```
|
||||||
|
|
||||||
- Template loader are no longer passed into a `Context`, instead you will need
|
- Template loader are no longer passed into a `Context`, instead you will need
|
||||||
to pass the `Loader` to an `Environment` and create a template from the
|
to pass the `Loader` to an `Environment` and create a template from the
|
||||||
`Environment`.
|
`Environment`.
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
let loader = FileSystemLoader(paths: ["templates/"])
|
let loader = FileSystemLoader(paths: ["templates/"])
|
||||||
|
|
||||||
- let template = loader.loadTemplate(name: "index.html")
|
- let template = loader.loadTemplate(name: "index.html")
|
||||||
- try template.render(Context(dictionary: ["loader": loader]))
|
- try template.render(Context(dictionary: ["loader": loader]))
|
||||||
|
+ let environment = Environment(loader: loader)
|
||||||
+ let environment = Environment(loader: loader)
|
+ try environment.renderTemplate(name: "index.html")
|
||||||
+ try environment.renderTemplate(name: "index.html")
|
```
|
||||||
```
|
|
||||||
|
|
||||||
- `Loader`s will now throw a `TemplateDoesNotExist` error when a template
|
- `Loader`s will now throw a `TemplateDoesNotExist` error when a template
|
||||||
is not found.
|
is not found.
|
||||||
@@ -44,17 +43,24 @@
|
|||||||
- New `{% filter %}` tag allowing you to perform a filter across the contents
|
- New `{% filter %}` tag allowing you to perform a filter across the contents
|
||||||
of a block.
|
of a block.
|
||||||
|
|
||||||
```html+django
|
```html+django
|
||||||
{% filter lowercase %}
|
{% filter lowercase %}
|
||||||
This Text Will Be Lowercased.
|
This Text Will Be Lowercased.
|
||||||
{% endfilter %}
|
{% endfilter %}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deprecations
|
### Deprecations
|
||||||
|
|
||||||
- `Template` initialisers have been deprecated in favour of using a template
|
- `Template` initialisers have been deprecated in favour of using a template
|
||||||
loader such as `FileSystemLoader` inside an `Environment`.
|
loader such as `FileSystemLoader` inside an `Environment`.
|
||||||
|
|
||||||
|
- The use of whitespace inside variable filter expression is now deprecated.
|
||||||
|
|
||||||
|
```diff
|
||||||
|
- {{ name | uppercase }}
|
||||||
|
+ {{ name|uppercase }}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## 0.7.1
|
## 0.7.1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user