Skip to content

Commit 49eac95

Browse files
committed
change the member generation order
1 parent 15b4e1f commit 49eac95

File tree

5 files changed

+104
-86
lines changed

5 files changed

+104
-86
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ packages
66
.buildlog
77
.pub
88
.idea
9+
.packages
910
.settings/
1011
.DS_Store
1112

lib/resources/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ header h1 {
179179
}
180180

181181
header a,
182+
header a:hover,
182183
header p,
183184
header li {
184185
color: white;

lib/src/html_generator.dart

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,43 @@
44

55
library dartdoc.html_generator;
66

7+
import 'dart:async' show Future;
78
import 'dart:io';
89
import 'dart:profiler';
9-
import 'dart:async' show Future;
1010

1111
import 'package:mustache4dart/mustache4dart.dart';
1212
import 'package:path/path.dart' as path;
1313

1414
import 'model.dart';
1515
import 'package_meta.dart';
16+
import 'resources.g.dart' as resources;
1617
import '../generator.dart';
1718
import '../markdown_processor.dart';
18-
import 'resources.g.dart' as resources;
1919
import '../resource_loader.dart' as loader;
2020

2121
typedef String TemplateRenderer(context,
2222
{bool assumeNullNonExistingProperty, bool errorOnMissingProperty});
2323

2424
final UserTag _HTML_GENERATE = new UserTag('HTML GENERATE');
2525

26+
// Generation order for libraries:
27+
// constants
28+
// typedefs
29+
// properties
30+
// functions
31+
// enums
32+
// classes
33+
// exceptions
34+
//
35+
// Generation order for classes:
36+
// constants
37+
// static properties
38+
// static methods
39+
// properties
40+
// constructors
41+
// operators
42+
// methods
43+
2644
class Templates {
2745
TemplateRenderer indexTemplate;
2846
TemplateRenderer libraryTemplate;
@@ -188,9 +206,8 @@ class HtmlGeneratorInstance {
188206
generateTypeDef(package, lib, typeDef);
189207
});
190208
});
191-
if (_url != null) {
192-
//generateSiteMap();
193-
}
209+
210+
//if (_url != null) generateSiteMap();
194211

195212
await _copyResources();
196213

@@ -281,7 +298,6 @@ class HtmlGeneratorInstance {
281298
'htmlBase': '..'
282299
};
283300

284-
// TODO: `clazz.href` can be null here.
285301
_build(path.joinAll(clazz.href.split('/')), _templates.classTemplate, data);
286302
}
287303

lib/templates/class.html

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -59,28 +59,6 @@
5959
</section>
6060
{{/class.hasModifiers}}
6161

