All Projects → ykmnkmi → jinja.dart

ykmnkmi / jinja.dart

Licence: MIT license
Jinja2 template engine port for Dart.

Programming Languages

dart
5743 projects
HTML
75241 projects

Projects that are alternatives of or similar to jinja.dart

Jingoo
OCaml template engine almost compatible with jinja2
Stars: ✭ 86 (+126.32%)
Mutual labels:  template-engine, jinja2
liquidpy
A port of liquid template engine for python
Stars: ✭ 49 (+28.95%)
Mutual labels:  template-engine, jinja2
templatel
Jinja inspired template language for Emacs Lisp
Stars: ✭ 46 (+21.05%)
Mutual labels:  template-engine, jinja2
Jinja2cpp
Jinja2 C++ (and for C++) almost full-conformance template engine implementation
Stars: ✭ 257 (+576.32%)
Mutual labels:  template-engine, jinja2
Redzone
Lightweight C++ template engine with Jinja2-like syntax
Stars: ✭ 30 (-21.05%)
Mutual labels:  template-engine, jinja2
Cookie
A Template-based File Generator. Like cookiecutter but works with file templates instead of project templates.
Stars: ✭ 261 (+586.84%)
Mutual labels:  template-engine, jinja2
voldemort
A simple static site generator using Jinja2 and Markdown templates.
Stars: ✭ 48 (+26.32%)
Mutual labels:  template-engine, jinja2
Jinja
A very fast and expressive template engine.
Stars: ✭ 8,170 (+21400%)
Mutual labels:  template-engine, jinja2
Tera
A template engine for Rust based on Jinja2/Django
Stars: ✭ 1,873 (+4828.95%)
Mutual labels:  template-engine, jinja2
Sodajs
Light weight but powerful template engine for JavaScript
Stars: ✭ 240 (+531.58%)
Mutual labels:  template-engine
DismissibleExpandedList
A Flutter package to display hierarchical data in the form of list as well as allows to swipe the individual tiles.
Stars: ✭ 29 (-23.68%)
Mutual labels:  dart2
Himl
HTML-based Indented Markup Language for Ruby
Stars: ✭ 236 (+521.05%)
Mutual labels:  template-engine
Sailfish
Simple, small, and extremely fast template engine for Rust
Stars: ✭ 242 (+536.84%)
Mutual labels:  template-engine
Kvantum
An intellectual (HTTP/HTTPS) web server with support for server side templating (Crush, Apache Velocity and JTwig)
Stars: ✭ 17 (-55.26%)
Mutual labels:  template-engine
Eta
Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript
Stars: ✭ 233 (+513.16%)
Mutual labels:  template-engine
tale-pug
Tale Pug is the popular JavaScript Template Engine Pug, formerly Jade, for PHP!
Stars: ✭ 32 (-15.79%)
Mutual labels:  template-engine
Pupa
Simple micro templating
Stars: ✭ 231 (+507.89%)
Mutual labels:  template-engine
Jte
jte is a secure and lightweight template engine for Java.
Stars: ✭ 228 (+500%)
Mutual labels:  template-engine
WhatsAppUIClone
WhatsApp UI Clone with Flutter
Stars: ✭ 66 (+73.68%)
Mutual labels:  dart2
flutter sliding tutorial
User onboarding library with smooth animation of objects and background colors
Stars: ✭ 127 (+234.21%)
Mutual labels:  dart2

jinja

Pub Package Test Status CodeCov

Jinja server-side template engine port for Dart 2. Variables, expressions, control structures and template inheritance.

0.4.0 version is breaking

See CHANGELOG.md.

Documentation

Mostly same as Jinja template documentation. work in progress.

Differences with Python version

  • BigInt and complex numbers are not supported.
  • The default filter compares values with null, no boolean parameter.
  • The defined and undefined tests compares values with null.
  • The map filter compares values with null. Use attribute for fields and item for items. Nested attributes and items are not supported.
  • If Environment({getAttribute}) is not passed, getItem will be used. This allows you to use {{ map.key }} as {{ map['key'] }} expression.
  • work in progress

Dynamically invoked members

  • [], +, -, *, /, ~/, % operators
  • object.length getter
  • object.call getter
  • work in progress
  • also Function.apply(function, ...)

Example

import 'package:jinja/jinja.dart';

// ...

var environment = Environment(blockStart: '...', blockEnd: '...');
var template = environment.fromString('...source...');
print(template.render({'key': value}));
// or write directly to StringSink (IOSink, HttpResponse, ...)
template.renderTo(stringSink, {'key': value});

See also examples with conduit and reflectable.

Status:

TODO:

  • Environment
    • constructor
      • extensions
      • selectAutoescape
    • addExtension
    • compileExpression
    • policies
  • List of Control Structures
    • Macros
    • Call
    • Import
  • Loaders
    • PackageLoader (VM)
    • ...
  • 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
    • Manual
    • Automatic
  • 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 documentation, just create a new issue or even better fork and issue a pull request with your fix.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].