Use Renderer.errorDocument
This commit is contained in:
parent
bd2f7bd0df
commit
e32b8c700d
4 changed files with 7 additions and 45 deletions
2
angel_jael/.gitignore
vendored
2
angel_jael/.gitignore
vendored
|
@ -12,3 +12,5 @@ pubspec.lock
|
|||
# Directory created by dartdoc
|
||||
# If you don't generate documentation locally you can remove this line.
|
||||
doc/api/
|
||||
|
||||
.dart_tool
|
2
angel_jael/CHANGELOG.md
Normal file
2
angel_jael/CHANGELOG.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
# 1.0.1
|
||||
* Use `Renderer.errorDocument`.
|
|
@ -61,49 +61,7 @@ AngelConfigurer jael(Directory viewsDirectory,
|
|||
}
|
||||
}
|
||||
|
||||
buf
|
||||
..writeln('<!DOCTYPE html>')
|
||||
..writeln('<html lang="en">')
|
||||
..indent()
|
||||
..writeln('<head>')
|
||||
..indent()
|
||||
..writeln(
|
||||
'<meta name="viewport" content="width=device-width, initial-scale=1">',
|
||||
)
|
||||
..writeln('<title>${errors.length} Error(s)</title>')
|
||||
..outdent()
|
||||
..writeln('</head>')
|
||||
..writeln('<body>')
|
||||
..writeln('<h1>${errors.length} Error(s)</h1>')
|
||||
..writeln('<ul>')
|
||||
..indent();
|
||||
|
||||
for (var error in errors) {
|
||||
var type =
|
||||
error.severity == JaelErrorSeverity.warning ? 'warning' : 'error';
|
||||
buf
|
||||
..writeln('<li>')
|
||||
..indent()
|
||||
..writeln(
|
||||
'<b>$type:</b> ${error.span.start.toolString}: ${error.message}')
|
||||
..writeln('<br>')
|
||||
..writeln(
|
||||
'<span style="color: red;">' +
|
||||
HTML_ESCAPE
|
||||
.convert(error.span.highlight(color: false))
|
||||
.replaceAll('\n', '<br>') +
|
||||
'</span>',
|
||||
)
|
||||
..outdent()
|
||||
..writeln('</li>');
|
||||
}
|
||||
|
||||
buf
|
||||
..outdent()
|
||||
..writeln('</ul>')
|
||||
..writeln('</body>')
|
||||
..writeln('</html>');
|
||||
|
||||
Renderer.errorDocument(errors, buf);
|
||||
return buf.toString();
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
name: angel_jael
|
||||
version: 1.0.0
|
||||
version: 1.0.1
|
||||
description: Angel support for the Jael templating engine.
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/jael/tree/master/jael
|
||||
environment:
|
||||
sdk: ">=1.19.0"
|
||||
sdk: ">=1.19.0 <=2.0.0"
|
||||
dependencies:
|
||||
angel_framework: ^1.0.0-dev
|
||||
code_buffer: ^1.0.0
|
||||
|
|
Loading…
Reference in a new issue