platform/packages/jael/jael
2022-04-24 09:42:33 +08:00
..
bin Updated Jael to use belatuk_symbol_table 2021-09-13 08:30:02 +08:00
example Updated linter to package:lints 2021-09-25 14:32:32 +08:00
lib Updated linter to package:lints 2021-09-25 14:32:32 +08:00
test Updated linter to package:lints 2021-09-25 14:32:32 +08:00
analysis_options.yaml Updated Jael to use belatuk_symbol_table 2021-09-13 08:30:02 +08:00
AUTHORS.md Restore jael to original name 2021-05-15 17:55:55 +08:00
CHANGELOG.md Updated README 2022-04-24 08:55:17 +08:00
LICENSE Updated Jael to use belatuk_symbol_table 2021-09-13 08:30:02 +08:00
melos_jael3.iml Added melos 2022-03-19 09:37:28 +08:00
mono_pkg.yaml Restore jael to original name 2021-05-15 17:55:55 +08:00
pubspec.yaml Published 6.0.0 2022-04-24 09:42:33 +08:00
README.md Updated README 2022-04-24 08:55:17 +08:00

Jael 3

Pub Version (including pre-releases) Null Safety Gitter License

A simple server-side HTML templating engine for Dart.

See documentation.

Installation

In your pubspec.yaml:

dependencies:
  jael3: ^6.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:belatuk_code_buffer/belatuk_code_buffer.dart';
import 'package:belatuk_symbol_table/belatuk_symbol_table.dart';
import 'package:jael3/jael3.dart' as jael;

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..