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

Unified Diff: pkg/analysis_server/tool/spec/html_tools.dart

Issue 725143004: Format and sort analyzer and analysis_server packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « pkg/analysis_server/tool/spec/generate_all.dart ('k') | pkg/analysis_server/tool/spec/implied_types.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/tool/spec/html_tools.dart
diff --git a/pkg/analysis_server/tool/spec/html_tools.dart b/pkg/analysis_server/tool/spec/html_tools.dart
index 7ec6ffbe7b07e48fbafd496120158be95e1bdb65..03057156f8d742701d697edd10c284edcf6b88c6 100644
--- a/pkg/analysis_server/tool/spec/html_tools.dart
+++ b/pkg/analysis_server/tool/spec/html_tools.dart
@@ -12,20 +12,19 @@ import 'package:html5lib/dom.dart' as dom;
/**
* Make a deep copy of the given HTML nodes.
*/
-List<dom.Node> cloneHtmlNodes(List<dom.Node> nodes) => nodes.map((dom.Node node)
- => node.clone(true)).toList();
+List<dom.Node> cloneHtmlNodes(List<dom.Node> nodes) =>
+ nodes.map((dom.Node node) => node.clone(true)).toList();
/**
- * Create an HTML element with the given name, attributes, and child nodes.
+ * Return true if the given iterable contains only whitespace text nodes.
*/
-dom.Element makeElement(String name, Map<dynamic, String>
- attributes, List<dom.Node> children) {
- dom.Element result = new dom.Element.tag(name);
- result.attributes.addAll(attributes);
- for (dom.Node child in children) {
- result.append(child);
+bool containsOnlyWhitespace(Iterable<dom.Node> nodes) {
+ for (dom.Node node in nodes) {
+ if (!isWhitespaceNode(node)) {
+ return false;
+ }
}
- return result;
+ return true;
}
/**
@@ -61,15 +60,16 @@ bool isWhitespaceNode(dom.Node node) {
}
/**
- * Return true if the given iterable contains only whitespace text nodes.
+ * Create an HTML element with the given name, attributes, and child nodes.
*/
-bool containsOnlyWhitespace(Iterable<dom.Node> nodes) {
- for (dom.Node node in nodes) {
- if (!isWhitespaceNode(node)) {
- return false;
- }
+dom.Element makeElement(String name, Map<dynamic, String> attributes,
+ List<dom.Node> children) {
+ dom.Element result = new dom.Element.tag(name);
+ result.attributes.addAll(attributes);
+ for (dom.Node child in children) {
+ result.append(child);
}
- return true;
+ return result;
}
/**
@@ -79,6 +79,22 @@ class HtmlGenerator {
List<dom.Node> _html;
/**
+ * Add the given [node] to the HTML output.
+ */
+ void add(dom.Node node) {
+ _html.add(node);
+ }
+
+ /**
+ * Add the given [nodes] to the HTML output.
+ */
+ void addAll(Iterable<dom.Node> nodes) {
+ for (dom.Node node in nodes) {
+ add(node);
+ }
+ }
+
+ /**
* Execute [callback], collecting any code that is output using [write],
* [writeln], [add], or [addAll], and return the result as a list of HTML
* nodes.
@@ -97,19 +113,12 @@ class HtmlGenerator {
}
/**
- * Add the given [node] to the HTML output.
- */
- void add(dom.Node node) {
- _html.add(node);
- }
-
- /**
- * Add the given [nodes] to the HTML output.
+ * Execute [callback], wrapping its output in an element with the given
+ * [name] and [attributes].
*/
- void addAll(Iterable<dom.Node> nodes) {
- for (dom.Node node in nodes) {
- add(node);
- }
+ void element(String name, Map<dynamic, String> attributes, [void
+ callback()]) {
+ add(makeElement(name, attributes, collectHtml(callback)));
}
/**
@@ -125,12 +134,4 @@ class HtmlGenerator {
void writeln([Object obj = '']) {
write('$obj\n');
}
-
- /**
- * Execute [callback], wrapping its output in an element with the given
- * [name] and [attributes].
- */
- void element(String name, Map<dynamic, String> attributes, [void callback()]) {
- add(makeElement(name, attributes, collectHtml(callback)));
- }
}
« no previous file with comments | « pkg/analysis_server/tool/spec/generate_all.dart ('k') | pkg/analysis_server/tool/spec/implied_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698