Skip to content

Commit 43c2663

Browse files
authored
Move templates into lib/templates and other clean up. (#3677)
1 parent 40af8ea commit 43c2663

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+372
-441
lines changed

lib/src/generator/templates.aot_renderers_for_html.dart

+309-343
Large diffs are not rendered by default.

lib/src/generator/templates.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ abstract class Templates {
122122
resourceProvider: context.resourceProvider);
123123
} else if (forceRuntimeTemplates) {
124124
var directory = await context.resourceProvider
125-
.getResourceFolder('package:dartdoc/templates/html');
125+
.getResourceFolder('package:dartdoc/templates');
126126
return RuntimeTemplates._create(directory,
127127
resourceProvider: context.resourceProvider);
128128
} else {

lib/src/mustachio/annotations.dart

+3-13
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ class Renderer {
2828
/// render the [context] object while generating documentation in HTML.
2929
final String standardHtmlTemplate;
3030

31-
/// The unparsed, string form of the URI of the _standard_ Markdown template.
32-
///
33-
/// This represents the Mustache template that dartdoc uses out-of-the-box to
34-
/// render the [context] object while generating documentation in Markdown.
35-
final String standardMdTemplate;
36-
3731
/// A set of types which are "visible" to the Mustache runtime interpreter.
3832
/// Mustache runtime-rendering has access to all of a type's public getters if
3933
/// the type is visible to Mustache.
@@ -53,20 +47,16 @@ class Renderer {
5347
this.context,
5448
String standardTemplateBasename, {
5549
this.visibleTypes = const {},
56-
}) : standardHtmlTemplate =
57-
'lib/templates/html/$standardTemplateBasename.html',
58-
standardMdTemplate = 'lib/templates/md/$standardTemplateBasename.md';
50+
}) : standardHtmlTemplate = 'lib/templates/$standardTemplateBasename.html';
5951

6052
@visibleForTesting
6153
const Renderer.forTest(
6254
this.name,
6355
this.context,
6456
String standardTemplateBasename, {
6557
this.visibleTypes = const {},
66-
}) : standardHtmlTemplate =
67-
'test/mustachio/templates/$standardTemplateBasename.html',
68-
standardMdTemplate =
69-
'test/mustachio/templates/$standardTemplateBasename.md';
58+
}) : standardHtmlTemplate =
59+
'test/mustachio/templates/$standardTemplateBasename.html';
7060
}
7161

7262
/// A container for a type, [T], which is the type of a context object,
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/mustachio/aot_compiler_builder_test.dart

+9-11
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ library foo;
2828
import 'annotations.dart';
2929
''',
3030
additionalAssets: () => [
31-
d.dir('lib/templates/html', [
31+
d.dir('lib/templates', [
3232
d.file('foo.html', '{{ >foo_header }}'),
3333
d.file('_foo_header.html', 'EMPTY'),
3434
]),
@@ -57,7 +57,7 @@ library foo;
5757
import 'annotations.dart';
5858
''',
5959
additionalAssets: () => [
60-
d.dir('lib/templates/html', [
60+
d.dir('lib/templates', [
6161
d.file('foo.html', 's1 is {{ s1 }}'),
6262
]),
6363
d.dir('md', [
@@ -84,10 +84,8 @@ import 'annotations.dart';
8484
additionalAssets: () => [
8585
d.dir('lib', [
8686
d.dir('templates', [
87-
d.dir('html', [
88-
d.file('foo.html', '{{ >foo_header }}'),
89-
d.file('_foo_header.html', 's1 is {{ s1 }}'),
90-
]),
87+
d.file('foo.html', '{{ >foo_header }}'),
88+
d.file('_foo_header.html', 's1 is {{ s1 }}'),
9189
]),
9290
]),
9391
],
@@ -138,7 +136,7 @@ library foo;
138136
import 'annotations.dart';
139137
''',
140138
additionalAssets: () => [
141-
d.dir('lib/templates/html', [
139+
d.dir('lib/templates', [
142140
d.file('foo.html', '{{ >base }}'),
143141
d.file('bar.html', '{{ >base }}'),
144142
d.file('_base.html', 's1 is {{ s1 }}'),
@@ -149,16 +147,16 @@ import 'annotations.dart';
149147
expect(
150148
generatedContent,
151149
contains('String _renderFoo_partial_base_0(Foo context0) =>\n'
152-
' _deduplicated_lib_templates_html__base_html(context0);\n'),
150+
' _deduplicated_lib_templates__base_html(context0);\n'),
153151
);
154152
expect(
155153
generatedContent,
156154
contains('String _renderBar_partial_base_0(Bar context0) =>\n'
157-
' _deduplicated_lib_templates_html__base_html(context0);\n'),
155+
' _deduplicated_lib_templates__base_html(context0);\n'),
158156
);
159157
expect(
160158
generatedContent,
161-
contains('String _deduplicated_lib_templates_html__base_html('),
159+
contains('String _deduplicated_lib_templates__base_html('),
162160
);
163161
});
164162

@@ -185,7 +183,7 @@ library foo;
185183
import 'annotations.dart';
186184
''',
187185
additionalAssets: () => [
188-
d.dir('lib/templates/html', [
186+
d.dir('lib/templates', [
189187
d.file('foo.html', '{{ >base }}'),
190188
d.file('bar.html', '{{ >base }}'),
191189
d.file('_base.html', 's1 is {{ s1 }}'),

0 commit comments

Comments
 (0)