summaryrefslogtreecommitdiff
path: root/lib/rdoc/generator/template/darkfish/class.rhtml
blob: c7e52e68084fafd483f2ac1a84e6018dba235a74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<body id="top" class="<%= klass.type %>">
<nav id="metadata">
  <%= render '_sidebar_navigation.rhtml' %>

  <%= render '_sidebar_search.rhtml' %>

  <%= render '_sidebar_table_of_contents.rhtml' %>

  <div id="file-metadata">
    <%= render '_sidebar_in_files.rhtml' %>
    <%= render '_sidebar_VCS_info.rhtml' %>
  </div>

  <div id="class-metadata">
    <%= render '_sidebar_sections.rhtml' %>
    <%= render '_sidebar_parent.rhtml' %>
    <%= render '_sidebar_includes.rhtml' %>
    <%= render '_sidebar_extends.rhtml' %>
    <%= render '_sidebar_methods.rhtml' %>
  </div>

  <div id="project-metadata">
    <%= render '_sidebar_pages.rhtml' %>
    <%= render '_sidebar_classes.rhtml' %>
  </div>
</nav>

<div id="documentation">
  <h1 class="<%= klass.type %>"><%= klass.type %> <%= klass.full_name %></h1>

  <div id="description" class="description">
    <%= klass.description %>
  </div><!-- description -->

  <% klass.each_section do |section, constants, attributes| %>
  <% constants = constants.select { |const| const.display? } %>
  <% attributes = attributes.select { |attr| attr.display? } %>
  <section id="<%= section.aref %>" class="documentation-section">
    <% if section.title then %>
    <div class="documentation-section-title">
      <h2 class="section-header">
        <%= section.title %>
      </h2>
      <span class="section-click-top">
        <a href="#top">&uarr; top</a>
      </span>
    </div>
    <% end %>

    <% if section.comment then %>
    <div class="description">
      <%= section.description %>
    </div>
    <% end %>

    <% unless constants.empty? then %>
    <!-- Constants -->
    <section id="constants-list" class="section">
      <h3 class="section-header">Constants</h3>
      <dl>
      <% constants.each do |const| %>
        <dt id="<%= const.name %>"><%= const.name %>
        <% if const.comment then %>
        <dd class="description"><%= const.description.strip %>
        <% else %>
        <dd class="description missing-docs">(Not documented)
        <% end %>
      <% end %>
      </dl>
    </section>
    <% end %>

    <% unless attributes.empty? then %>
    <!-- Attributes -->
    <section id="attribute-method-details" class="method-section section">
      <h3 class="section-header">Attributes</h3>

      <% attributes.each do |attrib| %>
      <div id="<%= attrib.aref %>" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name"><%= h attrib.name %></span><span
            class="attribute-access-type">[<%= attrib.rw %>]</span>
        </div>

        <div class="method-description">
        <% if attrib.comment then %>
        <%= attrib.description.strip %>
        <% else %>
        <p class="missing-docs">(Not documented)
        <% end %>
        </div>
      </div>
      <% end %>
    </section><!-- attribute-method-details -->
    <% end %>

    <!-- Methods -->
    <% klass.methods_by_type(section).each do |type, visibilities|
       next if visibilities.empty?
       visibilities.each do |visibility, methods|
         next if methods.empty? %>
     <section id="<%= visibility %>-<%= type %>-<%= section.aref %>-method-details" class="method-section section">
      <h3 class="section-header"><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>

    <% methods.each do |method| %>
      <div id="<%= method.aref %>" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
        <% if method.call_seq then %>
        <%   method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
        <div class="method-heading">
          <span class="method-callseq">
            <%= h(call_seq.strip.
                  gsub( /^\w+\./m, '')).
                  gsub(/(.*)[-=]&gt;/, '\1&rarr;') %>
          </span>
          <% if i == 0 and method.token_stream then %>
          <span class="method-click-advice">click to toggle source</span>
          <% end %>
        </div>
        <%   end %>
        <% else %>
        <div class="method-heading">
          <span class="method-name"><%= h method.name %></span><span
            class="method-args"><%= method.param_seq %></span>
          <% if method.token_stream then %>
          <span class="method-click-advice">click to toggle source</span>
          <% end %>
        </div>
        <% end %>

        <div class="method-description">
          <% if method.comment then %>
          <%= method.description.strip %>
          <% else %>
          <p class="missing-docs">(Not documented)
          <% end %>
          <% if method.calls_super then %>
            <div class="method-calls-super">
              Calls superclass method
              <%=
                  method.superclass_method ?
                  method.formatter.link(method.superclass_method.full_name, method.superclass_method.full_name) : nil
              %>
            </div>
          <% end %>

          <% if method.token_stream then %>
          <div class="method-source-code" id="<%= method.html_name %>-source">
            <pre><%= method.markup_code %></pre>
          </div><!-- <%= method.html_name %>-source -->
          <% end %>
        </div>

        <% unless method.aliases.empty? then %>
        <div class="aliases">
          Also aliased as: <%= method.aliases.map do |aka|
            if aka.parent then # HACK lib/rexml/encodings
              %{<a href="#{klass.aref_to aka.path}">#{h aka.name}</a>}
            else
              h aka.name
            end
          end.join ", " %>
        </div>
        <% end %>

        <% if method.is_alias_for then %>
        <div class="aliases">
          Alias for: <a href="<%= klass.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
        </div>
        <% end %>
      </div><!-- <%= method.html_name %>-method -->

    <% end %>
    </section><!-- <%= visibility %>-<%= type %>-method-details -->
  <% end
     end %>
  </section><!-- <%= section.aref %> -->
<% end %>

</div><!-- documentation -->