Chromium Code Reviews| Index: tools/dom/docs/lib/docs.dart |
| diff --git a/tools/dom/docs/lib/docs.dart b/tools/dom/docs/lib/docs.dart |
| index ca2908f0784cef9738994d7d6ac732198ac87fec..74529c4cc35cfd895f5af84f9847d7938fc23b48 100644 |
| --- a/tools/dom/docs/lib/docs.dart |
| +++ b/tools/dom/docs/lib/docs.dart |
| @@ -29,7 +29,9 @@ const List<String> HTML_LIBRARY_NAMES = const ['dart:html', |
| * comment: "$comment" |
| * members: { |
| * $member: [ |
| - * $comment1, |
| + * [$comment1line1, |
| + * $comment1line2, |
| + * ...], |
| * ... |
| * ], |
| * ... |
| @@ -95,7 +97,8 @@ Map _generateJsonFromLibraries(Compilation compilation) { |
| var membersJson = {}; |
| for (var memberMirror in sortedMembers) { |
| var memberDomName = domNames(memberMirror)[0]; |
| - var memberComment = computeUntrimmedCommentAsList(memberMirror); |
| + var memberComment = _splitCommentsByNewline( |
| + computeUntrimmedCommentAsList(memberMirror)); |
| // Remove interface name from Dom Name. |
| if (memberDomName.indexOf('.') >= 0) { |
| @@ -108,7 +111,8 @@ Map _generateJsonFromLibraries(Compilation compilation) { |
| } |
| // Only include the comment if DocsEditable is set. |
| - var classComment = computeUntrimmedCommentAsList(classMirror); |
| + var classComment = _splitCommentsByNewline( |
| + computeUntrimmedCommentAsList(classMirror)); |
| if (!classComment.isEmpty && |
| findMetadata(classMirror.metadata, 'DocsEditable') != null) { |
| classJson.putIfAbsent('comment', () => classComment); |
| @@ -155,6 +159,16 @@ List<DeclarationMirror> _sortAndFilterMirrors(List<DeclarationMirror> mirrors, |
| return filteredMirrors; |
| } |
| +List<String> _splitCommentsByNewline(List<String> comments) { |
| + var out = []; |
| + |
| + comments.forEach((c) { |
|
blois
2013/01/29 16:53:31
nit- I prefer for () loops over forEach for standa
|
| + out.addAll(c.split(new RegExp('\n'))); |
| + }); |
| + |
| + return out; |
| +} |
| + |
| /// Given the class mirror, returns the names found or an empty list. |
| List<String> domNames(DeclarationMirror mirror) { |
| var domNameMetadata = findMetadata(mirror.metadata, 'DomName'); |