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

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

Issue 161213002: Tolerate a comment with no end paragraph tag when generating preview (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use a hard-coded comment preview unavailable message instead Created 6 years, 10 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 | « 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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 } 931 }
932 932
933 /// The type of this member to be used in index.txt. 933 /// The type of this member to be used in index.txt.
934 String get typeName => ''; 934 String get typeName => '';
935 935
936 /// Creates a [Map] with this [Indexable]'s name and a preview comment. 936 /// Creates a [Map] with this [Indexable]'s name and a preview comment.
937 Map get previewMap { 937 Map get previewMap {
938 var finalMap = { 'name' : name, 'qualifiedName' : qualifiedName }; 938 var finalMap = { 'name' : name, 'qualifiedName' : qualifiedName };
939 if (comment != '') { 939 if (comment != '') {
940 var index = comment.indexOf('</p>'); 940 var index = comment.indexOf('</p>');
941 finalMap['preview'] = '${comment.substring(0, index)}</p>'; 941 finalMap['preview'] = index > 0 ?
942 '${comment.substring(0, index)}</p>' :
943 '<p><i>Comment preview not available</i></p>';
942 } 944 }
943 return finalMap; 945 return finalMap;
944 } 946 }
945 947
946 /// Accessor to obtain the raw comment text for a given item, _without_ any 948 /// Accessor to obtain the raw comment text for a given item, _without_ any
947 /// of the links resolved. 949 /// of the links resolved.
948 String get _commentText { 950 String get _commentText {
949 String commentText; 951 String commentText;
950 mirror.metadata.forEach((metadata) { 952 mirror.metadata.forEach((metadata) {
951 if (metadata is CommentInstanceMirror) { 953 if (metadata is CommentInstanceMirror) {
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 .map((e) => originalMirror.getField(e.simpleName).reflectee) 2176 .map((e) => originalMirror.getField(e.simpleName).reflectee)
2175 .where((e) => e != null) 2177 .where((e) => e != null)
2176 .toList(); 2178 .toList();
2177 } 2179 }
2178 2180
2179 Map toMap() => { 2181 Map toMap() => {
2180 'name': Indexable.getDocgenObject(mirror, owningLibrary).docName, 2182 'name': Indexable.getDocgenObject(mirror, owningLibrary).docName,
2181 'parameters': parameters 2183 'parameters': parameters
2182 }; 2184 };
2183 } 2185 }
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