<!DOCTYPE html>
<html lang="en">
<head>
  <%= HeadTemplate.new(type, canonical_base_url) %>
  <meta id="repository-name" content="<%= type.repository_name %>">
  <title><%= type.full_name %> - <%= type.repository_name %></title>
</head>
<body>

<%= SidebarTemplate.new(type.repository_name, types, type) %>

<div class="main-content">
<h1 class="type-name">
<% if type.program? %>
  <%= type.full_name %>
<% else %>
  <span class="kind"><%= type.abstract? ? "abstract " : ""%><%= type.kind %></span> <%= type.full_name %>
<% end %>
</h1>

<% if type.superclass %>
  <%= type.superclass_hierarchy %>
<% end %>


<% if doc = type.formatted_doc %>
  <h2>Overview</h2>

  <%= doc %>
<% end %>

<% if type.alias? %>
  <h2>Alias Definition</h2>
  <code><%= type.formatted_alias_definition %></code>
<% 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) %>

<% if locations = type.locations %>
  <h2>Defined in:</h2>
  <% locations.each do |location| %>
    <% if url = location.url %>
      <a href="<%= url %>#L<%= location.line_number %>" target="_blank">
        <%= location.filename %><% if location.show_line_number %>:<%= location.line_number %><% end %>
      </a>
    <% else %>
      <%= location.filename %><% if location.show_line_number %>:<%= location.line_number %><% end %>
    <% end %>
    <br/>
  <% end %>
<% end %>

<% unless type.constants.empty? %>
  <% if type.enum? %>
    <h2>Enum Members</h2>
  <% else %>
    <h2>Constant Summary</h2>
  <% end %>
  <dl>
    <% type.constants.each do |const| %>
      <dt class="entry-const" id="<%= const.id %>">
        <strong><%= const.name %></strong> = <code><%= const.formatted_value %></code>
      </dt>
      <% if doc = const.formatted_doc %>
      <dd class="entry-const-doc">
        <%= doc %>
      </dd>
      <% end %>
    <% end %>
  </dl>
<% end %>

<%= MethodSummaryTemplate.new("Constructors", type.constructors) %>
<%= MethodSummaryTemplate.new(type.program? ? "Method Summary" : "Class Method Summary", type.class_methods) %>
<%= MethodSummaryTemplate.new("Instance Method Summary", type.instance_methods) %>
<%= MethodSummaryTemplate.new("Macro Summary", type.macros) %>

<div class="methods-inherited">
  <% type.ancestors.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") %>
  <% end %>
</div>

<%= MethodDetailTemplate.new("Constructor Detail", type.constructors) %>
<%= MethodDetailTemplate.new(type.program? ? "Method Detail" : "Class Method Detail", type.class_methods) %>
<%= MethodDetailTemplate.new("Instance Method Detail", type.instance_methods) %>
<%= MethodDetailTemplate.new("Macro Detail", type.macros) %>
</div>

</body>
</html>
