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

Unified Diff: utils/dartdoc/dartdoc.dart

Issue 9316050: Correctly sort libraries by name, not key. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/dartdoc/dartdoc.dart
diff --git a/utils/dartdoc/dartdoc.dart b/utils/dartdoc/dartdoc.dart
index d3d0825e7138be3e70de723997c3c19797999aca..d9c8b9d09c1318e42d1229c22100af94d7a8f43d 100644
--- a/utils/dartdoc/dartdoc.dart
+++ b/utils/dartdoc/dartdoc.dart
@@ -133,6 +133,15 @@ class Dartdoc {
/** Set this to add footer text to each generated page. */
String footerText = '';
+ /**
+ * From exposes the set of libraries in `world.libraries`. That maps library
+ * *keys* to [Library] objects. The keys are *not* exactly the same as their
+ * names. This means if we order by key, we won't actually have them sorted
+ * correctly. This list contains the libraries in correct order by their
+ * *name*.
+ */
+ List<Library> _sortedLibraries;
+
CommentMap _comments;
/** The library that we're currently generating docs for. */
@@ -204,11 +213,17 @@ class Dartdoc {
world.resolveAll();
+ // Sort the libraries by name (not key).
+ _sortedLibraries = world.libraries.getValues();
+ _sortedLibraries.sort((a, b) {
+ return a.name.toUpperCase().compareTo(b.name.toUpperCase());
+ });
+
// Generate the docs.
if (mode == MODE_LIVE_NAV) docNavigationJson();
docIndex();
- for (final library in world.libraries.getValues()) {
+ for (final library in _sortedLibraries) {
docLibrary(library);
}
} finally {
@@ -347,7 +362,7 @@ class Dartdoc {
writeln('<h2>$mainTitle</h2>');
writeln('<h3>Libraries</h3>');
- for (final library in orderByName(world.libraries)) {
+ for (final library in _sortedLibraries) {
docIndexLibrary(library);
}
@@ -368,7 +383,7 @@ class Dartdoc {
final libraries = {};
- for (final library in orderByName(world.libraries)) {
+ for (final library in _sortedLibraries) {
docLibraryNavigationJson(library, libraries);
}
@@ -398,7 +413,7 @@ class Dartdoc {
''');
if (mode == MODE_STATIC) {
- for (final library in orderByName(world.libraries)) {
+ for (final library in _sortedLibraries) {
write('<h2><div class="icon-library"></div>');
if ((_currentLibrary == library) && (_currentType == null)) {
« 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