diff --git a/src/compiler/crystal/tools/doc/html/type.html b/src/compiler/crystal/tools/doc/html/type.html index 10c7e51fedd3..e9918c6fe429 100644 --- a/src/compiler/crystal/tools/doc/html/type.html +++ b/src/compiler/crystal/tools/doc/html/type.html @@ -45,10 +45,10 @@

<%= type.formatted_alias_definition %> <% end %> -<%= OtherTypesTemplate.new("Included Modules", type, type.included_modules) %> -<%= OtherTypesTemplate.new("Extended Modules", type, type.extended_modules) %> -<%= OtherTypesTemplate.new("Direct Known Subclasses", type, type.subclasses) %> -<%= OtherTypesTemplate.new("Direct including types", type, type.including_types) %> +<%= OtherTypesTemplate.new("Included Modules", type, included_modules_with_docs) %> +<%= OtherTypesTemplate.new("Extended Modules", type, extended_modules_with_docs) %> +<%= OtherTypesTemplate.new("Direct Known Subclasses", type, subclasses_with_docs) %> +<%= OtherTypesTemplate.new("Direct including types", type, including_types_with_docs) %> <% if locations = type.locations %>

@@ -99,7 +99,7 @@

<%= MethodSummaryTemplate.new("Instance Method Summary", type.instance_methods) %>
- <% type.ancestors.each do |ancestor| %> + <% ancestors_with_docs.each do |ancestor| %> <%= MethodsInheritedTemplate.new(type, ancestor, ancestor.instance_methods, "Instance") %> <%= MethodsInheritedTemplate.new(type, ancestor, ancestor.constructors, "Constructor") %> <%= MethodsInheritedTemplate.new(type, ancestor, ancestor.class_methods, "Class") %> diff --git a/src/compiler/crystal/tools/doc/templates.cr b/src/compiler/crystal/tools/doc/templates.cr index 91ad32e1d0d1..4aaf5ac9029e 100644 --- a/src/compiler/crystal/tools/doc/templates.cr +++ b/src/compiler/crystal/tools/doc/templates.cr @@ -30,6 +30,12 @@ module Crystal::Doc end record TypeTemplate, type : Type, types : Array(Type), project_info : ProjectInfo do + {% for method in %w[ancestors included_modules extended_modules subclasses including_types] %} + def {{method.id}}_with_docs + type.{{method.id}}.select!(&.in?(types)) + end + {% end %} + ECR.def_to_s "#{__DIR__}/html/type.html" end