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