Jael Preprocessor
A pre-processor for resolving blocks and includes within Jael 3 templates.
Installation
In your pubspec.yaml:
dependencies:
jael3_preprocessor: ^10.0.0
Usage
It is unlikely that you will directly use this package, as it is more of an implementation detail than a requirement. However, it is responsible for handling include and block directives (template inheritance), so you are a package maintainer and want to support Jael, read on.
To keep things simple, just use the resolve function, which will take care of inheritance for you.
import 'package:jael3_preprocessor/jael3_preprocessor.dart' as jael;
myFunction() async {
var doc = await parseTemplateSomehow();
var resolved = await jael.resolve(doc, dir, onError: (e) => doSomething());
}
You may occasionally need to manually patch in functionality that is not available through the official Jael packages. To achieve this, simply provide an Iterable of Patcher functions:
myOtherFunction(jael.Document doc) {
return jael.resolve(doc, dir, onError: errorHandler, patch: [
syntactic(),
sugar(),
etc(),
]);
}
This package uses package:file, rather than dart:io.
Migrating from 9.x to 10.0.0
The breaking changes of each release are listed in the CHANGELOG. Those of 10.0.0 that may need changes in an app:
- Relative paths: the parent of an
extendis read relative to the directory of the template that extends it, and its includes relative to its own directory, as includes are, where they were read relative to the directory of the first template. Check thesrcofextendandincludetags in templates in subdirectories. - Requires
jael310.