angel patch
This commit is contained in:
parent
323e722675
commit
a8a45940ed
3 changed files with 8 additions and 4 deletions
|
@ -77,5 +77,7 @@ main() async {
|
||||||
var server = await app.startServer(null, 3000);
|
var server = await app.startServer(null, 3000);
|
||||||
print('Listening at http://${server.address.address}:${server.port}');
|
print('Listening at http://${server.address.address}:${server.port}');
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To apply additional transforms to parsed documents, provide a
|
||||||
|
set of `patch` functions, like in `package:jael_preprocessor`.
|
|
@ -10,8 +10,10 @@ import 'package:symbol_table/symbol_table.dart';
|
||||||
///
|
///
|
||||||
/// To enable "minified" output, you need to override the [createBuffer] function,
|
/// To enable "minified" output, you need to override the [createBuffer] function,
|
||||||
/// to instantiate a [CodeBuffer] that emits no spaces or line breaks.
|
/// to instantiate a [CodeBuffer] that emits no spaces or line breaks.
|
||||||
|
///
|
||||||
|
/// To apply additional transforms to parsed documents, provide a set of [patch] functions.
|
||||||
AngelConfigurer jael(Directory viewsDirectory,
|
AngelConfigurer jael(Directory viewsDirectory,
|
||||||
{String fileExtension, bool cacheViews: false, CodeBuffer createBuffer()}) {
|
{String fileExtension, bool cacheViews: false, Iterable<Patcher> patch, CodeBuffer createBuffer()}) {
|
||||||
var cache = <String, Document>{};
|
var cache = <String, Document>{};
|
||||||
fileExtension ??= '.jl';
|
fileExtension ??= '.jl';
|
||||||
createBuffer ??= () => new CodeBuffer();
|
createBuffer ??= () => new CodeBuffer();
|
||||||
|
@ -31,7 +33,7 @@ AngelConfigurer jael(Directory viewsDirectory,
|
||||||
processed = doc;
|
processed = doc;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
processed = await resolve(doc, viewsDirectory, onError: errors.add);
|
processed = await resolve(doc, viewsDirectory, patch: patch, onError: errors.add);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
// Ignore these errors, so that we can show syntax errors.
|
// Ignore these errors, so that we can show syntax errors.
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel_jael
|
name: angel_jael
|
||||||
version: 1.0.0-alpha
|
version: 1.0.0-alpha+1
|
||||||
description: Angel support for the Jael templating engine.
|
description: Angel support for the Jael templating engine.
|
||||||
author: Tobe O <thosakwe@gmail.com>
|
author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/jael/tree/master/jael
|
homepage: https://github.com/angel-dart/jael/tree/master/jael
|
||||||
|
|
Loading…
Reference in a new issue