62-
{{#class.hasConstructors}}
63-
<section class="summary" id="constructors">
64-
<h2>Constructors</h2>
65-
66-
<dl class="constructor-summary-list">
67-
{{#class.constructors}}
68-
<dt id="{{htmlId}}" class="callable">
69-
<span class="name">{{{linkedName}}}</span><span class="signature">({{{ linkedParams }}})</span>
70-
</dt>
71-
<dd>
72-
{{#isConst}}
73-
<div class="constructor-modifier">
74-
const
75-
</div>
76-
{{/isConst}}
77-
{{{ oneLineDoc }}}
78-
</dd>
79-
{{/class.constructors}}
80-
</dl>
81-
</section>
82-
{{/class.hasConstructors}}
83-
8462
{{#class.hasConstants}}
8563
<section class="summary" id="constants">
8664
<h2>Constants</h2>
@@ -118,7 +96,7 @@ <h2>Static Methods</h2>
11896

11997
{{#class.hasProperties}}
12098
<section class="summary" id="instance-properties">
121-
<h2>Instance Properties</h2>
99+
<h2>Properties</h2>
122100

123101
<dl class="properties">
124102
{{#class.instanceProperties}}
@@ -132,20 +110,27 @@ <h2>Instance Properties</h2>
132110
</section>
133111
{{/class.hasProperties}}
134112

135-
{{#class.hasMethods}}
136-
<section id="instance-methods-summary" class="summary">
137-
<h2>Instance Methods</h2>
138-
<dl class="callables">
139-
{{#class.instanceMethods}}
140-
{{>callable}}
141-
{{/class.instanceMethods}}
113+
{{#class.hasConstructors}}
114+
<section class="summary" id="constructors">
115+
<h2>Constructors</h2>
142116

143-
{{#class.inheritedMethods}}
144-
{{>callable}}
145-
{{/class.inheritedMethods}}
117+
<dl class="constructor-summary-list">
118+
{{#class.constructors}}
119+
<dt id="{{htmlId}}" class="callable">
120+
<span class="name">{{{linkedName}}}</span><span class="signature">({{{ linkedParams }}})</span>
121+
</dt>
122+
<dd>
123+
{{#isConst}}
124+
<div class="constructor-modifier">
125+
const
126+
</div>
127+
{{/isConst}}
128+
{{{ oneLineDoc }}}
129+
</dd>
130+
{{/class.constructors}}
146131
</dl>
147132
</section>
148-
{{/class.hasMethods}}
133+
{{/class.hasConstructors}}
149134

150135
{{#class.hasOperators}}
151136
<section id="operators-summary" class="summary">
@@ -162,4 +147,19 @@ <h2>Operators</h2>
162147
</section>
163148
{{/class.hasOperators}}
164149

150+
{{#class.hasMethods}}
151+
<section id="instance-methods-summary" class="summary">
152+
<h2>Methods</h2>
153+
<dl class="callables">
154+
{{#class.instanceMethods}}
155+
{{>callable}}
156+
{{/class.instanceMethods}}
157+
158+
{{#class.inheritedMethods}}
159+
{{>callable}}
160+
{{/class.inheritedMethods}}
161+
</dl>
162+
</section>
163+
{{/class.hasMethods}}
164+
165165
{{>footer}}

lib/templates/library.html

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,29 @@
44
{{>documentation}}
55
{{/library}}
66

7-
{{#library.hasClasses}}
8-
<section class="summary" id="classes">
9-
<h2>Classes</h2>
7+
{{#library.hasConstants}}
8+
<section class="summary" id="constants">
9+
<h2>Constants</h2>
1010

11-
<dl>
12-
{{#library.classes}}
13-
<dt id="{{htmlId}}">
14-
<span class="name {{#isDeprecated}}deprecated{{/isDeprecated}}">{{{linkedName}}}</span>
15-
</dt>
16-
<dd>
17-
{{{ oneLineDoc }}}
18-
</dd>
19-
{{/library.classes}}
11+
<dl class="properties">
12+
{{#library.constants}}
13+
{{>constant}}
14+
{{/library.constants}}
2015
</dl>
2116
</section>
22-
{{/library.hasClasses}}
17+
{{/library.hasConstants}}
2318

24-
{{#library.hasEnums}}
25-
<section class="summary" id="enums">
26-
<h2>Enums</h2>
19+
{{#library.hasTypedefs}}
20+
<section class="summary" id="typedefs">
21+
<h2>Typedefs</h2>
2722

28-
<dl class="dl-horizontal">
29-
{{#library.enums}}
30-
<dt id="{{htmlId}}">
31-
{{{linkedName}}}
32-
</dt>
33-
<dd>
34-
{{{ oneLineDoc }}}
35-
</dd>
36-
{{/library.enums}}
23+
<dl class="callables">
24+
{{#library.typedefs}}
25+
{{>callable}}
26+
{{/library.typedefs}}
3727
</dl>
3828
</section>
39-
{{/library.hasEnums}}
29+
{{/library.hasTypedefs}}
4030

4131
{{#library.hasProperties}}
4232
<section class="summary" id="properties">
@@ -50,18 +40,6 @@ <h2>Properties</h2>
5040
</section>
5141
{{/library.hasProperties}}
5242

53-
{{#library.hasConstants}}
54-
<section class="summary" id="constants">
55-
<h2>Constants</h2>
56-
57-
<dl class="properties">
58-
{{#library.constants}}
59-
{{>constant}}
60-
{{/library.constants}}
61-
</dl>
62-
</section>
63-
{{/library.hasConstants}}
64-
6543
{{#library.hasFunctions}}
6644
<section class="summary" id="functions">
6745
<h2>Functions</h2>
@@ -74,17 +52,39 @@ <h2>Functions</h2>
7452
</section>
7553
{{/library.hasFunctions}}
7654

77-
{{#library.hasTypedefs}}
78-
<section class="summary" id="typedefs">
79-
<h2>Typedefs</h2>
55+
{{#library.hasEnums}}
56+
<section class="summary" id="enums">
57+
<h2>Enums</h2>
8058

81-
<dl class="callables">
82-
{{#library.typedefs}}
83-
{{>callable}}
84-
{{/library.typedefs}}
59+
<dl class="dl-horizontal">
60+
{{#library.enums}}
61+
<dt id="{{htmlId}}">
62+
{{{linkedName}}}
63+
</dt>
64+
<dd>
65+
{{{ oneLineDoc }}}
66+
</dd>
67+
{{/library.enums}}
8568
</dl>
8669
</section>
87-
{{/library.hasTypedefs}}
70+
{{/library.hasEnums}}
71+
72+
{{#library.hasClasses}}
73+
<section class="summary" id="classes">
74+
<h2>Classes</h2>
75+
76+
<dl>
77+
{{#library.classes}}
78+
<dt id="{{htmlId}}">
79+
<span class="name {{#isDeprecated}}deprecated{{/isDeprecated}}">{{{linkedName}}}</span>
80+
</dt>
81+
<dd>
82+
{{{ oneLineDoc }}}
83+
</dd>
84+
{{/library.classes}}
85+
</dl>
86+
</section>
87+
{{/library.hasClasses}}
8888

8989
{{#library.hasExceptions}}
9090
<section class="summary" id="exceptions">

0 commit comments

Comments
 (0)