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

Side by Side Diff: pkg/docgen/lib/docgen.dart

Issue 58573002: Fix triple slash comments new paragraph spacing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | « no previous file | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 /// **docgen** is a tool for creating machine readable representations of Dart 5 /// **docgen** is a tool for creating machine readable representations of Dart
6 /// code metadata, including: classes, members, comments and annotations. 6 /// code metadata, including: classes, members, comments and annotations.
7 /// 7 ///
8 /// docgen is run on a `.dart` file or a directory containing `.dart` files. 8 /// docgen is run on a `.dart` file or a directory containing `.dart` files.
9 /// 9 ///
10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR] 10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR]
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 'libraries' : filteredEntities.where((e) => 336 'libraries' : filteredEntities.where((e) =>
337 e is Library).map((e) => e.previewMap).toList(), 337 e is Library).map((e) => e.previewMap).toList(),
338 'introduction' : introduction == '' ? 338 'introduction' : introduction == '' ?
339 '' : markdown.markdownToHtml(new File(introduction) 339 '' : markdown.markdownToHtml(new File(introduction)
340 .readAsStringSync(), linkResolver: linkResolver, 340 .readAsStringSync(), linkResolver: linkResolver,
341 inlineSyntaxes: markdownSyntaxes), 341 inlineSyntaxes: markdownSyntaxes),
342 'filetype' : outputToYaml ? 'yaml' : 'json' 342 'filetype' : outputToYaml ? 'yaml' : 'json'
343 }; 343 };
344 } 344 }
345 _writeToFile(JSON.encode(libraryMap), 'library_list.json'); 345 _writeToFile(JSON.encode(libraryMap), 'library_list.json');
346
346 // Output libraries and classes to file after all information is generated. 347 // Output libraries and classes to file after all information is generated.
347 filteredEntities.where((e) => e is Class || e is Library).forEach((output) { 348 filteredEntities.where((e) => e is Class || e is Library).forEach((output) {
348 _writeIndexableToFile(output, outputToYaml); 349 _writeIndexableToFile(output, outputToYaml);
349 }); 350 });
351
350 // Outputs all the qualified names documented with their type. 352 // Outputs all the qualified names documented with their type.
351 // This will help generate search results. 353 // This will help generate search results.
352 _writeToFile(filteredEntities.map((e) => 354 _writeToFile(filteredEntities.map((e) =>
353 '${e.qualifiedName} ${e.typeName}').join('\n') + '\n', 355 '${e.qualifiedName} ${e.typeName}').join('\n') + '\n',
354 'index.txt', append: append); 356 'index.txt', append: append);
355 var index = new Map.fromIterables( 357 var index = new Map.fromIterables(
356 filteredEntities.map((e) => e.qualifiedName), 358 filteredEntities.map((e) => e.qualifiedName),
357 filteredEntities.map((e) => e.typeName)); 359 filteredEntities.map((e) => e.typeName));
358 if (append) { 360 if (append) {
359 var previousIndex = 361 var previousIndex =
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 /// simple markdown converted to html. 445 /// simple markdown converted to html.
444 String _commentToHtml(DeclarationMirror mirror) { 446 String _commentToHtml(DeclarationMirror mirror) {
445 String commentText; 447 String commentText;
446 mirror.metadata.forEach((metadata) { 448 mirror.metadata.forEach((metadata) {
447 if (metadata is CommentInstanceMirror) { 449 if (metadata is CommentInstanceMirror) {
448 CommentInstanceMirror comment = metadata; 450 CommentInstanceMirror comment = metadata;
449 if (comment.isDocComment) { 451 if (comment.isDocComment) {
450 if (commentText == null) { 452 if (commentText == null) {
451 commentText = comment.trimmedText; 453 commentText = comment.trimmedText;
452 } else { 454 } else {
453 commentText = '$commentText ${comment.trimmedText}'; 455 commentText = '$commentText\n${comment.trimmedText}';
454 } 456 }
455 } 457 }
456 } 458 }
457 }); 459 });
458 460
459 commentText = commentText == null ? '' : 461 commentText = commentText == null ? '' :
460 markdown.markdownToHtml(commentText.trim(), linkResolver: linkResolver, 462 markdown.markdownToHtml(commentText.trim(), linkResolver: linkResolver,
461 inlineSyntaxes: markdownSyntaxes); 463 inlineSyntaxes: markdownSyntaxes);
462 return commentText; 464 return commentText;
463 } 465 }
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 String docName(DeclarationMirror m) { 1238 String docName(DeclarationMirror m) {
1237 if (m is LibraryMirror) { 1239 if (m is LibraryMirror) {
1238 return (m as LibraryMirror).qualifiedName.replaceAll('.','-'); 1240 return (m as LibraryMirror).qualifiedName.replaceAll('.','-');
1239 } 1241 }
1240 var owner = m.owner; 1242 var owner = m.owner;
1241 if (owner == null) return m.qualifiedName; 1243 if (owner == null) return m.qualifiedName;
1242 // For the unnamed constructor we just return the class name. 1244 // For the unnamed constructor we just return the class name.
1243 if (m.simpleName == '') return docName(owner); 1245 if (m.simpleName == '') return docName(owner);
1244 return docName(owner) + '.' + m.simpleName; 1246 return docName(owner) + '.' + m.simpleName;
1245 } 1247 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698