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

Side by Side Diff: pkg/analysis_server/tool/spec/html_tools.dart

Issue 473733003: Output javadoc for enumerated values; suppress empty javadoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/tool/spec/codegen_tools.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 HTML manipulation. 6 * Tools for HTML manipulation.
7 */ 7 */
8 library html.tools; 8 library html.tools;
9 9
10 import 'package:html5lib/dom.dart' as dom; 10 import 'package:html5lib/dom.dart' as dom;
(...skipping 29 matching lines...) Expand all
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 recurse(parent); 45 recurse(parent);
46 return buffer.toString(); 46 return buffer.toString();
47 } 47 }
48 48
49 /** 49 /**
50 * Return true if the given node is a text node containing only whitespace, or
51 * a comment.
52 */
53 bool isWhitespaceNode(dom.Node node) {
54 if (node is dom.Element) {
55 return false;
56 } else if (node is dom.Text) {
57 return node.text.trim().isEmpty;
58 }
59 // Treat all other types of nodes (e.g. comments) as whitespace.
60 return true;
61 }
62
63 /**
64 * Return true if the given iterable contains only whitespace text nodes.
65 */
66 bool containsOnlyWhitespace(Iterable<dom.Node> nodes) {
67 for (dom.Node node in nodes) {
68 if (!isWhitespaceNode(node)) {
69 return false;
70 }
71 }
72 return true;
73 }
74
75 /**
50 * Mixin class for generating HTML. 76 * Mixin class for generating HTML.
51 */ 77 */
52 class HtmlGenerator { 78 class HtmlGenerator {
53 List<dom.Node> _html; 79 List<dom.Node> _html;
54 80
55 /** 81 /**
56 * Execute [callback], collecting any code that is output using [write], 82 * Execute [callback], collecting any code that is output using [write],
57 * [writeln], [add], or [addAll], and return the result as a list of HTML 83 * [writeln], [add], or [addAll], and return the result as a list of HTML
58 * nodes. 84 * nodes.
59 */ 85 */
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 127 }
102 128
103 /** 129 /**
104 * Execute [callback], wrapping its output in an element with the given 130 * Execute [callback], wrapping its output in an element with the given
105 * [name] and [attributes]. 131 * [name] and [attributes].
106 */ 132 */
107 void element(String name, Map<dynamic, String> attributes, [void callback()]) { 133 void element(String name, Map<dynamic, String> attributes, [void callback()]) {
108 add(makeElement(name, attributes, collectHtml(callback))); 134 add(makeElement(name, attributes, collectHtml(callback)));
109 } 135 }
110 } 136 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/tool/spec/codegen_tools.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698