platform/jael_preprocessor
2018-11-12 17:03:23 -05:00
..
example fixed JS parsing 2018-04-03 01:04:34 -04:00
lib preproc 2.0.1 2018-11-12 17:03:23 -05:00
test finally got preprocessor fixed 2018-11-10 16:37:00 -05:00
.gitignore ignore .dart_tool 2018-04-03 01:05:21 -04:00
analysis_options.yaml Dart 2 update for pkg:jael 2018-11-02 20:16:03 -04:00
CHANGELOG.md preproc 2.0.1 2018-11-12 17:03:23 -05:00
LICENSE Pre-processor needs work 2017-09-30 01:27:31 -04:00
mono_pkg.yaml Dart 2 update for pkg:jael 2018-11-02 20:16:03 -04:00
pubspec.yaml preproc 2.0.1 2018-11-12 17:03:23 -05:00
README.md Root README.md 2017-10-02 11:46:00 -04: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.