jael 2.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 79

jael #

Pub build status

A simple server-side HTML templating engine for Dart.

See documentation.

Installation #

In your pubspec.yaml:

  jael: ^2.0.0


The core jael package exports classes for parsing Jael templates, an AST library, and a Renderer class that generates HTML on-the-fly.

import 'package:code_buffer/code_buffer.dart';
import 'package:jael/jael.dart' as jael;
import 'package:symbol_table/symbol_table.dart';

void myFunction() {
    const template = '''
    <img src=profile['avatar']>

    var buf = CodeBuffer();
    var document = jael.parseDocument(template, sourceUrl: 'test.jael', asDSX: false);
    var scope = SymbolTable(values: {
      'profile': {
        'avatar': 'thosakwe.png',

    const jael.Renderer().render(document, buf, scope);

Pre-processing (i.e. handling of blocks and includes) is handled by package:jael_preprocessor..

2.0.2 #

  • Fixed handling of if in non-strict mode.
  • Roll JaelFormatter and jaelfmt.

2.0.1 #

  • Fixed bug where the textarea name check would never return true.

2.0.0+1 #

  • Meta-update for Pub score.

2.0.0 #

  • Dart 2 updates.
  • Remove usage of package:dart2_constant.

1.0.6+1 #

  • Ensure <element> passes attributes.

1.0.6 #

  • Add index-as to for-each.
  • Support registering + rendering custom elements.
  • Improve handling of booleans in non-strict mode.

1.0.5 #

  • Add support for DSX, a port of JSX to Dart.

1.0.4 #

  • Skip HTML comments in free text.

1.0.3 #

  • Fix a scanner bug that prevented proper parsing of HTML nodes followed by free text.
  • Don't trim <textarea> content.

1.0.2 #

  • Use package:dart2_constant.
  • Upgrade package:symbol_table.
  • Added Renderer.errorDocument.

1.0.1 #

  • Reworked the scanner; thereby fixing an extremely pesky bug that prevented successful parsing of Jael files containing JavaScript.


import 'dart:io';
import 'package:charcode/charcode.dart';
import 'package:code_buffer/code_buffer.dart';
import 'package:jael/jael.dart' as jael;
import 'package:symbol_table/symbol_table.dart';

main() {
  while (true) {
    var buf = StringBuffer();
    int ch;
    print('Enter lines of Jael text, terminated by CTRL^D.');
    print('All environment variables are injected into the template scope.');

    while ((ch = stdin.readByteSync()) != $eot && ch != -1) {

    var document = jael.parseDocument(
      sourceUrl: 'stdin',
      onError: stderr.writeln,

    if (document == null) {
      stderr.writeln('Could not parse the given text.');
    } else {
      var output = CodeBuffer();
      const jael.Renderer().render(
        SymbolTable(values: Platform.environment),
        strictResolution: false,
      print('GENERATED HTML:\n$output');

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate jael

2. Use it

The package has the following executables:

$ jaelfmt

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  jael: ^2.0.2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:jael/jael.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 30, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health issues and suggestions

Document public APIs. (-0.61 points)

297 out of 301 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance issues and suggestions

Homepage URL isn't helpful. (-10 points)

Update the homepage field from pubspec.yaml: link to a website about the package or use the source repository URL.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
args ^1.0.0 1.6.0
charcode ^1.0.0 1.1.3
code_buffer ^1.0.0 1.0.1
source_span ^1.0.0 1.7.0
string_scanner ^1.0.0 1.0.5
symbol_table ^2.0.0 2.0.0
Transitive dependencies
collection 1.14.12
meta 1.1.8
path 1.6.4
term_glyph 1.1.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0