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

Unified Diff: pkg/dartdoc/client-live-nav.dart

Issue 10919260: Reorganize dartdoc to new package layout. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « pkg/dartdoc/classify.dart ('k') | pkg/dartdoc/client-shared.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dartdoc/client-live-nav.dart
diff --git a/pkg/dartdoc/client-live-nav.dart b/pkg/dartdoc/client-live-nav.dart
deleted file mode 100644
index d66da8b761c8a2930801e5880974a6d03ac4ba59..0000000000000000000000000000000000000000
--- a/pkg/dartdoc/client-live-nav.dart
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/** Provides client-side behavior for generated docs. */
-#library('client-live-nav');
-
-#import('dart:html');
-#import('dart:json');
-#import('../../lib/compiler/implementation/source_file.dart');
-#import('classify.dart');
-#import('markdown.dart', prefix: 'md');
-
-#source('dropdown.dart');
-#source('search.dart');
-#source('nav.dart');
-#source('client-shared.dart');
-
-main() {
- setupLocation();
-
- enableCodeBlocks();
-
- // Request the navigation data so we can build the HTML for it.
- new HttpRequest.get('${prefix}nav.json', (request) {
- var json = JSON.parse(request.responseText);
- buildNavigation(json);
- setupSearch(json);
- });
-}
-
-
-/**
- * Takes [libraries], a JSON array representing a set of libraries and builds
- * the appropriate navigation DOM for it relative to the current library and
- * type.
- */
-buildNavigation(List libraries) {
- final html = new StringBuffer();
- for (Map libraryInfo in libraries) {
- String libraryName = libraryInfo[NAME];
- html.add('<h2><div class="icon-library"></div>');
- if (currentLibrary == libraryName && currentType == null) {
- html.add('<strong>${md.escapeHtml(libraryName)}</strong>');
- } else {
- final url = getLibraryUrl(libraryName);
- html.add('<a href="$url">${md.escapeHtml(libraryName)}</a>');
- }
- html.add('</h2>');
-
- // Only list the types for the current library.
- if (currentLibrary == libraryName && libraryInfo.containsKey(TYPES)) {
- buildLibraryNavigation(html, libraryInfo);
- }
- }
-
- // Insert it into the DOM.
- final navElement = document.query('.nav');
- navElement.innerHTML = html.toString();
-}
-
-/** Writes the navigation for the types contained by [library] to [html]. */
-buildLibraryNavigation(StringBuffer html, Map libraryInfo) {
- // Show the exception types separately.
- final types = [];
- final exceptions = [];
-
- for (Map typeInfo in libraryInfo[TYPES]) {
- if (typeInfo[NAME].endsWith('Exception')) {
- exceptions.add(typeInfo);
- } else {
- types.add(typeInfo);
- }
- }
-
- if (types.length == 0 && exceptions.length == 0) return;
-
- writeType(String icon, Map typeInfo) {
- html.add('<li>');
- if (currentType == typeInfo[NAME]) {
- html.add(
- '<div class="icon-$icon"></div><strong>${getTypeName(typeInfo)}</strong>');
- } else {
- html.add(
- '''
- <a href="${getTypeUrl(currentLibrary, typeInfo)}">
- <div class="icon-$icon"></div>${getTypeName(typeInfo)}
- </a>
- ''');
- }
- html.add('</li>');
- }
-
- html.add('<ul class="icon">');
- types.forEach((typeInfo) =>
- writeType(kindToString(typeInfo[KIND]), typeInfo));
- exceptions.forEach((typeInfo) => writeType('exception', typeInfo));
- html.add('</ul>');
-}
« no previous file with comments | « pkg/dartdoc/classify.dart ('k') | pkg/dartdoc/client-shared.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698