| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Tools for manipulating HTML during code generation of analyzer and analysis | 6 * Tools for manipulating HTML during code generation of analyzer and analysis |
| 7 * server. | 7 * server. |
| 8 */ | 8 */ |
| 9 library analyzer.src.codegen.html; | 9 library analyzer.src.codegen.html; |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 StringBuffer buffer = new StringBuffer(); | 35 StringBuffer buffer = new StringBuffer(); |
| 36 void recurse(dom.Element parent) { | 36 void recurse(dom.Element parent) { |
| 37 for (dom.Node child in parent.nodes) { | 37 for (dom.Node child in parent.nodes) { |
| 38 if (child is dom.Text) { | 38 if (child is dom.Text) { |
| 39 buffer.write(child.text); | 39 buffer.write(child.text); |
| 40 } else if (child is dom.Element) { | 40 } else if (child is dom.Element) { |
| 41 recurse(child); | 41 recurse(child); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 |
| 45 recurse(parent); | 46 recurse(parent); |
| 46 return buffer.toString(); | 47 return buffer.toString(); |
| 47 } | 48 } |
| 48 | 49 |
| 49 /** | 50 /** |
| 50 * Return true if the given node is a text node containing only whitespace, or | 51 * Return true if the given node is a text node containing only whitespace, or |
| 51 * a comment. | 52 * a comment. |
| 52 */ | 53 */ |
| 53 bool isWhitespaceNode(dom.Node node) { | 54 bool isWhitespaceNode(dom.Node node) { |
| 54 if (node is dom.Element) { | 55 if (node is dom.Element) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 _html.add(new dom.Text(text)); | 130 _html.add(new dom.Text(text)); |
| 130 } | 131 } |
| 131 | 132 |
| 132 /** | 133 /** |
| 133 * Output text, ending the current line. | 134 * Output text, ending the current line. |
| 134 */ | 135 */ |
| 135 void writeln([Object obj = '']) { | 136 void writeln([Object obj = '']) { |
| 136 write('$obj\n'); | 137 write('$obj\n'); |
| 137 } | 138 } |
| 138 } | 139 } |
| OLD | NEW |