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

Side by Side Diff: utils/dartdoc/files.dart

Issue 8771054: Add a script to generate HTML and DOM docs with cross-links to one another. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Various fixes to get htmldoc running again. Created 9 years 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Functions for working with files and paths. 5 // Functions for working with files and paths.
6 6
7 /** The path to the file currently being written to, relative to [outdir]. */ 7 /** The path to the file currently being written to, relative to [outdir]. */
8 String _filePath; 8 String _filePath;
9 9
10 /** The file currently being written to. */ 10 /** The file currently being written to. */
11 StringBuffer _file; 11 StringBuffer _file;
12 12
13 FileSystem files;
14
15 startFile(String path) { 13 startFile(String path) {
16 _filePath = path; 14 _filePath = path;
17 _file = new StringBuffer(); 15 _file = new StringBuffer();
18 } 16 }
19 17
20 write(String s) { 18 write(String s) {
21 _file.add(s); 19 _file.add(s);
22 } 20 }
23 21
24 writeln(String s) { 22 writeln(String s) {
25 write(s); 23 write(s);
26 write('\n'); 24 write('\n');
27 } 25 }
28 26
29 endFile() { 27 endFile() {
30 String outPath = '$outdir/$_filePath'; 28 String outPath = '$outdir/$_filePath';
31 files.createDirectory(dirname(outPath), recursive: true); 29 world.files.createDirectory(dirname(outPath), recursive: true);
32 30
33 world.files.writeString(outPath, _file.toString()); 31 world.files.writeString(outPath, _file.toString());
34 _filePath = null; 32 _filePath = null;
35 _file = null; 33 _file = null;
36 } 34 }
37 35
38 /** 36 /**
39 * Converts [absolute] which is understood to be a full path from the root of 37 * Converts [absolute] which is understood to be a full path from the root of
40 * the generated docs to one relative to the current file. 38 * the generated docs to one relative to the current file.
41 */ 39 */
(...skipping 12 matching lines...) Expand all
54 // If the type isn't generic, genericType returns `this`, so it works for 52 // If the type isn't generic, genericType returns `this`, so it works for
55 // non-generic types too. 53 // non-generic types too.
56 return '${sanitize(type.library.name)}/${type.genericType.name}.html'; 54 return '${sanitize(type.library.name)}/${type.genericType.name}.html';
57 } 55 }
58 56
59 /** Gets the URL for the documentation for [member]. */ 57 /** Gets the URL for the documentation for [member]. */
60 memberUrl(Member member) => '${typeUrl(member.declaringType)}#${member.name}'; 58 memberUrl(Member member) => '${typeUrl(member.declaringType)}#${member.name}';
61 59
62 /** Gets the anchor id for the document for [member]. */ 60 /** Gets the anchor id for the document for [member]. */
63 memberAnchor(Member member) => '${member.name}'; 61 memberAnchor(Member member) => '${member.name}';
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698