preproc 2.0.1
This commit is contained in:
parent
0873b4cdc0
commit
7322b660c4
5 changed files with 20 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
<extend src="layout.jl">
|
||||
<extend src="layout.jael">
|
||||
<block name="content">
|
||||
<i if=message != null>
|
||||
<script>
|
||||
|
|
|
@ -10,7 +10,8 @@ dependencies:
|
|||
code_buffer: ^1.0.0
|
||||
file: ^5.0.0
|
||||
jael: ^2.0.0
|
||||
jael_preprocessor: ^2.0.0
|
||||
jael_preprocessor: #^2.0.0
|
||||
path: ../jael_preprocessor
|
||||
symbol_table: ^2.0.0
|
||||
dev_dependencies:
|
||||
angel_test: ^2.0.0-alpha
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# 2.0.1
|
||||
* Fixed a bug where failed file resolutions would not become proper errors.
|
||||
|
||||
# 2.0.0+1
|
||||
* Homepage update for Pub.
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:jael/jael.dart';
|
||||
import 'package:symbol_table/symbol_table.dart';
|
||||
|
@ -57,7 +56,7 @@ Future<Document> applyInheritance(Document document, Directory currentDirectory,
|
|||
element.tagName.span));
|
||||
return null;
|
||||
} else {
|
||||
// In theory, there exists:
|
||||
// In theory, there exists:
|
||||
// * A single root template with a number of blocks
|
||||
// * Some amount of <extend src="..."> templates.
|
||||
|
||||
|
@ -68,7 +67,7 @@ Future<Document> applyInheritance(Document document, Directory currentDirectory,
|
|||
// b. Replace matching blocks in the current document
|
||||
// c. If there is no block, and this is the LAST <extend>, fill in the default block content.
|
||||
var hierarchy = await resolveHierarchy(document, currentDirectory, onError);
|
||||
var out = hierarchy.root;
|
||||
var out = hierarchy?.root;
|
||||
|
||||
if (out is! RegularElement) {
|
||||
return hierarchy.rootDocument;
|
||||
|
@ -137,11 +136,17 @@ Future<DocumentHierarchy> resolveHierarchy(Document document,
|
|||
String parent;
|
||||
|
||||
while (document != null && (parent = getParent(document, onError)) != null) {
|
||||
extendsTemplates.addFirst(document.root);
|
||||
var file = currentDirectory.childFile(parent);
|
||||
var parsed = parseDocument(await file.readAsString(),
|
||||
sourceUrl: file.uri, onError: onError);
|
||||
document = await resolveIncludes(parsed, currentDirectory, onError);
|
||||
try {
|
||||
extendsTemplates.addFirst(document.root);
|
||||
var file = currentDirectory.childFile(parent);
|
||||
var parsed = parseDocument(await file.readAsString(),
|
||||
sourceUrl: file.uri, onError: onError);
|
||||
document = await resolveIncludes(parsed, currentDirectory, onError);
|
||||
} on FileSystemException catch (e) {
|
||||
onError(new JaelError(
|
||||
JaelErrorSeverity.error, e.message, document.root.span));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (document == null) return null;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: jael_preprocessor
|
||||
version: 2.0.0+1
|
||||
version: 2.0.1
|
||||
description: A pre-processor for resolving blocks and includes within Jael templates.
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/jael/tree/master/jael_preprocessor
|
||||
|
|
Loading…
Reference in a new issue