platform/packages/jael/jael_preprocessor
2021-03-07 23:20:52 +08:00
..
example Add 'packages/jael/' from commit 'af168281d94cda98a8fd333618696e92f4e035c5' 2020-02-15 18:22:11 -05:00
lib Add 'packages/jael/' from commit 'af168281d94cda98a8fd333618696e92f4e035c5' 2020-02-15 18:22:11 -05:00
test Add 'packages/jael/' from commit 'af168281d94cda98a8fd333618696e92f4e035c5' 2020-02-15 18:22:11 -05:00
.gitignore Add 'packages/jael/' from commit 'af168281d94cda98a8fd333618696e92f4e035c5' 2020-02-15 18:22:11 -05:00
analysis_options.yaml Add 'packages/jael/' from commit 'af168281d94cda98a8fd333618696e92f4e035c5' 2020-02-15 18:22:11 -05:00
CHANGELOG.md Add 'packages/jael/' from commit 'af168281d94cda98a8fd333618696e92f4e035c5' 2020-02-15 18:22:11 -05:00
LICENSE Add 'packages/jael/' from commit 'af168281d94cda98a8fd333618696e92f4e035c5' 2020-02-15 18:22:11 -05:00
mono_pkg.yaml Add 'packages/jael/' from commit 'af168281d94cda98a8fd333618696e92f4e035c5' 2020-02-15 18:22:11 -05:00
pubspec.yaml Updated Jael Preprocessor 2021-03-07 23:20:52 +08:00
README.md Add 'packages/jael/' from commit 'af168281d94cda98a8fd333618696e92f4e035c5' 2020-02-15 18:22:11 -05:00

jael_preprocessor

Pub build status

A pre-processor for resolving blocks and includes within Jael templates.

Installation

In your pubspec.yaml:

dependencies:
  jael_prepreprocessor: ^1.0.0-alpha

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:jael_preprocessor/jael_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.