publish angel_jael
This commit is contained in:
parent
091d7c93a3
commit
048acafa31
5 changed files with 47 additions and 44 deletions
|
@ -1,18 +1,22 @@
|
||||||
# jael
|
# angel3_jael
|
||||||
[![Pub](https://img.shields.io/pub/v/angel_jael.svg)](https://pub.dartlang.org/packages/angel_jael)
|
[![version](https://img.shields.io/badge/pub-v4.0.1-brightgreen)](https://pub.dartlang.org/packages/angel3_jael)
|
||||||
[![build status](https://travis-ci.org/angel-dart/jael.svg)](https://travis-ci.org/angel-dart/jael)
|
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
|
||||||
|
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
|
||||||
|
|
||||||
|
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/jael/angel_jael/LICENSE)
|
||||||
|
|
||||||
|
|
||||||
[Angel](https://angel-dart.github.io)
|
|
||||||
|
[Angel](https://github.com/dukefirehawk/angel/tree/angel3)
|
||||||
support for
|
support for
|
||||||
[Jael](https://github.com/angel-dart/jael).
|
[Jael](https://github.com/dukefirehawk/angel/tree/angel3/packages/jael/jael).
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
In your `pubspec.yaml`:
|
In your `pubspec.yaml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_jael: ^1.0.0-alpha
|
angel3_jael: ^4.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
@ -20,8 +24,8 @@ Just like `mustache` and other renderers, configuring Angel to use
|
||||||
Jael is as simple as calling `app.configure`:
|
Jael is as simple as calling `app.configure`:
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:angel_jael/angel_jael.dart';
|
import 'package:angel3_jael/angel3_jael.dart';
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
|
|
||||||
AngelConfigurer myPlugin(FileSystem fileSystem) {
|
AngelConfigurer myPlugin(FileSystem fileSystem) {
|
||||||
|
@ -34,7 +38,7 @@ AngelConfigurer myPlugin(FileSystem fileSystem) {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
`package:angel_jael` supports caching views, to improve server performance.
|
`package:angel3_jael` supports caching views, to improve server performance.
|
||||||
You might not want to enable this in development, so consider setting
|
You might not want to enable this in development, so consider setting
|
||||||
the flag to `app.isProduction`:
|
the flag to `app.isProduction`:
|
||||||
|
|
||||||
|
@ -49,13 +53,13 @@ The following is a basic example of a server setup that can render Jael
|
||||||
templates from a directory named `views`:
|
templates from a directory named `views`:
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:angel_jael/angel_jael.dart';
|
import 'package:angel3_jael/angel3_jael.dart';
|
||||||
import 'package:file/local.dart';
|
import 'package:file/local.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
|
||||||
main() async {
|
main() async {
|
||||||
var app = new Angel();
|
var app = Angel();
|
||||||
var fileSystem = const LocalFileSystem();
|
var fileSystem = const LocalFileSystem();
|
||||||
|
|
||||||
await app.configure(
|
await app.configure(
|
||||||
|
@ -65,9 +69,9 @@ main() async {
|
||||||
// Render the contents of views/index.jael
|
// Render the contents of views/index.jael
|
||||||
app.get('/', (res) => res.render('index', {'title': 'ESKETTIT'}));
|
app.get('/', (res) => res.render('index', {'title': 'ESKETTIT'}));
|
||||||
|
|
||||||
app.use(() => throw new AngelHttpException.notFound());
|
app.use(() => throw AngelHttpException.notFound());
|
||||||
|
|
||||||
app.logger = new Logger('angel')
|
app.logger = Logger('angel')
|
||||||
..onRecord.listen((rec) {
|
..onRecord.listen((rec) {
|
||||||
print(rec);
|
print(rec);
|
||||||
if (rec.error != null) print(rec.error);
|
if (rec.error != null) print(rec.error);
|
||||||
|
@ -80,4 +84,4 @@ main() async {
|
||||||
```
|
```
|
||||||
|
|
||||||
To apply additional transforms to parsed documents, provide a
|
To apply additional transforms to parsed documents, provide a
|
||||||
set of `patch` functions, like in `package:jael_preprocessor`.
|
set of `patch` functions, like in `package:jael3_preprocessor`.
|
|
@ -1,13 +1,13 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:angel_framework/http.dart';
|
import 'package:angel3_framework/http.dart';
|
||||||
import 'package:angel_jael/angel_jael.dart';
|
import 'package:angel3_jael/angel3_jael.dart';
|
||||||
import 'package:file/local.dart';
|
import 'package:file/local.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
|
||||||
main() async {
|
main() async {
|
||||||
var app = new Angel();
|
var app = Angel();
|
||||||
var http = new AngelHttp(app);
|
var http = AngelHttp(app);
|
||||||
var fileSystem = const LocalFileSystem();
|
var fileSystem = const LocalFileSystem();
|
||||||
|
|
||||||
await app.configure(
|
await app.configure(
|
||||||
|
@ -30,9 +30,9 @@ main() async {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.fallback((req, res) => throw new AngelHttpException.notFound());
|
app.fallback((req, res) => throw AngelHttpException.notFound());
|
||||||
|
|
||||||
app.logger = new Logger('angel')
|
app.logger = Logger('angel')
|
||||||
..onRecord.listen((rec) {
|
..onRecord.listen((rec) {
|
||||||
print(rec);
|
print(rec);
|
||||||
if (rec.error != null) print(rec.error);
|
if (rec.error != null) print(rec.error);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:code_buffer/code_buffer.dart';
|
import 'package:angel3_code_buffer/angel3_code_buffer.dart';
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:jael/jael.dart';
|
import 'package:jael3/jael3.dart';
|
||||||
import 'package:jael_preprocessor/jael_preprocessor.dart';
|
import 'package:jael3_preprocessor/jael3_preprocessor.dart';
|
||||||
import 'package:symbol_table/symbol_table.dart';
|
import 'package:angel3_symbol_table/angel3_symbol_table.dart';
|
||||||
|
|
||||||
/// Configures an Angel server to use Jael to render templates.
|
/// Configures an Angel server to use Jael to render templates.
|
||||||
///
|
///
|
||||||
|
@ -20,7 +20,7 @@ AngelConfigurer jael(Directory viewsDirectory,
|
||||||
CodeBuffer createBuffer()?}) {
|
CodeBuffer createBuffer()?}) {
|
||||||
var cache = <String, Document?>{};
|
var cache = <String, Document?>{};
|
||||||
fileExtension ??= '.jael';
|
fileExtension ??= '.jael';
|
||||||
createBuffer ??= () => new CodeBuffer();
|
createBuffer ??= () => CodeBuffer();
|
||||||
|
|
||||||
return (Angel app) async {
|
return (Angel app) async {
|
||||||
app.viewGenerator = (String name, [Map? locals]) async {
|
app.viewGenerator = (String name, [Map? locals]) async {
|
|
@ -1,22 +1,21 @@
|
||||||
name: angel3_jael2
|
name: angel3_jael
|
||||||
version: 4.0.0
|
version: 4.0.0
|
||||||
description: Angel support for the Jael templating engine, similar to Blade or Liquid.
|
description: Angel support for the Jael templating engine, similar to Blade or Liquid.
|
||||||
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/jael/angel_jael
|
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/jael/angel_jael
|
||||||
publish_to: none
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
angel3_framework: ^4.0.0
|
angel3_framework: ^4.0.0
|
||||||
angel3_code_buffer: ^2.0.0
|
angel3_code_buffer: ^2.0.0
|
||||||
jael2:
|
|
||||||
jael2_preprocessor:
|
|
||||||
angel3_symbol_table: ^2.0.0
|
angel3_symbol_table: ^2.0.0
|
||||||
|
jael3: ^4.0.0
|
||||||
|
jael3_preprocessor: ^4.0.0
|
||||||
file: ^6.0.0
|
file: ^6.0.0
|
||||||
|
logging: ^1.0.1
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
angel3_test: ^4.0.0
|
angel3_test: ^4.0.0
|
||||||
html: ^0.15.0
|
html: ^0.15.0
|
||||||
test: ^1.17.3
|
test: ^1.17.3
|
||||||
dependency_overrides:
|
#dependency_overrides:
|
||||||
web_socket_channel: ^2.0.0
|
# web_socket_channel: ^2.0.0
|
||||||
http: ^0.13.0
|
# http: ^0.13.0
|
|
@ -1,12 +1,12 @@
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:angel_jael/angel_jael.dart';
|
import 'package:angel3_jael/angel3_jael.dart';
|
||||||
import 'package:angel_test/angel_test.dart';
|
import 'package:angel3_test/angel3_test.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:html/parser.dart' as html;
|
import 'package:html/parser.dart' as html;
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
main() {
|
void main() {
|
||||||
// These tests need not actually test that the preprocessor or renderer works,
|
// These tests need not actually test that the preprocessor or renderer works,
|
||||||
// because those packages are already tested.
|
// because those packages are already tested.
|
||||||
//
|
//
|
||||||
|
@ -14,10 +14,10 @@ main() {
|
||||||
late TestClient client;
|
late TestClient client;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
var app = new Angel();
|
var app = Angel();
|
||||||
app.configuration['properties'] = app.configuration;
|
app.configuration['properties'] = app.configuration;
|
||||||
|
|
||||||
var fileSystem = new MemoryFileSystem();
|
var fileSystem = MemoryFileSystem();
|
||||||
var viewsDirectory = fileSystem.directory('views')..createSync();
|
var viewsDirectory = fileSystem.directory('views')..createSync();
|
||||||
|
|
||||||
viewsDirectory.childFile('layout.jael').writeAsStringSync('''
|
viewsDirectory.childFile('layout.jael').writeAsStringSync('''
|
||||||
|
@ -49,9 +49,9 @@ main() {
|
||||||
jael(viewsDirectory),
|
jael(viewsDirectory),
|
||||||
);
|
);
|
||||||
|
|
||||||
app.fallback((req, res) => throw new AngelHttpException.notFound());
|
app.fallback((req, res) => throw AngelHttpException.notFound());
|
||||||
|
|
||||||
app.logger = new Logger('angel')
|
app.logger = Logger('angel')
|
||||||
..onRecord.listen((rec) {
|
..onRecord.listen((rec) {
|
||||||
print(rec);
|
print(rec);
|
||||||
if (rec.error != null) print(rec.error);
|
if (rec.error != null) print(rec.error);
|
||||||
|
|
Loading…
Reference in a new issue