jinja 0.4.0-dev.40
jinja: ^0.4.0-dev.40 copied to clipboard
Jinja2 server-side template engine for Dart. Variables, expressions, control structures and template inheritance.
Jinja for Dart #
Jinja server-side template engine port for Dart 2. Variables, expressions, control structures and template inheritance.
Breaking changes 0.4.0, less dynamic, more Dart'ish #
- remove
Undefined
andmissing
- remove slices and negative indexes
- remove dynamic template imports, only single template path/name,
- remove dynamic
Template.render
method Template.renderMap
renamed toTemplate.render
Loader.listSources
renamed toLoader.listTemplates
FileSystemLoader
moved frompackage:jinja/jinja.dart
topackage:jinja/loaders.dart
- work in progress
Documentation #
Mostly same as Jinja template documentation. work in progress.
Differences #
Common:
- BigInt not supported
Filters:
default
filter compares value withnull
Tests:
defined
andundefined
tests compares value withnull
- complex not supported
- work in progress
Example #
import 'package:jinja/jinja.dart';
// ...
var environment = Environment(blockStart: '...', blockEnd: '...');
var template = env.fromString('...source...');
sink.write(template.render({'key': value}));
See also examples with conduit and reflectable.
Status: #
TODO: #
- Environment
- constructor
- extensions
- selectAutoescape
- addExtension
- compileExpression
- constructor
- Template
- stream
- List of Control Structures
- Macros
- Call
- Import
- Loaders
- PackageLoader
- ...
- Extensions
- i18n
- Expression Statement
- Loop Controls
- Debug Statement
- Template compiler
- ...
Done: #
- Variables
- Filters
- Tests
- Comments
- Whitespace Control
- Escaping
- Line Statements
- Comments
- Blocks
- Template Inheritance
- Base Template
- Child Template
- Super Blocks
- Nesting extends
- Named Block End-Tags
- Block Nesting and Scope
- HTML Escaping
- Working with Manual Escaping
- Working with Automatic Escaping
- List of Control Structures
- For
- If
- Filters
- Assignments
- Block Assignments
- Extends
- Blocks
- Include
- Import Context Behavior
- Expressions with Filters (not all) and Tests
- List of Global Functions
- list
- namespace
- range
- Loaders
- FileSystemLoader
- MapLoader (DictLoader)
- Extensions
- Do Statement
- With Statement
- Autoescape Overrides
Contributing #
If you found a bug, typo or you have better description or comment for documents, just create a new issue or even better fork and issue a pull request with your fix.