Skip to content

Implement basic categorization for libraries in dartdoc #1641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions bin/dartdoc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ main(List<String> arguments) async {
PackageMeta packageMeta = new PackageMeta.fromDir(inputDir);

if (packageMeta == null) {
stderr.writeln(' fatal error: Unable to generate documentation: no pubspec.yaml found');
stderr.writeln(
' fatal error: Unable to generate documentation: no pubspec.yaml found');
exit(1);
}

Expand All @@ -212,7 +213,6 @@ main(List<String> arguments) async {
}
}


logInfo("Generating documentation for '${packageMeta}' into "
"${outputDir.absolute.path}${Platform.pathSeparator}");

Expand All @@ -221,7 +221,6 @@ main(List<String> arguments) async {
footerFilePaths: footerFilePaths,
footerTextFilePaths: footerTextFilePaths,
faviconPath: args['favicon'],
displayAsPackages: args['use-categories'],
prettyIndexJson: args['pretty-index-json']);

for (var generator in generators) {
Expand Down Expand Up @@ -311,10 +310,8 @@ ArgParser _createArgsParser() {
parser.addFlag('show-progress',
help: 'Display progress indications to console stdout', negatable: false);
parser.addOption('sdk-readme',
help:
'Path to the SDK description file. Deprecated (ignored)');
parser.addOption('input',
help: 'Path to source directory.');
help: 'Path to the SDK description file. Deprecated (ignored)');
parser.addOption('input', help: 'Path to source directory.');
parser.addOption('output',
help: 'Path to output directory.', defaultsTo: defaultOutDir);
parser.addMultiOption('header',
Expand Down Expand Up @@ -349,22 +346,18 @@ ArgParser _createArgsParser() {
help: 'A path to a favicon for the generated docs.');
parser.addFlag('use-categories',
help:
'Group libraries from the same package in the libraries sidebar. (deprecated, replaced by display-as-packages)',
negatable: false,
defaultsTo: false);
parser.addFlag('display-as-packages',
help: 'Group libraries from the same package in the libraries sidebar.',
'Group libraries from the same package in the libraries sidebar. (deprecated, ignored)',
negatable: false,
defaultsTo: false);
parser.addMultiOption('category-order',
help:
'A list of package names to place first when --display-as-packages is '
'set. Unmentioned categories are sorted after these. (deprecated, replaced by package-order)',
'A list of package names to place first when grouping libraries in packages. '
'Unmentioned categories are sorted after these. (deprecated, replaced by package-order)',
splitCommas: true);
parser.addMultiOption('package-order',
help:
'A list of package names to place first when --display-as-packages is '
'set. Unmentioned categories are sorted after these.',
'A list of package names to place first when grouping libraries in packages. '
'Unmentioned categories are sorted after these.',
splitCommas: true);
parser.addFlag('auto-include-dependencies',
help:
Expand Down
2 changes: 0 additions & 2 deletions lib/dartdoc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ Future<List<Generator>> initGenerators(String url, String relCanonicalPrefix,
List<String> footerFilePaths,
List<String> footerTextFilePaths,
String faviconPath,
bool displayAsPackages: false,
bool prettyIndexJson: false}) async {
var options = new HtmlGeneratorOptions(
url: url,
relCanonicalPrefix: relCanonicalPrefix,
toolVersion: version,
faviconPath: faviconPath,
displayAsPackages: displayAsPackages,
prettyIndexJson: prettyIndexJson);

return [
Expand Down
13 changes: 13 additions & 0 deletions lib/resources/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,19 @@ ul.subnav li:last-of-type {
padding-top: 25px;
}

.sidebar ol li.section-subtitle a {
color: inherit;
}

.sidebar ol li.section-subtitle {
font-weight: 400;
text-transform: uppercase;
}

.sidebar ol li.section-subitem {
margin-left: 12px;
}

.sidebar ol li:first-child {
padding-top: 0;
margin-top: 0;
Expand Down
4 changes: 0 additions & 4 deletions lib/src/html/html_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ class HtmlGeneratorOptions implements HtmlOptions {
final String faviconPath;
final bool prettyIndexJson;

@override
final bool displayAsPackages;

@override
final String relCanonicalPrefix;

Expand All @@ -129,7 +126,6 @@ class HtmlGeneratorOptions implements HtmlOptions {
this.relCanonicalPrefix,
this.faviconPath,
String toolVersion,
this.displayAsPackages: false,
this.prettyIndexJson: false})
: this.toolVersion = toolVersion ?? 'unknown';
}
4 changes: 1 addition & 3 deletions lib/src/html/template_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import '../model.dart';
abstract class HtmlOptions {
String get relCanonicalPrefix;
String get toolVersion;
bool get displayAsPackages;
}

class Subnav {
Expand Down Expand Up @@ -63,7 +62,6 @@ abstract class TemplateData<T extends Documentable> {
T get self;
String get version => htmlOptions.toolVersion;
String get relCanonicalPrefix => htmlOptions.relCanonicalPrefix;
bool get displayAsPackages => htmlOptions.displayAsPackages;

Iterable<Subnav> getSubNavItems() => <Subnav>[];

Expand Down Expand Up @@ -113,7 +111,7 @@ class PackageTemplateData extends TemplateData<PackageGraph> {
String get homepage => packageGraph.homepage;

@override
String get kind => (displayAsPackages || packageGraph.isSdk) ? '' : 'package';
String get kind => packageGraph.kind;

/// `null` for packages because they are at the root – not needed
@override
Expand Down
2 changes: 2 additions & 0 deletions lib/src/html/templates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const _partials = const <String>[
'constant',
'footer',
'head',
'library',
'packages',
'property',
'features',
'documentation',
Expand Down
Loading