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

Side by Side Diff: utils/apidoc/apidoc.dart

Issue 16848002: Add toUri and fromUri functions to pathos. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Preserve trailing separators. Created 7 years, 6 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 | « sdk/lib/_internal/pub/lib/src/utils.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 * This generates the reference documentation for the core libraries that come 6 * This generates the reference documentation for the core libraries that come
7 * with dart. It is built on top of dartdoc, which is a general-purpose library 7 * with dart. It is built on top of dartdoc, which is a general-purpose library
8 * for generating docs from any Dart code. This library extends that to include 8 * for generating docs from any Dart code. This library extends that to include
9 * additional information and styling specific to our standard library. 9 * additional information and styling specific to our standard library.
10 * 10 *
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 if (excludedLibraries.contains(libName)) { 141 if (excludedLibraries.contains(libName)) {
142 return; 142 return;
143 } 143 }
144 144
145 // Ignore hidden directories (like .svn) as well as pkg.xcodeproj. 145 // Ignore hidden directories (like .svn) as well as pkg.xcodeproj.
146 if (libName.startsWith('.') || libName.endsWith('.xcodeproj')) { 146 if (libName.startsWith('.') || libName.endsWith('.xcodeproj')) {
147 return; 147 return;
148 } 148 }
149 149
150 if (new File.fromPath(libPath).existsSync()) { 150 if (new File.fromPath(libPath).existsSync()) {
151 apidocLibraries.add(_pathToFileUri(libPath.toNativePath())); 151 apidocLibraries.add(pathos.toUri(libPath.toNativePath()));
152 includedLibraries.add(libName); 152 includedLibraries.add(libName);
153 } else { 153 } else {
154 print('Warning: could not find package at $path'); 154 print('Warning: could not find package at $path');
155 } 155 }
156 } 156 }
157 }, onDone: () { 157 }, onDone: () {
158 // Add any --extra libraries that had full pkg paths. 158 // Add any --extra libraries that had full pkg paths.
159 // TODO(gram): if the handling of --include-lib libraries in the 159 // TODO(gram): if the handling of --include-lib libraries in the
160 // listen() block above is cleaned up, then this will need to be 160 // listen() block above is cleaned up, then this will need to be
161 // too, as it is a special case of the above. 161 // too, as it is a special case of the above.
162 for (var lib in extraLibraries) { 162 for (var lib in extraLibraries) {
163 var libPath = new Path('../../$lib'); 163 var libPath = new Path('../../$lib');
164 if (new File.fromPath(libPath).existsSync()) { 164 if (new File.fromPath(libPath).existsSync()) {
165 apidocLibraries.add(_pathToFileUri(libPath.toNativePath())); 165 apidocLibraries.add(pathos.toUri(libPath.toNativePath()));
166 var libName = libPath.filename.replaceAll('.dart', ''); 166 var libName = libPath.filename.replaceAll('.dart', '');
167 includedLibraries.add(libName); 167 includedLibraries.add(libName);
168 } 168 }
169 } 169 }
170 170
171 final apidoc = new Apidoc(mdn, outputDir, mode, generateAppCache, 171 final apidoc = new Apidoc(mdn, outputDir, mode, generateAppCache,
172 excludedLibraries, version); 172 excludedLibraries, version);
173 apidoc.dartdocPath = 173 apidoc.dartdocPath =
174 scriptDir.append('../../sdk/lib/_internal/dartdoc/'); 174 scriptDir.append('../../sdk/lib/_internal/dartdoc/');
175 // Select the libraries to include in the produced documentation: 175 // Select the libraries to include in the produced documentation:
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 var memberName = '$typeName.${member.simpleName}'; 474 var memberName = '$typeName.${member.simpleName}';
475 if (member is MethodMirror && member.isConstructor) { 475 if (member is MethodMirror && member.isConstructor) {
476 final separator = member.constructorName == '' ? '' : '.'; 476 final separator = member.constructorName == '' ? '' : '.';
477 memberName = 'new $typeName$separator${member.constructorName}'; 477 memberName = 'new $typeName$separator${member.constructorName}';
478 } 478 }
479 479
480 return a(memberUrl(member), memberName); 480 return a(memberUrl(member), memberName);
481 } 481 }
482 } 482 }
483 483
484 /** Converts a local path string to a `file:` [Uri]. */
485 Uri _pathToFileUri(String path) {
486 path = pathos.absolute(path);
487 if (Platform.operatingSystem != 'windows') {
488 return Uri.parse('file://$path');
489 } else {
490 return Uri.parse('file:///${path.replaceAll("\\", "/")}');
491 }
492 }
493
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698