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

Unified Diff: utils/dartdoc/utils.dart

Issue 8771054: Add a script to generate HTML and DOM docs with cross-links to one another. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More code review changes. Created 9 years 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
« client/html/scripts/html_diff.dart ('K') | « utils/dartdoc/htmldoc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/dartdoc/utils.dart
diff --git a/utils/dartdoc/utils.dart b/utils/dartdoc/utils.dart
index a77d5fcfeb6616681b2047964896368c8292c41c..b827772f84236076da2ae360a093b396d0cb679e 100644
--- a/utils/dartdoc/utils.dart
+++ b/utils/dartdoc/utils.dart
@@ -65,4 +65,15 @@ List orderByName(Map<String, Dynamic> map) {
values.add(map[k]);
}
return values;
-}
+}
+
+/**
+ * Joins [items] into a single, comma-separated string using [conjunction].
+ * E.g. `['A', 'B', 'C']` becomes `"A, B, and C"`.
+ */
+String joinWithCommas(List<String> items, [String conjunction = 'and']) {
+ if (items.length == 1) return items[0];
+ if (items.length == 2) return "${items[0]} $conjunction ${items[1]}";
+ return Strings.join(items.getRange(0, items.length - 1), ', ') +
+ ', $conjunction ' + items[items.length - 1];
+}
« client/html/scripts/html_diff.dart ('K') | « utils/dartdoc/htmldoc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698