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

Side by Side Diff: lib/dartdoc/dartdoc.dart

Issue 9844031: add disqus comments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove generated file Created 8 years, 8 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 | « lib/dartdoc/client-static.dart ('k') | utils/apidoc/README.txt » ('j') | 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 * To generate docs for a library, run this script with the path to an 6 * To generate docs for a library, run this script with the path to an
7 * entrypoint .dart file, like: 7 * entrypoint .dart file, like:
8 * 8 *
9 * $ dart dartdoc.dart foo.dart 9 * $ dart dartdoc.dart foo.dart
10 * 10 *
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 final MODE_LIVE_NAV = 1; 49 final MODE_LIVE_NAV = 1;
50 50
51 /** 51 /**
52 * Run this from the `lib/dartdoc` directory. 52 * Run this from the `lib/dartdoc` directory.
53 */ 53 */
54 void main() { 54 void main() {
55 final args = new Options().arguments; 55 final args = new Options().arguments;
56 56
57 // Parse the dartdoc options. 57 // Parse the dartdoc options.
58 bool includeSource; 58 bool includeSource;
59 String mode; 59 int mode;
60 String outputDir; 60 String outputDir;
61 61
62 for (int i = 0; i < args.length - 1; i++) { 62 for (int i = 0; i < args.length - 1; i++) {
63 final arg = args[i]; 63 final arg = args[i];
64 64
65 switch (arg) { 65 switch (arg) {
66 case '--no-code': 66 case '--no-code':
67 includeSource = false; 67 includeSource = false;
68 break; 68 break;
69 69
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 void compileScript(String compilerPath, String libDir, 175 void compileScript(String compilerPath, String libDir,
176 String dartPath, String jsPath) { 176 String dartPath, String jsPath) {
177 final process = new Process.start(compilerPath, [ 177 final process = new Process.start(compilerPath, [
178 '--libdir=$libDir', '--out=$jsPath', 178 '--libdir=$libDir', '--out=$jsPath',
179 '--compile-only', '--enable-type-checks', '--warnings-as-errors', 179 '--compile-only', '--enable-type-checks', '--warnings-as-errors',
180 dartPath]); 180 dartPath]);
181 181
182 process.stdout.pipe(stdout, close: false); 182 process.stdout.pipe(stdout, close: false);
183 183
184 process.onError = (error) { 184 process.onError = (error) {
185 print('Failed to compile $dartPath. Error:'); 185 print('Failed to compile $dartPath with $compilerPath. Error:');
186 print(error); 186 print(error);
187 }; 187 };
188 } 188 }
189 189
190 class Dartdoc { 190 class Dartdoc {
191
191 /** Set to `false` to not include the source code in the generated docs. */ 192 /** Set to `false` to not include the source code in the generated docs. */
192 bool includeSource = true; 193 bool includeSource = true;
193 194
194 /** 195 /**
195 * Dartdoc can generate docs in a few different ways based on how dynamic you 196 * Dartdoc can generate docs in a few different ways based on how dynamic you
196 * want the client-side behavior to be. The value for this should be one of 197 * want the client-side behavior to be. The value for this should be one of
197 * the `MODE_` constants. 198 * the `MODE_` constants.
198 */ 199 */
199 int mode = MODE_LIVE_NAV; 200 int mode = MODE_LIVE_NAV;
200 201
(...skipping 16 matching lines...) Expand all
217 * this is `null` then no search box will be shown. 218 * this is `null` then no search box will be shown.
218 */ 219 */
219 String searchEngineId = null; 220 String searchEngineId = null;
220 221
221 /* The URL that the embedded search results should be displayed on. */ 222 /* The URL that the embedded search results should be displayed on. */
222 String searchResultsUrl = 'results.html'; 223 String searchResultsUrl = 'results.html';
223 224
224 /** Set this to add footer text to each generated page. */ 225 /** Set this to add footer text to each generated page. */
225 String footerText = ''; 226 String footerText = '';
226 227
228 /** Set this to add content before the footer */
229 String preFooterText = '';
230
227 /** 231 /**
228 * From exposes the set of libraries in `world.libraries`. That maps library 232 * From exposes the set of libraries in `world.libraries`. That maps library
229 * *keys* to [Library] objects. The keys are *not* exactly the same as their 233 * *keys* to [Library] objects. The keys are *not* exactly the same as their
230 * names. This means if we order by key, we won't actually have them sorted 234 * names. This means if we order by key, we won't actually have them sorted
231 * correctly. This list contains the libraries in correct order by their 235 * correctly. This list contains the libraries in correct order by their
232 * *name*. 236 * *name*.
233 */ 237 */
234 List<Library> _sortedLibraries; 238 List<Library> _sortedLibraries;
235 239
236 CommentMap _comments; 240 CommentMap _comments;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 default: throw 'Unknown mode $mode.'; 402 default: throw 'Unknown mode $mode.';
399 } 403 }
400 } 404 }
401 405
402 void writeHeadContents(String title) { 406 void writeHeadContents(String title) {
403 writeln( 407 writeln(
404 ''' 408 '''
405 <meta charset="utf-8"> 409 <meta charset="utf-8">
406 <title>$title</title> 410 <title>$title</title>
407 <link rel="stylesheet" type="text/css" 411 <link rel="stylesheet" type="text/css"
408 href="${relativePath('styles.css')}" /> 412 href="${relativePath('styles.css')}">
409 <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700 ,800" rel="stylesheet" type="text/css"> 413 <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700 ,800" rel="stylesheet" type="text/css">
410 <link rel="shortcut icon" href="${relativePath('favicon.ico')}" /> 414 <link rel="shortcut icon" href="${relativePath('favicon.ico')}">
411 <script src="${relativePath('$clientScript.js')}"></script>
412 '''); 415 ''');
413 } 416 }
414 417
415 void writeFooter() { 418 void writeFooter() {
416 writeln( 419 writeln(
417 ''' 420 '''
418 </div> 421 </div>
419 <div class="clear"></div> 422 <div class="clear"></div>
420 </div> 423 </div>
424 ${preFooterText}
421 <div class="footer">$footerText</div> 425 <div class="footer">$footerText</div>
426 <script async src="${relativePath('$clientScript.js')}"></script>
422 </body></html> 427 </body></html>
423 '''); 428 ''');
424 } 429 }
425 430
426 void docIndex() { 431 void docIndex() {
427 startFile('index.html'); 432 startFile('index.html');
428 433
429 writeHeader(mainTitle, []); 434 writeHeader(mainTitle, []);
430 435
431 writeln('<h2>$mainTitle</h2>'); 436 writeln('<h2>$mainTitle</h2>');
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 1277
1273 return new md.Element.text('code', name); 1278 return new md.Element.text('code', name);
1274 } 1279 }
1275 1280
1276 // TODO(rnystrom): Move into SourceSpan? 1281 // TODO(rnystrom): Move into SourceSpan?
1277 int getSpanColumn(SourceSpan span) { 1282 int getSpanColumn(SourceSpan span) {
1278 final line = span.file.getLine(span.start); 1283 final line = span.file.getLine(span.start);
1279 return span.file.getColumn(line, span.start); 1284 return span.file.getColumn(line, span.start);
1280 } 1285 }
1281 } 1286 }
OLDNEW
« no previous file with comments | « lib/dartdoc/client-static.dart ('k') | utils/apidoc/README.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698