| OLD | NEW |
| 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 }); | 479 }); |
| 480 } | 480 } |
| 481 | 481 |
| 482 @override | 482 @override |
| 483 void visitTypeObjectField(TypeObjectField typeObjectField) { | 483 void visitTypeObjectField(TypeObjectField typeObjectField) { |
| 484 dt('field', () { | 484 dt('field', () { |
| 485 b(() { | 485 b(() { |
| 486 i(() { | 486 i(() { |
| 487 write(typeObjectField.name); | 487 write(typeObjectField.name); |
| 488 if (typeObjectField.value != null) { | 488 if (typeObjectField.value != null) { |
| 489 write(' = ${typeObjectField.value}'); | 489 write(' = ${JSON.encode(typeObjectField.value)}'); |
| 490 } else { | 490 } else { |
| 491 write(' ( '); | 491 write(' ( '); |
| 492 if (typeObjectField.optional) { | 492 if (typeObjectField.optional) { |
| 493 gray(() { | 493 gray(() { |
| 494 write('optional'); | 494 write('optional'); |
| 495 }); | 495 }); |
| 496 write(' '); | 496 write(' '); |
| 497 } | 497 } |
| 498 TypeVisitor typeVisitor = new TypeVisitor(api, short: true); | 498 TypeVisitor typeVisitor = new TypeVisitor(api, short: true); |
| 499 addAll(typeVisitor.collectHtml(() { | 499 addAll(typeVisitor.collectHtml(() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 519 */ | 519 */ |
| 520 main() { | 520 main() { |
| 521 ToHtmlVisitor visitor = new ToHtmlVisitor(readApi()); | 521 ToHtmlVisitor visitor = new ToHtmlVisitor(readApi()); |
| 522 dom.Document document = new dom.Document(); | 522 dom.Document document = new dom.Document(); |
| 523 for (dom.Node node in visitor.collectHtml(visitor.visitApi)) { | 523 for (dom.Node node in visitor.collectHtml(visitor.visitApi)) { |
| 524 document.append(node); | 524 document.append(node); |
| 525 } | 525 } |
| 526 File outputFile = new File('../../doc/api.html'); | 526 File outputFile = new File('../../doc/api.html'); |
| 527 outputFile.writeAsStringSync(document.outerHtml); | 527 outputFile.writeAsStringSync(document.outerHtml); |
| 528 } | 528 } |
| OLD | NEW |