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

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

Issue 468563003: Use hanging indentation when code generating Javadoc @params. (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/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 20 matching lines...) Expand all
31 } 31 }
32 div.box { 32 div.box {
33 border: 1px solid rgb(0, 0, 0); 33 border: 1px solid rgb(0, 0, 0);
34 background-color: rgb(207, 226, 243); 34 background-color: rgb(207, 226, 243);
35 padding: 0.5em; 35 padding: 0.5em;
36 } 36 }
37 dt { 37 dt {
38 margin-top: 1em; 38 margin-top: 1em;
39 margin-bottom: 1em; 39 margin-bottom: 1em;
40 } 40 }
41 div.hangingIndent {
42 padding-left: 3em;
43 text-indent: -3em;
44 }
41 '''.trim(); 45 '''.trim();
42 46
43 /** 47 /**
44 * Helper methods for creating HTML elements. 48 * Helper methods for creating HTML elements.
45 */ 49 */
46 abstract class HtmlMixin { 50 abstract class HtmlMixin {
47 void element(String name, Map<dynamic, String> attributes, [void callback()]); 51 void element(String name, Map<dynamic, String> attributes, [void callback()]);
48 52
49 void anchor(String id, void callback()) { 53 void anchor(String id, void callback()) {
50 element('a', { 54 element('a', {
(...skipping 18 matching lines...) Expand all
69 void dt(String cls, void callback()) => element('dt', { 73 void dt(String cls, void callback()) => element('dt', {
70 'class': cls 74 'class': cls
71 }, callback); 75 }, callback);
72 void gray(void callback()) => element('span', { 76 void gray(void callback()) => element('span', {
73 'style': 'color:#999999' 77 'style': 'color:#999999'
74 }, callback); 78 }, callback);
75 void h1(void callback()) => element('h1', {}, callback); 79 void h1(void callback()) => element('h1', {}, callback);
76 void h2(void callback()) => element('h2', {}, callback); 80 void h2(void callback()) => element('h2', {}, callback);
77 void h3(void callback()) => element('h3', {}, callback); 81 void h3(void callback()) => element('h3', {}, callback);
78 void h4(void callback()) => element('h4', {}, callback); 82 void h4(void callback()) => element('h4', {}, callback);
83 void hangingIndent(void callback()) => element('div', {
84 'class': 'hangingIndent'
85 }, callback);
79 void head(void callback()) => element('head', {}, callback); 86 void head(void callback()) => element('head', {}, callback);
80 void html(void callback()) => element('html', {}, callback); 87 void html(void callback()) => element('html', {}, callback);
81 void i(void callback()) => element('i', {}, callback); 88 void i(void callback()) => element('i', {}, callback);
82 void p(void callback()) => element('p', {}, callback); 89 void p(void callback()) => element('p', {}, callback);
83 void pre(void callback()) => element('pre', {}, callback); 90 void pre(void callback()) => element('pre', {}, callback);
84 void title(void callback()) => element('title', {}, callback); 91 void title(void callback()) => element('title', {}, callback);
85 void tt(void callback()) => element('tt', {}, callback); 92 void tt(void callback()) => element('tt', {}, callback);
86 } 93 }
87 94
88 /** 95 /**
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 }); 402 });
396 } else { 403 } else {
397 visitTypeDecl(subType); 404 visitTypeDecl(subType);
398 } 405 }
399 } 406 }
400 } 407 }
401 408
402 void javadocParams(TypeObject typeObject) { 409 void javadocParams(TypeObject typeObject) {
403 if (typeObject != null) { 410 if (typeObject != null) {
404 for (TypeObjectField field in typeObject.fields) { 411 for (TypeObjectField field in typeObject.fields) {
405 write('@param ${field.name} '); 412 hangingIndent(() {
406 translateHtml(field.html, squashParagraphs: true); 413 write('@param ${field.name} ');
407 br(); 414 translateHtml(field.html, squashParagraphs: true);
415 });
408 } 416 }
409 } 417 }
410 } 418 }
411 419
412 @override 420 @override
413 void visitRequest(Request request) { 421 void visitRequest(Request request) {
414 dt('request', () { 422 dt('request', () {
415 write(request.longMethod); 423 write(request.longMethod);
416 }); 424 });
417 dd(() { 425 dd(() {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 */ 534 */
527 main() { 535 main() {
528 ToHtmlVisitor visitor = new ToHtmlVisitor(readApi()); 536 ToHtmlVisitor visitor = new ToHtmlVisitor(readApi());
529 dom.Document document = new dom.Document(); 537 dom.Document document = new dom.Document();
530 for (dom.Node node in visitor.collectHtml(visitor.visitApi)) { 538 for (dom.Node node in visitor.collectHtml(visitor.visitApi)) {
531 document.append(node); 539 document.append(node);
532 } 540 }
533 File outputFile = new File('../../doc/api.html'); 541 File outputFile = new File('../../doc/api.html');
534 outputFile.writeAsStringSync(document.outerHtml); 542 outputFile.writeAsStringSync(document.outerHtml);
535 } 543 }
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