diff --git a/bin/dartdoc.dart b/bin/dartdoc.dart index d62ec04b81..f5939fd06f 100644 --- a/bin/dartdoc.dart +++ b/bin/dartdoc.dart @@ -2,6 +2,8 @@ // 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. +library dartdoc.bin; + import 'dart:io'; import 'package:args/args.dart'; diff --git a/lib/src/css.dart b/lib/src/css.dart index 383a9d1309..99bef4e20f 100644 --- a/lib/src/css.dart +++ b/lib/src/css.dart @@ -2,10 +2,10 @@ // 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. -library css; +library dartdoc.css; -import 'dart:io'; import 'dart:convert'; +import 'dart:io'; class CSS { diff --git a/lib/src/generator.dart b/lib/src/generator.dart index 74a3008242..fea971b6c3 100644 --- a/lib/src/generator.dart +++ b/lib/src/generator.dart @@ -139,7 +139,7 @@ class HtmlGenerator { List variables = library.getVariables(); List accessors = library.getAccessors(); - List functions = library.getFunctions(); + List functions = library.getFunctions(); List typedefs = library.getTypedefs(); List types = library.getTypes(); @@ -245,7 +245,6 @@ class HtmlGenerator { generateElements(cls.getMethods(), false); } - void printComments(ModelElement e, [bool indent = true]) { String comments = e.getDocumentation(); if (comments != null) { @@ -263,7 +262,6 @@ class HtmlGenerator { } } - void generateElements(List elements, [bool header = true]) { if (!elements.isEmpty) { html.tag('h4', contents: elements[0].typeName); @@ -446,7 +444,6 @@ String _getFileNameFor(Library library) { return '${library.name}.html'; } - class HtmlGeneratorHelper extends Helper { Package package; @@ -482,7 +479,7 @@ class HtmlGeneratorHelper extends Helper { } else { String append = ''; - if (appendParens && (e is Method || e is Fnction)) { + if (appendParens && (e is Method || e is ModelFunction)) { append = '()'; } return "${htmlEscape(e.name)}$append"; diff --git a/lib/src/html_gen.dart b/lib/src/html_gen.dart index a3da2e46fd..2ab3e1556a 100644 --- a/lib/src/html_gen.dart +++ b/lib/src/html_gen.dart @@ -2,7 +2,7 @@ // 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. -library html_gen; +library dartdoc.html_gen; class HtmlHelper { StringBuffer buffer = new StringBuffer(); diff --git a/lib/src/io_utils.dart b/lib/src/io_utils.dart index a67d1c3d5d..59e839a4f9 100644 --- a/lib/src/io_utils.dart +++ b/lib/src/io_utils.dart @@ -83,7 +83,6 @@ List findFilesToDocumentInPackage(String packageDir) { // TODO(janicejl): Remove when Issue(12406) is resolved. var contents = new File(lib).readAsStringSync(); - if (contents.contains(new RegExp('\npart of ')) || contents.startsWith(new RegExp('part of '))) { // logger.warning('Skipping part "$lib". ' diff --git a/lib/src/model.dart b/lib/src/model.dart index 69e20ea580..bf7fbf4fb3 100644 --- a/lib/src/model.dart +++ b/lib/src/model.dart @@ -24,7 +24,7 @@ abstract class ModelElement { return new Class(e, library); } if (e is FunctionElement) { - return new Fnction(e, library); + return new ModelFunction(e, library); } if (e is FunctionTypeAliasElement) { return new Typedef(e, library); @@ -259,7 +259,7 @@ class Library extends ModelElement { return elements.map((e) => new Typedef(e, this)).toList(); } - List getFunctions() { + List getFunctions() { List elements = []; elements.addAll(_library.definingCompilationUnit.functions); for (CompilationUnitElement cu in _library.parts) { @@ -268,7 +268,7 @@ class Library extends ModelElement { elements ..removeWhere(isPrivate) ..sort(elementCompare); - return elements.map((e) => new Fnction(e, this)).toList(); + return elements.map((e) => new ModelFunction(e, this)).toList(); } List getTypes() { @@ -340,10 +340,9 @@ class Class extends ModelElement { } } +class ModelFunction extends ModelElement { -class Fnction extends ModelElement { - - Fnction(FunctionElement element, Library library) : super(element, library); + ModelFunction(FunctionElement element, Library library) : super(element, library); FunctionElement get _func => (element as FunctionElement); @@ -368,7 +367,6 @@ class Fnction extends ModelElement { } } - class Typedef extends ModelElement { FunctionTypeAliasElement get _typedef => (element as FunctionTypeAliasElement); @@ -458,7 +456,6 @@ class Constructor extends ModelElement { } } - class Method extends ModelElement { // MethodElement get _method => (element as MethodElement); @@ -570,7 +567,6 @@ class ElementType { List get typeArguments => (_type as ParameterizedType).typeArguments.map((f) => new ElementType(f, library)).toList(); } - abstract class Helper { String createLinkedName(ModelElement e, [bool appendParens = false]); String createLinkedReturnTypeName(ElementType type); diff --git a/lib/src/model_utils.dart b/lib/src/model_utils.dart index fbc29a8292..85fd52170d 100644 --- a/lib/src/model_utils.dart +++ b/lib/src/model_utils.dart @@ -2,7 +2,7 @@ // 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. -library model_utils; +library dartdoc.model_utils; import 'package:analyzer/src/generated/constant.dart'; import 'package:analyzer/src/generated/element.dart'; diff --git a/lib/src/package_utils.dart b/lib/src/package_utils.dart index c9c7f4a89f..cb01b53b4e 100644 --- a/lib/src/package_utils.dart +++ b/lib/src/package_utils.dart @@ -22,6 +22,6 @@ Map _getPubspec(String directoryName) { String getPackageDescription(String directoryName) => _getPubspec(directoryName)['description']; - + String getPackageVersion(String directoryName) => _getPubspec(directoryName)['version']; diff --git a/pubspec.yaml b/pubspec.yaml index b1643d5213..83ce5c6164 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,6 +3,7 @@ version: 0.0.1 author: Dart Team description: A documentation generator for Dart. homepage: https://github.com/dart-lang/dartdoc + dependencies: analyzer: any args: any @@ -10,7 +11,10 @@ dependencies: logging: any mustache4dart: '>= 1.0.0 < 2.0.0' path: any - unittest: any yaml: any + +dev_dependencies: + unittest: any + executables: dartdoc: null diff --git a/templates/sitemap.xml b/templates/sitemap.xml index cc334447cd..9ceec7f106 100644 --- a/templates/sitemap.xml +++ b/templates/sitemap.xml @@ -1,5 +1,5 @@ - + {{#links}} {{url}}/{{name}} diff --git a/test/template_test.dart b/test/template_test.dart index 2ecc93e2c3..729583bb90 100644 --- a/test/template_test.dart +++ b/test/template_test.dart @@ -25,7 +25,7 @@ tests() { expect(sitemap({'links' : [{'name': 'somefile.html'}]}), ''' - + /somefile.html @@ -37,7 +37,7 @@ tests() { expect(sitemap({'links' : [{'name': 'somefile.html'}, {'name': 'asecondfile.html'}]}), ''' - + /somefile.html @@ -52,7 +52,7 @@ tests() { expect(sitemap({'url': 'http://mydoc.com','links' : [{'name': 'somefile.html'}]}), ''' - + http://mydoc.com/somefile.html