-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend 'LeafRenderer' so that it can render 'Encodable' contexts (#188)
Motivation: Out of the box, the 'LeafRenderer' offers a base API which can render Leaf templates to a ByteBuffer. This requires the context to be provided as a dictionary. With 'ViewRenderer' conformance the 'LeafRenderer' can render 'View's using an Encodable context. However, the 'LeafRenderer' can't render templates to a ByteBuffer using an 'Encodable' context. Since, the 'LeafEncoder' is internal users also can't encode their context to use the 'base' API. This functionality is helpful when Leaf is used to render documents which aren't HTML; such as SVG or XML. Modifications: - add an extension to 'LeafRenderer' to render a template at the given path using an 'Encodable' context - add a test Results: The LeafRenderer can render templates to bytes using Encodable contexts.
- Loading branch information
Showing
2 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters