Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3307)

Unified Diff: lib/src/report/html_gen.dart

Issue 1788973002: Remove code that requires whole-program compile (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merged Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/report.dart ('k') | lib/src/report/html_reporter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/report/html_gen.dart
diff --git a/lib/src/report/html_gen.dart b/lib/src/report/html_gen.dart
deleted file mode 100644
index f00eaac034cbe254fedec07d665f601862fefae3..0000000000000000000000000000000000000000
--- a/lib/src/report/html_gen.dart
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// A class to generate an html page.
-class HtmlGen {
- final _buffer = new StringBuffer();
- final _tags = <String>[];
- final _indents = <bool>[];
-
- bool _startOfLine = true;
- String _indent = '';
-
- HtmlGen() {
- _init();
- }
-
- void _init() {
- writeln('<!DOCTYPE html>');
- writeln();
- writeln('<!-- generated by dev_compiler -->');
- writeln();
- }
-
- void start(
- {String title,
- String cssRef,
- String theme,
- String jsScript,
- String inlineStyle}) {
- startTag('html', newLine: false);
- writeln();
- startTag('head');
- writeln('<meta charset="utf-8">');
- writeln('<meta name="viewport" content="width=device-width, '
- 'initial-scale=1.0">');
- if (title != null) {
- writeln('<title>${title}</title>');
- }
- if (cssRef != null) {
- writeln('<link href="${cssRef}" rel="stylesheet" media="screen">');
- }
- if (theme != null) {
- writeln('<link href="${theme}" rel="stylesheet">');
- }
- if (jsScript != null) {
- writeln('<script src="${jsScript}"></script>');
- }
- if (inlineStyle != null) {
- startTag('style');
- writeln(inlineStyle);
- endTag();
- }
- endTag();
- writeln();
- startTag('body', newLine: false);
- writeln();
- }
-
- void startTag(String tag, {String attributes, String c, bool newLine: true}) {
- if (c != null && c.isNotEmpty) {
- if (attributes == null) {
- attributes = 'class="${c}"';
- } else {
- attributes += ' class="${c}"';
- }
- }
-
- if (attributes != null) {
- if (newLine) {
- writeln('<${tag} ${attributes}>');
- } else {
- write('<${tag} ${attributes}>');
- }
- } else {
- if (newLine) {
- writeln('<${tag}>');
- } else {
- write('<${tag}>');
- }
- }
- _indents.add(newLine);
- if (newLine) {
- _indent = '$_indent\t';
- }
- _tags.add(tag);
- }
-
- void span({String text, String c}) => tag('span', text: text, c: c);
-
- void tag(String tag,
- {String text, String c, String href, String attributes}) {
- if (attributes == null) attributes = '';
- if (text == null) text = '';
-
- if (c != null && c.isNotEmpty) attributes += ' class="${c}"';
- if (href != null) attributes += ' href="${href}"';
-
- if (attributes.isNotEmpty) attributes = ' ${attributes.trim()}';
-
- writeln('<$tag$attributes>$text</$tag>');
- }
-
- void endTag() {
- String tag = _tags.removeLast();
- bool wasIndent = _indents.removeLast();
- if (wasIndent) {
- _indent = _indent.substring(0, _indent.length - 1);
- }
- writeln('</${tag}>');
- }
-
- void end() {
- // body
- endTag();
- // html
- endTag();
- }
-
- String toString() => _buffer.toString();
-
- void reset() {
- _buffer.clear();
- _startOfLine = true;
- _tags.clear();
- _indents.clear();
- _indent = '';
-
- _init();
- }
-
- void write(String str) {
- if (_startOfLine) {
- _buffer.write(_indent);
- _startOfLine = false;
- }
- _buffer.write(str);
- }
-
- void writeln([String str]) {
- if (str == null) {
- write('\n');
- } else {
- write('${str}\n');
- }
- _startOfLine = true;
- }
-}
« no previous file with comments | « lib/src/report.dart ('k') | lib/src/report/html_reporter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698