| 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; |
| 11 | 11 |
| 12 import 'dart:convert'; | 12 import 'dart:convert'; |
| 13 import 'dart:io'; | |
| 14 | 13 |
| 15 import 'package:html5lib/dom.dart' as dom; | 14 import 'package:html5lib/dom.dart' as dom; |
| 16 | 15 |
| 17 import 'api.dart'; | 16 import 'api.dart'; |
| 18 import 'codegen_tools.dart'; | 17 import 'codegen_tools.dart'; |
| 19 import 'from_html.dart'; | 18 import 'from_html.dart'; |
| 20 import 'html_tools.dart'; | 19 import 'html_tools.dart'; |
| 21 | 20 |
| 22 /** | 21 /** |
| 23 * Embedded stylesheet | 22 * Embedded stylesheet |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 dd(() { | 521 dd(() { |
| 523 translateHtml(typeObjectField.html); | 522 translateHtml(typeObjectField.html); |
| 524 }); | 523 }); |
| 525 } | 524 } |
| 526 | 525 |
| 527 @override | 526 @override |
| 528 void visitTypeReference(TypeReference typeReference) { | 527 void visitTypeReference(TypeReference typeReference) { |
| 529 } | 528 } |
| 530 } | 529 } |
| 531 | 530 |
| 531 final GeneratedFile target = new GeneratedFile('../../doc/api.html', () { |
| 532 ToHtmlVisitor visitor = new ToHtmlVisitor(readApi()); |
| 533 dom.Document document = new dom.Document(); |
| 534 for (dom.Node node in visitor.collectHtml(visitor.visitApi)) { |
| 535 document.append(node); |
| 536 } |
| 537 return document.outerHtml; |
| 538 }); |
| 539 |
| 532 /** | 540 /** |
| 533 * Translate spec_input.html into api.html. | 541 * Translate spec_input.html into api.html. |
| 534 */ | 542 */ |
| 535 main() { | 543 main() { |
| 536 ToHtmlVisitor visitor = new ToHtmlVisitor(readApi()); | 544 target.generate(); |
| 537 dom.Document document = new dom.Document(); | |
| 538 for (dom.Node node in visitor.collectHtml(visitor.visitApi)) { | |
| 539 document.append(node); | |
| 540 } | |
| 541 File outputFile = new File('../../doc/api.html'); | |
| 542 outputFile.writeAsStringSync(document.outerHtml); | |
| 543 } | 545 } |
| OLD | NEW |