jinja 0.4.0-dev.40 copy "jinja: ^0.4.0-dev.40" to clipboard
jinja: ^0.4.0-dev.40 copied to clipboard

outdated

Jinja2 server-side template engine for Dart. Variables, expressions, control structures and template inheritance.

Jinja for Dart #

Pub

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 and missing
  • remove slices and negative indexes
  • remove dynamic template imports, only single template path/name,
  • remove dynamic Template.render method
  • Template.renderMap renamed to Template.render
  • Loader.listSources renamed to Loader.listTemplates
  • FileSystemLoader moved from package:jinja/jinja.dart to package: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 with null

Tests:

  • defined and undefined tests compares value with null
  • 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
  • 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
    • print
    • 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.

40
likes
0
points
4.84k
downloads

Publisher

unverified uploader

Weekly Downloads

Jinja2 server-side template engine for Dart. Variables, expressions, control structures and template inheritance.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

meta, path, string_scanner, textwrap

More

Packages that depend on jinja