| OLD | NEW |
| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 /* The URL that the embedded search results should be displayed on. */ | 223 /* The URL that the embedded search results should be displayed on. */ |
| 224 String searchResultsUrl = 'results.html'; | 224 String searchResultsUrl = 'results.html'; |
| 225 | 225 |
| 226 /** Set this to add footer text to each generated page. */ | 226 /** Set this to add footer text to each generated page. */ |
| 227 String footerText = ''; | 227 String footerText = ''; |
| 228 | 228 |
| 229 /** Set this to add content before the footer */ | 229 /** Set this to add content before the footer */ |
| 230 String preFooterText = ''; | 230 String preFooterText = ''; |
| 231 | 231 |
| 232 /** Set this to add any attributes to the HTML element */ |
| 233 String htmlAttributes = ''; |
| 234 |
| 232 /** | 235 /** |
| 233 * From exposes the set of libraries in `world.libraries`. That maps library | 236 * From exposes the set of libraries in `world.libraries`. That maps library |
| 234 * *keys* to [Library] objects. The keys are *not* exactly the same as their | 237 * *keys* to [Library] objects. The keys are *not* exactly the same as their |
| 235 * names. This means if we order by key, we won't actually have them sorted | 238 * names. This means if we order by key, we won't actually have them sorted |
| 236 * correctly. This list contains the libraries in correct order by their | 239 * correctly. This list contains the libraries in correct order by their |
| 237 * *name*. | 240 * *name*. |
| 238 */ | 241 */ |
| 239 List<Library> _sortedLibraries; | 242 List<Library> _sortedLibraries; |
| 240 | 243 |
| 241 CommentMap _comments; | 244 CommentMap _comments; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 * ['foo', 'foo.html', 'bar', null] | 339 * ['foo', 'foo.html', 'bar', null] |
| 337 * | 340 * |
| 338 * It will output: | 341 * It will output: |
| 339 * | 342 * |
| 340 * <a href="foo.html">foo</a> › bar | 343 * <a href="foo.html">foo</a> › bar |
| 341 */ | 344 */ |
| 342 void writeHeader(String title, List<String> breadcrumbs) { | 345 void writeHeader(String title, List<String> breadcrumbs) { |
| 343 write( | 346 write( |
| 344 ''' | 347 ''' |
| 345 <!DOCTYPE html> | 348 <!DOCTYPE html> |
| 346 <html> | 349 <html${htmlAttributes.trim() == '' ? '' : ' $htmlAttributes'}> |
| 347 <head> | 350 <head> |
| 348 '''); | 351 '''); |
| 349 writeHeadContents(title); | 352 writeHeadContents(title); |
| 350 | 353 |
| 351 // Add data attributes describing what the page documents. | 354 // Add data attributes describing what the page documents. |
| 352 var data = ''; | 355 var data = ''; |
| 353 if (_currentLibrary != null) { | 356 if (_currentLibrary != null) { |
| 354 data += ' data-library="${md.escapeHtml(_currentLibrary.name)}"'; | 357 data += ' data-library="${md.escapeHtml(_currentLibrary.name)}"'; |
| 355 } | 358 } |
| 356 | 359 |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 | 1283 |
| 1281 return new md.Element.text('code', name); | 1284 return new md.Element.text('code', name); |
| 1282 } | 1285 } |
| 1283 | 1286 |
| 1284 // TODO(rnystrom): Move into SourceSpan? | 1287 // TODO(rnystrom): Move into SourceSpan? |
| 1285 int getSpanColumn(SourceSpan span) { | 1288 int getSpanColumn(SourceSpan span) { |
| 1286 final line = span.file.getLine(span.start); | 1289 final line = span.file.getLine(span.start); |
| 1287 return span.file.getColumn(line, span.start); | 1290 return span.file.getColumn(line, span.start); |
| 1288 } | 1291 } |
| 1289 } | 1292 } |
| OLD | NEW |