platform/packages/jael/jael
2021-05-15 18:16:37 +08:00
..
bin Publish jael 2021-05-15 18:16:37 +08:00
example Publish jael 2021-05-15 18:16:37 +08:00
lib Publish jael 2021-05-15 18:16:37 +08:00
test Publish jael 2021-05-15 18:16:37 +08:00
.gitignore Restore jael to original name 2021-05-15 17:55:55 +08:00
analysis_options.yaml Restore jael to original name 2021-05-15 17:55:55 +08:00
AUTHORS.md Restore jael to original name 2021-05-15 17:55:55 +08:00
CHANGELOG.md Publish jael 2021-05-15 18:16:37 +08:00
LICENSE Restore jael to original name 2021-05-15 17:55:55 +08:00
mono_pkg.yaml Restore jael to original name 2021-05-15 17:55:55 +08:00
pubspec.yaml Publish jael 2021-05-15 18:16:37 +08:00
README.md Publish jael 2021-05-15 18:16:37 +08:00

jael3

version Null Safety Gitter

License

A simple server-side HTML templating engine for Dart.

See documentation.

Installation

In your pubspec.yaml:

dependencies:
  jael3: ^4.0.0

API

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

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

void myFunction() {
    const template = '''
<html>
  <body>
    <h1>Hello</h1>
    <img src=profile['avatar']>
  </body>
</html>
''';

    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);
    print(buf);
}

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