| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |