From 430a9692072f86bbab5f8eb4e742d89f6d615c87 Mon Sep 17 00:00:00 2001 From: "rnystrom@google.com" Date: Thu, 8 Dec 2011 03:31:41 +0000 Subject: [PATCH] In the navigation, list exception types after other types. Review URL: http://codereview.chromium.org//8885005 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2223 260f80e4-7a28-3924-810f-c04153c831b5 --- utils/dartdoc/dartdoc.dart | 40 ++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/utils/dartdoc/dartdoc.dart b/utils/dartdoc/dartdoc.dart index 18b15bdfb2c..e11db2fe208 100644 --- a/utils/dartdoc/dartdoc.dart +++ b/utils/dartdoc/dartdoc.dart @@ -248,29 +248,39 @@ docNavigation() { /** Writes the navigation for the types contained by the given library. */ docLibraryNavigation(Library library) { - final types = orderByName(library.types).filter( - (type) => !type.isTop && !type.name.startsWith('_')); + // Show the exception types separately. + final types = []; + final exceptions = []; - if (types.length == 0) return; + for (final type in orderByName(library.types)) { + if (type.isTop) continue; + if (type.name.startsWith('_')) continue; - writeln('
    '); - for (final type in types) { - var icon = 'icon-interface'; if (type.name.endsWith('Exception')) { - icon = 'icon-exception'; - } else if (type.isClass) { - icon = 'icon-class'; - } - write('
  • '); - - if (_currentType == type) { - write('
    ${typeName(type)}'); + exceptions.add(type); } else { - write(a(typeUrl(type), '
    ${typeName(type)}')); + types.add(type); } + } + if ((types.length == 0) && (exceptions.length == 0)) return; + + writeType(String icon, Type type) { + write('
  • '); + if (_currentType == type) { + write( + '
    ${typeName(type)}'); + } else { + write(a(typeUrl(type), + '
    ${typeName(type)}')); + } writeln('
  • '); } + + writeln('
      '); + types.forEach((type) => writeType(type.isClass ? 'class' : 'interface', + type)); + exceptions.forEach((type) => writeType('exception', type)); writeln('
    '); }