OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 * Code for displaying the API as HTML. This is used both for generating a | 6 * Code for displaying the API as HTML. This is used both for generating a |
7 * full description of the API as a web page, and for generating doc comments | 7 * full description of the API as a web page, and for generating doc comments |
8 * in generated code. | 8 * in generated code. |
9 */ | 9 */ |
10 import 'dart:convert'; | 10 import 'dart:convert'; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 -webkit-margin-before: 0; | 121 -webkit-margin-before: 0; |
122 -webkit-margin-start: 0; | 122 -webkit-margin-start: 0; |
123 -webkit-padding-start: 0; | 123 -webkit-padding-start: 0; |
124 | 124 |
125 list-style-type: none; | 125 list-style-type: none; |
126 } | 126 } |
127 ''' | 127 ''' |
128 .trim(); | 128 .trim(); |
129 | 129 |
130 final GeneratedFile target = | 130 final GeneratedFile target = |
131 new GeneratedFile('doc/api.html', (String pkgPath) { | 131 new GeneratedFile('doc/api.html', (String pkgPath) async { |
132 ToHtmlVisitor visitor = new ToHtmlVisitor(readApi(pkgPath)); | 132 ToHtmlVisitor visitor = new ToHtmlVisitor(readApi(pkgPath)); |
133 dom.Document document = new dom.Document(); | 133 dom.Document document = new dom.Document(); |
134 document.append(new dom.DocumentType('html', null, null)); | 134 document.append(new dom.DocumentType('html', null, null)); |
135 for (dom.Node node in visitor.collectHtml(visitor.visitApi)) { | 135 for (dom.Node node in visitor.collectHtml(visitor.visitApi)) { |
136 document.append(node); | 136 document.append(node); |
137 } | 137 } |
138 return document.outerHtml; | 138 return document.outerHtml; |
139 }); | 139 }); |
140 | 140 |
141 String _toTitleCase(String str) { | 141 String _toTitleCase(String str) { |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 bool verticalBarNeeded = false; | 818 bool verticalBarNeeded = false; |
819 for (TypeDecl choice in typeUnion.choices) { | 819 for (TypeDecl choice in typeUnion.choices) { |
820 if (verticalBarNeeded) { | 820 if (verticalBarNeeded) { |
821 write(' | '); | 821 write(' | '); |
822 } | 822 } |
823 visitTypeDecl(choice); | 823 visitTypeDecl(choice); |
824 verticalBarNeeded = true; | 824 verticalBarNeeded = true; |
825 } | 825 } |
826 } | 826 } |
827 } | 827 } |
OLD | NEW |