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

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

Issue 1310263003: Reformat code to minimize churn (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « pkg/analysis_server/tool/spec/text_formatter.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 * 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 abstract class HtmlMixin { 118 abstract class HtmlMixin {
119 void anchor(String id, void callback()) { 119 void anchor(String id, void callback()) {
120 element('a', {'name': id}, callback); 120 element('a', {'name': id}, callback);
121 } 121 }
122 122
123 void b(void callback()) => element('b', {}, callback); 123 void b(void callback()) => element('b', {}, callback);
124 void body(void callback()) => element('body', {}, callback); 124 void body(void callback()) => element('body', {}, callback);
125 void box(void callback()) { 125 void box(void callback()) {
126 element('div', {'class': 'box'}, callback); 126 element('div', {'class': 'box'}, callback);
127 } 127 }
128
128 void br() => element('br', {}); 129 void br() => element('br', {});
129 void dd(void callback()) => element('dd', {}, callback); 130 void dd(void callback()) => element('dd', {}, callback);
130 void dl(void callback()) => element('dl', {}, callback); 131 void dl(void callback()) => element('dl', {}, callback);
131 void dt(String cls, void callback()) => 132 void dt(String cls, void callback()) =>
132 element('dt', {'class': cls}, callback); 133 element('dt', {'class': cls}, callback);
133 void element(String name, Map<dynamic, String> attributes, [void callback()]); 134 void element(String name, Map<dynamic, String> attributes, [void callback()]);
134 void gray(void callback()) => 135 void gray(void callback()) =>
135 element('span', {'style': 'color:#999999'}, callback); 136 element('span', {'style': 'color:#999999'}, callback);
136 void h1(void callback()) => element('h1', {}, callback); 137 void h1(void callback()) => element('h1', {}, callback);
137 void h2(String cls, void callback()) { 138 void h2(String cls, void callback()) {
138 if (cls == null) { 139 if (cls == null) {
139 return element('h2', {}, callback); 140 return element('h2', {}, callback);
140 } 141 }
141 return element('h2', {'class': cls}, callback); 142 return element('h2', {'class': cls}, callback);
142 } 143 }
144
143 void h3(void callback()) => element('h3', {}, callback); 145 void h3(void callback()) => element('h3', {}, callback);
144 void h4(void callback()) => element('h4', {}, callback); 146 void h4(void callback()) => element('h4', {}, callback);
145 void h5(void callback()) => element('h5', {}, callback); 147 void h5(void callback()) => element('h5', {}, callback);
146 void hangingIndent(void callback()) => 148 void hangingIndent(void callback()) =>
147 element('div', {'class': 'hangingIndent'}, callback); 149 element('div', {'class': 'hangingIndent'}, callback);
148 void head(void callback()) => element('head', {}, callback); 150 void head(void callback()) => element('head', {}, callback);
149 void html(void callback()) => element('html', {}, callback); 151 void html(void callback()) => element('html', {}, callback);
150 void i(void callback()) => element('i', {}, callback); 152 void i(void callback()) => element('i', {}, callback);
151 void link(String id, void callback()) { 153 void link(String id, void callback()) {
152 element('a', {'href': '#$id'}, callback); 154 element('a', {'href': '#$id'}, callback);
153 } 155 }
156
154 void p(void callback()) => element('p', {}, callback); 157 void p(void callback()) => element('p', {}, callback);
155 void pre(void callback()) => element('pre', {}, callback); 158 void pre(void callback()) => element('pre', {}, callback);
156 void title(void callback()) => element('title', {}, callback); 159 void title(void callback()) => element('title', {}, callback);
157 void tt(void callback()) => element('tt', {}, callback); 160 void tt(void callback()) => element('tt', {}, callback);
158 } 161 }
159 162
160 /** 163 /**
161 * Visitor that generates HTML documentation of the API. 164 * Visitor that generates HTML documentation of the API.
162 */ 165 */
163 class ToHtmlVisitor extends HierarchicalApiVisitor 166 class ToHtmlVisitor extends HierarchicalApiVisitor
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 element('div', {'class': 'subindex'}, () { 522 element('div', {'class': 'subindex'}, () {
520 generateNotificationsIndex(domain.notifications); 523 generateNotificationsIndex(domain.notifications);
521 }); 524 });
522 } 525 }
523 } 526 }
524 527
525 void generateRequestsIndex(Iterable<Request> requests) { 528 void generateRequestsIndex(Iterable<Request> requests) {
526 h5(() => write("Requests")); 529 h5(() => write("Requests"));
527 element('ul', {}, () { 530 element('ul', {}, () {
528 for (var request in requests) { 531 for (var request in requests) {
529 element('li', {}, () => link('request_${request.longMethod}', () => 532 element(
530 write(request.method))); 533 'li',
534 {},
535 () => link(
536 'request_${request.longMethod}', () => write(request.method)));
531 } 537 }
532 }); 538 });
533 } 539 }
534 540
535 void generateNotificationsIndex(Iterable<Notification> notifications) { 541 void generateNotificationsIndex(Iterable<Notification> notifications) {
536 h5(() => write("Notifications")); 542 h5(() => write("Notifications"));
537 element('div', {'class': 'subindex'}, () { 543 element('div', {'class': 'subindex'}, () {
538 element('ul', {}, () { 544 element('ul', {}, () {
539 for (var notification in notifications) { 545 for (var notification in notifications) {
540 element('li', {}, () => link('notification_${notification.longEvent}', 546 element(
541 () => write(notification.event))); 547 'li',
548 {},
549 () => link('notification_${notification.longEvent}',
550 () => write(notification.event)));
542 } 551 }
543 }); 552 });
544 }); 553 });
545 } 554 }
546 555
547 void generateTypesIndex(Set<String> types) { 556 void generateTypesIndex(Set<String> types) {
548 h3(() { 557 h3(() {
549 write("Types"); 558 write("Types");
550 write(' ('); 559 write(' (');
551 link('types', () => write('\u2191')); 560 link('types', () => write('\u2191'));
(...skipping 12 matching lines...) Expand all
564 h3(() { 573 h3(() {
565 write("Refactorings"); 574 write("Refactorings");
566 write(' ('); 575 write(' (');
567 link('refactorings', () => write('\u2191')); 576 link('refactorings', () => write('\u2191'));
568 write(')'); 577 write(')');
569 }); 578 });
570 // TODO: Individual refactorings are not yet hyperlinked. 579 // TODO: Individual refactorings are not yet hyperlinked.
571 element('div', {'class': 'subindex'}, () { 580 element('div', {'class': 'subindex'}, () {
572 element('ul', {}, () { 581 element('ul', {}, () {
573 for (var refactoring in refactorings) { 582 for (var refactoring in refactorings) {
574 element('li', {}, () => link('refactoring_${refactoring.kind}', 583 element(
575 () => write(refactoring.kind))); 584 'li',
585 {},
586 () => link('refactoring_${refactoring.kind}',
587 () => write(refactoring.kind)));
576 } 588 }
577 }); 589 });
578 }); 590 });
579 } 591 }
580 } 592 }
581 593
582 /** 594 /**
583 * Visitor that generates a compact representation of a type, such as: 595 * Visitor that generates a compact representation of a type, such as:
584 * 596 *
585 * { 597 * {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 bool verticalBarNeeded = false; 701 bool verticalBarNeeded = false;
690 for (TypeDecl choice in typeUnion.choices) { 702 for (TypeDecl choice in typeUnion.choices) {
691 if (verticalBarNeeded) { 703 if (verticalBarNeeded) {
692 write(' | '); 704 write(' | ');
693 } 705 }
694 visitTypeDecl(choice); 706 visitTypeDecl(choice);
695 verticalBarNeeded = true; 707 verticalBarNeeded = true;
696 } 708 }
697 } 709 }
698 } 710 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/tool/spec/text_formatter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698