@@ -29,7 +29,6 @@ const String DEFAULT_OUTPUT_DIRECTORY = 'docs';
29
29
/// directory.
30
30
class DartDoc {
31
31
32
- //TODO(keertip): implement excludes
33
32
List <String > _excludes;
34
33
Directory _rootDir;
35
34
final CSS css = new CSS ();
@@ -45,7 +44,16 @@ class DartDoc {
45
44
Stopwatch stopwatch = new Stopwatch ();
46
45
stopwatch.start ();
47
46
var files = findFilesToDocumentInPackage (_rootDir.path);
48
- libraries.addAll (parseLibraries (files));
47
+ List <LibraryElement > libs = [];
48
+ libs.addAll (parseLibraries (files));
49
+ // remove excluded libraries
50
+ _excludes.forEach (
51
+ (pattern) => libs.removeWhere ((l) => l.name.startsWith (pattern)));
52
+ libs.removeWhere (
53
+ (LibraryElement library) => _excludes.contains (library.name));
54
+ libs.sort (elementCompare);
55
+ libraries.addAll (libs);
56
+
49
57
generator = new GeneratorHelper (libraries);
50
58
// create the out directory
51
59
out = new Directory (DEFAULT_OUTPUT_DIRECTORY );
@@ -79,6 +87,7 @@ class DartDoc {
79
87
context.sourceFactory = sourceFactory;
80
88
81
89
files.forEach ((String filePath) {
90
+ print ('parsing ${filePath }...' );
82
91
Source source = new FileBasedSource .con1 (new JavaFile (filePath));
83
92
if (context.computeKindOf (source) == SourceKind .LIBRARY ) {
84
93
LibraryElement library = context.computeLibraryElement (source);
@@ -108,6 +117,7 @@ class DartDoc {
108
117
void generatePackage () {
109
118
var packageName = getPackageName (_rootDir.path);
110
119
var packageDesc = getPackageDescription (_rootDir.path);
120
+ var packageVersion = getPackageVersion (_rootDir.path);
111
121
if (packageName.isNotEmpty) {
112
122
File f = joinFile (new Directory (out.path), ['${packageName }_package.html' ]);
113
123
print ('generating ${f .path }' );
@@ -122,7 +132,9 @@ class DartDoc {
122
132
html.startTag ('div' , attributes: "class='span3'" );
123
133
html.startTag ('ul' , attributes: 'class="nav nav-tabs nav-stacked left-nav"' );
124
134
html.startTag ('li' , attributes: 'class="active"' , newLine: false );
125
- html.write ('<a href="${packageName }">' '<i class="chevron-nav icon-white icon-chevron-right"></i> ' '${packageName }</a>' );
135
+ html.write ('<a href="${packageName }">'
136
+ '<i class="chevron-nav icon-white icon-chevron-right"></i> '
137
+ '${packageName }-${packageVersion }</a>' );
126
138
html.endTag (); //li
127
139
html.endTag (); //ul
128
140
html.endTag ();
@@ -147,8 +159,6 @@ class DartDoc {
147
159
148
160
}
149
161
150
-
151
-
152
162
void generateLibrary (LibraryElement library) {
153
163
File f = joinFile (new Directory (out.path), [getFileNameFor (library)]);
154
164
print ('generating ${f .path }' );
@@ -165,18 +175,11 @@ class DartDoc {
165
175
// left nav
166
176
html.startTag ('div' , attributes: "class='span3'" );
167
177
html.startTag ('ul' , attributes: 'class="nav nav-tabs nav-stacked left-nav"' );
168
- // for (LibraryElement lib in libraries) {
169
- // if (lib == library) {
170
178
html.startTag ('li' , attributes: 'class="active"' , newLine: false );
171
- html.write ('<a href="${getFileNameFor (library )}">' '<i class="chevron-nav icon-white icon-chevron-right"></i> ' '${library .name }</a>' );
172
- // } else {
173
- // html.startTag('li', newLine: false);
174
- // html.write('<a href="${getFileNameFor(lib)}">'
175
- // '<i class="chevron-nav icon-chevron-right"></i> '
176
- // '${lib.name}</a>');
177
- // }
179
+ html.write ('<a href="${getFileNameFor (library )}">'
180
+ '<i class="chevron-nav icon-white icon-chevron-right"></i> '
181
+ '${library .name }</a>' );
178
182
html.endTag (); // li
179
- // }
180
183
html.endTag (); // ul.nav
181
184
html.endTag (); // div.span3
182
185
0 commit comments