Skip to content

Fix annotation templates and renderer #2605

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 2 commits into from
Apr 5, 2021
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
4 changes: 4 additions & 0 deletions lib/src/generator/templates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// 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.

// Annotations only appear on other pages, so there is no template data here.
@Renderer(#renderAnnotation, Context<Annotation>())
@Renderer(#renderCategory, Context<CategoryTemplateData>(),
visibleTypes: _visibleTypes)
@Renderer(#renderClass, Context<ClassTemplateData>())
Expand All @@ -28,6 +30,7 @@ import 'package:dartdoc/dartdoc.dart';
import 'package:dartdoc/options.dart';
import 'package:dartdoc/src/generator/resource_loader.dart';
import 'package:dartdoc/src/generator/template_data.dart';
import 'package:dartdoc/src/model/annotation.dart';
import 'package:dartdoc/src/model/feature_set.dart';
import 'package:dartdoc/src/model/language_feature.dart';
import 'package:dartdoc/src/mustachio/annotations.dart';
Expand All @@ -36,6 +39,7 @@ import 'package:meta/meta.dart';
import 'package:path/path.dart' as path show Context;

const _visibleTypes = {
Annotation,
CallableElementTypeMixin,
Category,
Class,
Expand Down
3,004 changes: 1,658 additions & 1,346 deletions lib/src/generator/templates.renderers.dart

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/templates/html/_callable_multiline.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<ol class="annotation-list">
{{#annotations}}
<li>{{{.}}}</li>
<li>{{{linkedNameWithParameters}}}</li>
{{/annotations}}
</ol>
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/html/_type_multiline.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<ol class="annotation-list">
{{#annotations}}
<li>{{{.}}}</li>
<li>{{{linkedNameWithParameters}}}</li>
{{/annotations}}
</ol>
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/html/class.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h5>{{parent.name}} {{parent.kind}}</h5>
<dt>Annotations</dt>
<dd><ul class="annotation-list clazz-relationships">
{{#annotations}}
<li>{{{.}}}</li>
<li>{{{linkedNameWithParameters}}}</li>
{{/annotations}}
</ul></dd>
{{/hasAnnotations}}
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/html/constructor.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h5>{{parent.name}} {{parent.kind}}</h5>
<div>
<ol class="annotation-list">
{{#annotations}}
<li>{{{.}}}</li>
<li>{{{linkedNameWithParameters}}}</li>
{{/annotations}}
</ol>
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/html/enum.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h5>{{parent.name}} {{parent.kind}}</h5>
<dt>Annotations</dt>
<dd><ul class="annotation-list eNum-relationships">
{{#annotations}}
<li>{{{.}}}</li>
<li>{{{linkedNameWithParameters}}}</li>
{{/annotations}}
</ul></dd>
{{/hasAnnotations}}
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/html/mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h5>{{parent.name}} {{parent.kind}}</h5>
<dt>Annotations</dt>
<dd><ul class="annotation-list mixin-relationships">
{{#annotations}}
<li>{{{.}}}</li>
<li>{{{linkedNameWithParameters}}}</li>
{{/annotations}}
</ul></dd>
{{/hasAnnotations}}
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/md/_callable_multiline.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#hasAnnotations}}
{{#annotations}}
- {{{.}}}
- {{{linkedNameWithParameters}}}
{{/annotations}}
{{/hasAnnotations}}

Expand Down
2 changes: 1 addition & 1 deletion lib/templates/md/_type_multiline.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#hasAnnotations}}
{{#annotations}}
- {{{.}}}
- {{{linkedNameWithParameters}}}
{{/annotations}}
{{/hasAnnotations}}

Expand Down
2 changes: 1 addition & 1 deletion lib/templates/md/class.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
**Annotations**

{{#annotations}}
- {{{.}}}
- {{{linkedNameWithParameters}}}
{{/annotations}}
{{/hasAnnotations}}
{{/hasModifiers}}
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/md/constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{{#constructor}}
{{#hasAnnotations}}
{{#annotations}}
- {{{.}}}
- {{{linkedNameWithParameters}}}
{{/annotations}}
{{/hasAnnotations}}

Expand Down
2 changes: 1 addition & 1 deletion lib/templates/md/enum.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
**Annotations**

{{#annotations}}
- {{{.}}}
- {{{linkedNameWithParameters}}}
{{/annotations}}
{{/hasAnnotations}}
{{/hasModifiers}}
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/md/mixin.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
**Annotations**

{{#annotations}}
- {{{.}}}
- {{{linkedNameWithParameters}}}
{{/annotations}}
{{/hasAnnotations}}
{{/hasModifiers}}
Expand Down
2 changes: 2 additions & 0 deletions test/mustachio/foo.renderers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import 'package:analyzer/file_system/file_system.dart';
import 'package:dartdoc/dartdoc.dart';
import 'package:dartdoc/src/generator/template_data.dart';
import 'package:dartdoc/src/model/annotation.dart';
import 'package:dartdoc/src/model/feature.dart';
import 'package:dartdoc/src/model/extension_target.dart';
import 'package:dartdoc/src/model/feature_set.dart';
import 'package:dartdoc/src/model/language_feature.dart';
Expand Down
2 changes: 2 additions & 0 deletions tool/mustachio/codegen_runtime_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class RuntimeRenderersBuilder {
import 'package:analyzer/file_system/file_system.dart';
import 'package:dartdoc/dartdoc.dart';
import 'package:dartdoc/src/generator/template_data.dart';
import 'package:dartdoc/src/model/annotation.dart';
import 'package:dartdoc/src/model/feature.dart';
import 'package:dartdoc/src/model/extension_target.dart';
import 'package:dartdoc/src/model/feature_set.dart';
import 'package:dartdoc/src/model/language_feature.dart';
Expand Down