From 49eac958edeefe23cfa11e27f244d149795e1f88 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 7 Jul 2015 13:25:05 -0700 Subject: [PATCH] change the member generation order --- .gitignore | 1 + lib/resources/styles.css | 1 + lib/src/html_generator.dart | 28 ++++++++--- lib/templates/class.html | 68 +++++++++++++-------------- lib/templates/library.html | 92 ++++++++++++++++++------------------- 5 files changed, 104 insertions(+), 86 deletions(-) diff --git a/.gitignore b/.gitignore index 1efc0f7784..d759c1e2c3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ packages .buildlog .pub .idea +.packages .settings/ .DS_Store diff --git a/lib/resources/styles.css b/lib/resources/styles.css index 6f46867696..159df0c263 100644 --- a/lib/resources/styles.css +++ b/lib/resources/styles.css @@ -179,6 +179,7 @@ header h1 { } header a, +header a:hover, header p, header li { color: white; diff --git a/lib/src/html_generator.dart b/lib/src/html_generator.dart index 6573cd27b6..f6d94f4a4c 100644 --- a/lib/src/html_generator.dart +++ b/lib/src/html_generator.dart @@ -4,18 +4,18 @@ library dartdoc.html_generator; +import 'dart:async' show Future; import 'dart:io'; import 'dart:profiler'; -import 'dart:async' show Future; import 'package:mustache4dart/mustache4dart.dart'; import 'package:path/path.dart' as path; import 'model.dart'; import 'package_meta.dart'; +import 'resources.g.dart' as resources; import '../generator.dart'; import '../markdown_processor.dart'; -import 'resources.g.dart' as resources; import '../resource_loader.dart' as loader; typedef String TemplateRenderer(context, @@ -23,6 +23,24 @@ typedef String TemplateRenderer(context, final UserTag _HTML_GENERATE = new UserTag('HTML GENERATE'); +// Generation order for libraries: +// constants +// typedefs +// properties +// functions +// enums +// classes +// exceptions +// +// Generation order for classes: +// constants +// static properties +// static methods +// properties +// constructors +// operators +// methods + class Templates { TemplateRenderer indexTemplate; TemplateRenderer libraryTemplate; @@ -188,9 +206,8 @@ class HtmlGeneratorInstance { generateTypeDef(package, lib, typeDef); }); }); - if (_url != null) { - //generateSiteMap(); - } + + //if (_url != null) generateSiteMap(); await _copyResources(); @@ -281,7 +298,6 @@ class HtmlGeneratorInstance { 'htmlBase': '..' }; - // TODO: `clazz.href` can be null here. _build(path.joinAll(clazz.href.split('/')), _templates.classTemplate, data); } diff --git a/lib/templates/class.html b/lib/templates/class.html index 2b06224268..cb8ec2da9d 100644 --- a/lib/templates/class.html +++ b/lib/templates/class.html @@ -59,28 +59,6 @@ {{/class.hasModifiers}} - {{#class.hasConstructors}} -
-

Constructors

- -
- {{#class.constructors}} -
- {{{linkedName}}}({{{ linkedParams }}}) -
-
- {{#isConst}} -
- const -
- {{/isConst}} - {{{ oneLineDoc }}} -
- {{/class.constructors}} -
-
- {{/class.hasConstructors}} - {{#class.hasConstants}}

Constants

@@ -118,7 +96,7 @@

Static Methods

{{#class.hasProperties}}
-

Instance Properties

+

Properties

{{#class.instanceProperties}} @@ -132,20 +110,27 @@

Instance Properties

{{/class.hasProperties}} - {{#class.hasMethods}} -
-

Instance Methods

-
- {{#class.instanceMethods}} - {{>callable}} - {{/class.instanceMethods}} + {{#class.hasConstructors}} +
+

Constructors

- {{#class.inheritedMethods}} - {{>callable}} - {{/class.inheritedMethods}} +
+ {{#class.constructors}} +
+ {{{linkedName}}}({{{ linkedParams }}}) +
+
+ {{#isConst}} +
+ const +
+ {{/isConst}} + {{{ oneLineDoc }}} +
+ {{/class.constructors}}
- {{/class.hasMethods}} + {{/class.hasConstructors}} {{#class.hasOperators}}
@@ -162,4 +147,19 @@

Operators

{{/class.hasOperators}} + {{#class.hasMethods}} +
+

Methods

+
+ {{#class.instanceMethods}} + {{>callable}} + {{/class.instanceMethods}} + + {{#class.inheritedMethods}} + {{>callable}} + {{/class.inheritedMethods}} +
+
+ {{/class.hasMethods}} + {{>footer}} diff --git a/lib/templates/library.html b/lib/templates/library.html index 8a65601e55..4b4bd25580 100644 --- a/lib/templates/library.html +++ b/lib/templates/library.html @@ -4,39 +4,29 @@ {{>documentation}} {{/library}} - {{#library.hasClasses}} -
-

Classes

+ {{#library.hasConstants}} +
+

Constants

-
- {{#library.classes}} -
- {{{linkedName}}} -
-
- {{{ oneLineDoc }}} -
- {{/library.classes}} +
+ {{#library.constants}} + {{>constant}} + {{/library.constants}}
- {{/library.hasClasses}} + {{/library.hasConstants}} - {{#library.hasEnums}} -
-

Enums

+ {{#library.hasTypedefs}} +
+

Typedefs

-
- {{#library.enums}} -
- {{{linkedName}}} -
-
- {{{ oneLineDoc }}} -
- {{/library.enums}} +
+ {{#library.typedefs}} + {{>callable}} + {{/library.typedefs}}
- {{/library.hasEnums}} + {{/library.hasTypedefs}} {{#library.hasProperties}}
@@ -50,18 +40,6 @@

Properties

{{/library.hasProperties}} - {{#library.hasConstants}} -
-

Constants

- -
- {{#library.constants}} - {{>constant}} - {{/library.constants}} -
-
- {{/library.hasConstants}} - {{#library.hasFunctions}}

Functions

@@ -74,17 +52,39 @@

Functions

{{/library.hasFunctions}} - {{#library.hasTypedefs}} -
-

Typedefs

+ {{#library.hasEnums}} +
+

Enums

-
- {{#library.typedefs}} - {{>callable}} - {{/library.typedefs}} +
+ {{#library.enums}} +
+ {{{linkedName}}} +
+
+ {{{ oneLineDoc }}} +
+ {{/library.enums}}
- {{/library.hasTypedefs}} + {{/library.hasEnums}} + + {{#library.hasClasses}} +
+

Classes

+ +
+ {{#library.classes}} +
+ {{{linkedName}}} +
+
+ {{{ oneLineDoc }}} +
+ {{/library.classes}} +
+
+ {{/library.hasClasses}} {{#library.hasExceptions}}