Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion lib/src/dartdoc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'package:analyzer/file_system/file_system.dart';
import 'package:dartdoc/src/dartdoc_options.dart';
import 'package:dartdoc/src/failure.dart';
import 'package:dartdoc/src/generator/generator.dart';
import 'package:dartdoc/src/generator/html_generator.dart';
import 'package:dartdoc/src/logging.dart';
import 'package:dartdoc/src/model/model.dart';
import 'package:dartdoc/src/package_meta.dart';
Expand Down
14 changes: 14 additions & 0 deletions lib/src/generator/generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ library;

import 'package:dartdoc/src/dartdoc_options.dart';
import 'package:dartdoc/src/generator/generator_backend.dart';
import 'package:dartdoc/src/generator/html_generator_backend.dart';
import 'package:dartdoc/src/generator/templates.dart';
import 'package:dartdoc/src/logging.dart';
import 'package:dartdoc/src/model/model.dart';
import 'package:dartdoc/src/model_utils.dart';
Expand Down Expand Up @@ -306,3 +308,15 @@ List<DartdocOption> createGeneratorOptions(
'SEO; learn more at https://goo.gl/gktN6F.'),
];
}

/// Creates a [Generator] with an [HtmlGeneratorBackend] backend.
Generator initHtmlGenerator(
DartdocGeneratorOptionContext context, {
required FileWriter writer,
}) {
var templates = HtmlAotTemplates();
var options = DartdocGeneratorBackendOptions.fromContext(context);
var generatorBackend = HtmlGeneratorBackend(
options, templates, writer, context.resourceProvider);
return Generator(generatorBackend);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,14 @@
// 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.

import 'package:dartdoc/src/dartdoc_options.dart';
import 'package:dartdoc/src/generator/generator.dart';
import 'package:dartdoc/src/generator/generator_backend.dart';
import 'package:dartdoc/src/generator/html_resources.g.dart' as resources;
import 'package:dartdoc/src/generator/resource_loader.dart';
import 'package:dartdoc/src/generator/template_data.dart';
import 'package:dartdoc/src/generator/templates.dart';
import 'package:dartdoc/src/model/model.dart';
import 'package:dartdoc/src/runtime_stats.dart';

/// Creates a [Generator] with an [HtmlGeneratorBackend] backend.
Generator initHtmlGenerator(
DartdocGeneratorOptionContext context, {
required FileWriter writer,
}) {
var templates = HtmlAotTemplates();
var options = DartdocGeneratorBackendOptions.fromContext(context);
var generatorBackend = HtmlGeneratorBackend(
options, templates, writer, context.resourceProvider);
return Generator(generatorBackend);
}

/// Generator backend for HTML output.
class HtmlGeneratorBackend extends GeneratorBackend {
HtmlGeneratorBackend(
Expand Down
2 changes: 1 addition & 1 deletion test/html_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:dartdoc/src/dartdoc.dart' show DartdocFileWriter;
import 'package:dartdoc/src/dartdoc_options.dart';
import 'package:dartdoc/src/generator/generator.dart';
import 'package:dartdoc/src/generator/generator_backend.dart';
import 'package:dartdoc/src/generator/html_generator.dart';
import 'package:dartdoc/src/generator/html_generator_backend.dart';
import 'package:dartdoc/src/generator/html_resources.g.dart';
import 'package:dartdoc/src/generator/templates.dart';
import 'package:dartdoc/src/model/library.dart';
Expand Down
Loading