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

Unified Diff: tools/dom/docs/lib/docs.dart

Issue 12090035: Split the comment strings in docs extraction on newlines. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merged master. Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
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');

Powered by Google App Engine
This is Rietveld 408576698