<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <meta id="repository-name" content="<%= type.repository_name %>">
  <link href="<%= type.path_to "css/style.css" %>" rel="stylesheet" type="text/css" />
  <script type="text/javascript" src="<%= type.path_to "js/doc.js" %>"></script>
  <title><%= type.full_name %> - <%= type.repository_name %></title>
</head>
<body>

<div id="types-list">
  <div id="search-box">
    <input type="search" id="search-input" placeholder="Search...">
  </div>

  <ul>
    <li><a href="<%= type.path_to("index.html") %>">README</a></li>
  </ul>

  <%= ListItemsTemplate.new(types, type) %>
</div>

<div id="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 %></a>
    <% else %>
      <%= location.filename %>
    <% 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.name %>">
        <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(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.class_methods, "Class") %>
  <% end %>
</div>

<%= 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>
