More docs
This commit is contained in:
parent
d8290a3dd9
commit
de52cca2bb
2 changed files with 14 additions and 0 deletions
|
@ -47,6 +47,10 @@ Glemplate does not offer any tooling for reading templates currently. You will n
|
|||
whatever method appropriate for your situation: reading from files, compiling the strings in the
|
||||
app, reading from a database…
|
||||
|
||||
When stored in files, it's suggested that templates use the file naming style
|
||||
`name.<type>.glemp`, where `<type>` signifies the type of content rendered from the template. E.g.
|
||||
`user.html.glemp`.
|
||||
|
||||
## Limitations
|
||||
|
||||
- Static values in templates in place of variables aren't supported.
|
||||
|
|
|
@ -20,12 +20,16 @@ pub type RenderError {
|
|||
/// A referenced assign could not be stringified.
|
||||
AssignNotStringifiable(assign: ast.Var, assigns: Assigns)
|
||||
|
||||
/// A referenced assign didn't have the requested field.
|
||||
AssignFieldNotFound(assign: ast.Var, field: String, assigns: Assigns)
|
||||
|
||||
/// A referenced assign couldn't be accessed with field access.
|
||||
AssignNotFieldAccessible(assign: ast.Var, assigns: Assigns)
|
||||
|
||||
/// A referenced assign didn't have the requested index.
|
||||
AssignIndexOutOfBounds(assign: ast.Var, index: Int, assigns: Assigns)
|
||||
|
||||
/// A referenced assign couldn't be accessed with index access.
|
||||
AssignNotIndexable(assign: ast.Var, assigns: Assigns)
|
||||
|
||||
/// A referenced child template was not found in the template cache.
|
||||
|
@ -51,6 +55,12 @@ pub type EncoderFn =
|
|||
pub type TemplateCache =
|
||||
Map(ast.TemplateName, ast.Template)
|
||||
|
||||
/// Rendering options:
|
||||
///
|
||||
/// - `encoder`: Encoder function to use, it should encode dynamic content in a
|
||||
/// safe way for this template type.
|
||||
/// - `template_cache`: A cache of templates that child templates are looked up
|
||||
/// from, when using Render nodes.
|
||||
pub type RenderOptions {
|
||||
RenderOptions(encoder: EncoderFn, template_cache: TemplateCache)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue