Skip to content

Commit

Permalink
Updated README.md to reflect #14
Browse files Browse the repository at this point in the history
  • Loading branch information
AliSoftware committed Jan 28, 2017
1 parent 9e3e034 commit 3101ac5
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,15 @@ _TODO: [Write more extension Documentation](https://github.com/SwiftGen/StencilS
* `percent`
* `escapeReservedKeywords`: Escape keywods reserved in the Swift language, by wrapping them inside backticks so that the can be used as regular escape keywords in Swift code.

## SwiftTemplate
## StencilSwiftTemplate

This framework also contains [a `SwiftTemplate` class](https://github.com/SwiftGen/StencilSwiftKit/blob/master/Sources/SwiftTemplate.swift#L10), which is a subclass of `Stencil.Template` dedicated to remove extra newlines when rendering the template.
This framework also contains [a `StencilSwiftTemplate` class](https://github.com/SwiftGen/StencilSwiftKit/blob/master/Sources/StencilSwiftTemplate.swift#L10), which is a subclass of `Stencil.Template` dedicated to remove extra newlines when rendering the template.

Indeed, such extra newlines could otherwise be inserted in the generated output because you want your template to be well formatted, and that can end up with Stencil nodes like `{% for … %}` and `{% if … %}` be alone in some lines of your template and that would render into nothing by themselves, generating empty lines in the output.
Indeed, such extra newlines could otherwise be inserted in the generated output because you want your template to be well formatted, and that can end up with Stencil nodes like `{% for … %}` and `{% if … %}` be alone in some lines of your template and that would render into nothing by themselves, generating empty lines in the output.

This template subclass aims to remove those lines generated by using a simple workaround when rendering, until there's an embeded way to handle that in Stencil proper (see [Stencil/#22](https://github.com/kylef/Stencil/issues/22)).


## Stencil.Extension
## Stencil.Extension & swiftStencilEnvironment

This framework also contains a [`stencilSwiftExtension()`](https://github.com/SwiftGen/StencilSwiftKit/blob/master/Sources/SwiftTemplate.swift#L45-L61) function which returns a `Stencil.Extension` already configured with all the nodes and filters listed above.

Use it when you configure your code to tell `Stencil` to register those nodes & filters, for example when building your `Stencil.Environment(extension: …, templateClass: …)`
This framework also contains [helper methods for `Stencil.Extension` and `Stencil.Environment`](https://github.com/SwiftGen/StencilSwiftKit/blob/master/Sources/Environment.swift), to easily register all the tags and filters listed above on an existing `Stencil.Extension`, as well as to easily get a `Stencil.Environment` preconfigured with both those tags & filters `Extension` and the `StencilSwiftTemplate`.

0 comments on commit 3101ac5

Please sign in to comment.