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

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

Issue 2521433002: Regen the analysis server spec to include the diagnostic domain. (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/tool/spec/spec_input.html ('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 * 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 library to.html; 10 library to.html;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 a { 109 a {
110 text-decoration: none; 110 text-decoration: none;
111 } 111 }
112 112
113 a:focus, a:hover { 113 a:focus, a:hover {
114 text-decoration: underline; 114 text-decoration: underline;
115 } 115 }
116 116
117 /* Styles for index */ 117 /* Styles for index */
118 118
119 .subindex {
120 }
121
122 .subindex ul { 119 .subindex ul {
123 padding-left: 0; 120 padding-left: 0;
124 margin-left: 0; 121 margin-left: 0;
125 122
126 -webkit-margin-before: 0; 123 -webkit-margin-before: 0;
127 -webkit-margin-start: 0; 124 -webkit-margin-start: 0;
128 -webkit-padding-start: 0; 125 -webkit-padding-start: 0;
129 126
130 list-style-type: none; 127 list-style-type: none;
131 } 128 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 186 }
190 187
191 void h3(void callback()) => element('h3', {}, callback); 188 void h3(void callback()) => element('h3', {}, callback);
192 void h4(void callback()) => element('h4', {}, callback); 189 void h4(void callback()) => element('h4', {}, callback);
193 void h5(void callback()) => element('h5', {}, callback); 190 void h5(void callback()) => element('h5', {}, callback);
194 void hangingIndent(void callback()) => 191 void hangingIndent(void callback()) =>
195 element('div', {'class': 'hangingIndent'}, callback); 192 element('div', {'class': 'hangingIndent'}, callback);
196 void head(void callback()) => element('head', {}, callback); 193 void head(void callback()) => element('head', {}, callback);
197 void html(void callback()) => element('html', {}, callback); 194 void html(void callback()) => element('html', {}, callback);
198 void i(void callback()) => element('i', {}, callback); 195 void i(void callback()) => element('i', {}, callback);
196 void li(void callback()) => element('li', {}, callback);
199 void link(String id, void callback()) { 197 void link(String id, void callback()) {
200 element('a', {'href': '#$id'}, callback); 198 element('a', {'href': '#$id'}, callback);
201 } 199 }
202 200
203 void p(void callback()) => element('p', {}, callback); 201 void p(void callback()) => element('p', {}, callback);
204 void pre(void callback()) => element('pre', {}, callback); 202 void pre(void callback()) => element('pre', {}, callback);
205 void title(void callback()) => element('title', {}, callback); 203 void title(void callback()) => element('title', {}, callback);
206 void tt(void callback()) => element('tt', {}, callback); 204 void tt(void callback()) => element('tt', {}, callback);
205 void ul(void callback()) => element('ul', {}, callback);
207 } 206 }
208 207
209 /** 208 /**
210 * Visitor that generates HTML documentation of the API. 209 * Visitor that generates HTML documentation of the API.
211 */ 210 */
212 class ToHtmlVisitor extends HierarchicalApiVisitor 211 class ToHtmlVisitor extends HierarchicalApiVisitor
213 with HtmlMixin, HtmlGenerator { 212 with HtmlMixin, HtmlGenerator {
214 /** 213 /**
215 * Set of types defined in the API. 214 * Set of types defined in the API.
216 */ 215 */
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 generateNotificationsIndex(domain.notifications); 262 generateNotificationsIndex(domain.notifications);
264 } 263 }
265 }); 264 });
266 } else if (domain.notifications.length > 0) { 265 } else if (domain.notifications.length > 0) {
267 element('div', {'class': 'subindex'}, () { 266 element('div', {'class': 'subindex'}, () {
268 generateNotificationsIndex(domain.notifications); 267 generateNotificationsIndex(domain.notifications);
269 }); 268 });
270 } 269 }
271 } 270 }
272 271
272 void generateTableOfContents() {
273 ul(() {
274 writeln();
275
276 for (var domain in api.domains.where((domain) => !domain.experimental)) {
277 write(' ');
278 li(() {
279 link('domain_${domain.name}', () {
280 write(_toTitleCase(domain.name));
281 });
282 });
283 writeln();
284 }
285 });
286 }
287
273 void generateIndex() { 288 void generateIndex() {
274 h3(() => write('Domains')); 289 h3(() => write('Domains'));
275 for (var domain in api.domains) { 290 for (var domain in api.domains) {
276 if (domain.experimental || 291 if (domain.experimental ||
277 (domain.requests.length == 0 && domain.notifications == 0)) { 292 (domain.requests.length == 0 && domain.notifications == 0)) {
278 continue; 293 continue;
279 } 294 }
280 generateDomainIndex(domain); 295 generateDomainIndex(domain);
281 } 296 }
282 297
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 break; 433 break;
419 case 'refactorings': 434 case 'refactorings':
420 visitRefactorings(api.refactorings); 435 visitRefactorings(api.refactorings);
421 break; 436 break;
422 case 'types': 437 case 'types':
423 visitTypes(api.types); 438 visitTypes(api.types);
424 break; 439 break;
425 case 'version': 440 case 'version':
426 translateHtml(node, squashParagraphs: squashParagraphs); 441 translateHtml(node, squashParagraphs: squashParagraphs);
427 break; 442 break;
443 case 'toc':
444 generateTableOfContents();
445 break;
428 case 'index': 446 case 'index':
429 generateIndex(); 447 generateIndex();
430 break; 448 break;
431 default: 449 default:
432 if (!specialElements.contains(node.localName)) { 450 if (!specialElements.contains(node.localName)) {
433 element(node.localName, node.attributes, () { 451 element(node.localName, node.attributes, () {
434 translateHtml(node, squashParagraphs: squashParagraphs); 452 translateHtml(node, squashParagraphs: squashParagraphs);
435 }); 453 });
436 } 454 }
437 } 455 }
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 bool verticalBarNeeded = false; 780 bool verticalBarNeeded = false;
763 for (TypeDecl choice in typeUnion.choices) { 781 for (TypeDecl choice in typeUnion.choices) {
764 if (verticalBarNeeded) { 782 if (verticalBarNeeded) {
765 write(' | '); 783 write(' | ');
766 } 784 }
767 visitTypeDecl(choice); 785 visitTypeDecl(choice);
768 verticalBarNeeded = true; 786 verticalBarNeeded = true;
769 } 787 }
770 } 788 }
771 } 789 }
790
791 String _toTitleCase(String str) {
792 if (str.isEmpty) return str;
793 return str.substring(0, 1).toUpperCase() + str.substring(1);
794 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/tool/spec/spec_input.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698