Skip to content

Commit

Permalink
Tweak templates (#3853)
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins authored Aug 28, 2024
1 parent 218e8c1 commit 66366cd
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 32 deletions.
7 changes: 4 additions & 3 deletions lib/src/generator/templates.aot_renderers_for_html.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,8 @@ String renderProperty(PropertyTemplateData context0) {
buffer.write('''</h1></div>''');
buffer.writeln();
var context2 = context0.self;
if (context2.hasNoGetterSetter) {
buffer.write('\n ');
if (!context2.hasGetterOrSetter) {
buffer.writeln();
buffer.write('''
<section class="multi-line-signature">
Expand All @@ -1584,7 +1585,7 @@ String renderProperty(PropertyTemplateData context0) {
buffer.write('\n ');
buffer.write(_renderProperty_partial_source_code_7(context2));
}
buffer.writeln();
buffer.write('\n\n ');
if (context2.hasGetterOrSetter) {
if (context2.hasGetter) {
buffer.write('\n ');
Expand Down Expand Up @@ -2102,7 +2103,7 @@ String renderTopLevelProperty(TopLevelPropertyTemplateData context0) {
buffer.write(_renderTopLevelProperty_partial_categorization_3(context1));
buffer.write('''</h1></div>
''');
if (context1.hasNoGetterSetter) {
if (!context1.hasGetterOrSetter) {
buffer.writeln();
buffer.write('''
<section class="multi-line-signature">
Expand Down
8 changes: 0 additions & 8 deletions lib/src/generator/templates.runtime_renderers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6484,13 +6484,6 @@ class _Renderer_GetterSetterCombo extends RendererBase<GetterSetterCombo> {
self.renderSimpleVariable(c, remainingNames, 'bool'),
getBool: (CT_ c) => c.hasGetterOrSetter,
),
'hasNoGetterSetter': Property(
getValue: (CT_ c) => c.hasNoGetterSetter,
renderVariable: (CT_ c, Property<CT_> self,
List<String> remainingNames) =>
self.renderSimpleVariable(c, remainingNames, 'bool'),
getBool: (CT_ c) => c.hasNoGetterSetter,
),
'hasParameters': Property(
getValue: (CT_ c) => c.hasParameters,
renderVariable: (CT_ c, Property<CT_> self,
Expand Down Expand Up @@ -16010,7 +16003,6 @@ const _invisibleGetters = {
'hasExplicitSetter',
'hasGetter',
'hasGetterOrSetter',
'hasNoGetterSetter',
'hasParameters',
'hasPublicGetter',
'hasPublicGetterNoSetter',
Expand Down
2 changes: 0 additions & 2 deletions lib/src/model/getter_setter_combo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,6 @@ mixin GetterSetterCombo on ModelElement {

bool get hasGetter => getter != null;

bool get hasNoGetterSetter => !hasGetterOrSetter;

bool get hasGetterOrSetter => hasExplicitGetter || hasExplicitSetter;

bool get hasSetter => setter != null;
Expand Down
8 changes: 6 additions & 2 deletions lib/templates/property.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
{{ /self }}

{{ #self }}
{{ #hasNoGetterSetter }}
{{!-- If the property has neither an explicit getter nor an explicit setter,
display the "shared" documentation for the combined property. --}}
{{ ^hasGetterOrSetter }}
<section class="multi-line-signature">
{{ >annotations }}
{{{ modelType.linkedName }}}
Expand All @@ -19,8 +21,10 @@
</section>
{{ >documentation }}
{{ >source_code }}
{{ /hasNoGetterSetter }}
{{ /hasGetterOrSetter }}

{{!-- Otherwise, the property has an explicit getter or an explicit setter,
or both; display separate docs. --}}
{{ #hasGetterOrSetter }}
{{ #hasGetter }}
{{ >accessor_getter }}
Expand Down
34 changes: 17 additions & 17 deletions lib/templates/top_level_property.html
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
{{>head}}
{{ >head }}

<div
id="dartdoc-main-content"
class="main-content"
data-above-sidebar="{{ aboveSidebarPath }}"
data-below-sidebar="{{ belowSidebarPath }}">
{{#self}}
<div>{{>source_link}}<h1><span class="kind-top-level-property">{{{name}}}</span> {{kind}} {{>feature_set}} {{>categorization}}</h1></div>
{{ #self }}
<div>{{ >source_link }}<h1><span class="kind-top-level-property">{{{ name }}}</span> {{ kind }} {{ >feature_set }} {{ >categorization }}</h1></div>

{{#hasNoGetterSetter}}
{{ ^hasGetterOrSetter }}
<section class="multi-line-signature">
{{ >annotations }}
{{{ modelType.linkedName }}}
{{ >name_summary }}
{{ >attributes }}
</section>
{{>documentation}}
{{>source_code}}
{{/hasNoGetterSetter}}
{{ >documentation }}
{{ >source_code }}
{{ /hasGetterOrSetter }}

{{#hasExplicitGetter}}
{{>accessor_getter}}
{{/hasExplicitGetter}}
{{ #hasExplicitGetter }}
{{ >accessor_getter }}
{{ /hasExplicitGetter }}

{{#hasExplicitSetter}}
{{>accessor_setter}}
{{/hasExplicitSetter}}
{{/self}}
{{ #hasExplicitSetter }}
{{ >accessor_setter }}
{{ /hasExplicitSetter }}
{{ /self }}
</div> <!-- /.main-content -->

<div id="dartdoc-sidebar-left" class="sidebar sidebar-offcanvas-left">
{{>search_sidebar}}
<h5>{{parent.name}} {{parent.kind}}</h5>
{{ >search_sidebar }}
<h5>{{ parent.name }} {{ parent.kind }}</h5>
<div id="dartdoc-sidebar-left-content"></div>
</div><!--/.sidebar-offcanvas-left-->

<div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
</div><!--/.sidebar-offcanvas-->

{{>footer}}
{{ >footer }}

0 comments on commit 66366cd

Please sign in to comment.