<ul class=“body-header-list”>

<% if task.superclass %>
<%= page.render_item("subclassed from", page.link_to(task.superclass)) %>
<% end %>

<% if task.needs_configuration? %>
<li>This task does <b>NOT</b> need any configuration</li>
<% else %>
<li>This task <b>does</b> need configuration</li>
<% end %>

<% states = task.each_state.to_a

states = states.sort_by { |*v| v.map(&:to_s) } %>

<% if states.empty? %>

<li class="title">No custom states</li>

<% else %>

<li class="title">States</li>
<% states.each do |name, type| %>
  <%= page.render_item(name, type) %>
<% end %>

<% end %>

<% interface_objects =

[[:each_input_port, "Input Ports"],
 [:each_output_port, "Output Ports"],
 [:each_property, "Properties"]] %>

<% interface_objects.each do |enum_with, kind|

 objects = task.send(enum_with).to_a.sort_by(&:name) %>
<% if objects.empty? %>
   <li class="title">No <%= kind %></li>
<% else %>
   <li class="title"><%= kind %></li>
   <% objects.each do |p| %>
   <li>
   <%     if p.doc %>
       <div class="doc-above"><%= Kramdown::Document.new(p.doc).to_html %></div>
   <%     end %>
   <% flags = %w{static needs_reliable_connection}.find_all do |flag_name|
          p.respond_to?("#{flag_name}?") && p.send("#{flag_name}?")
      end
      flags = ("<i>[" + flags.join(",") + "]</i>" if !flags.empty?)
   %>
       <b><%= p.name %></b><%= flags %>: <%= page.link_to(p.type) %>
   </li>
   <% end %>
<% end %>

<% end %>

<li class="title">Operations</li>
<% task.each_operation do |op| %>
<li>
<%  if op.doc %>
    <div class="doc-above"><%= Kramdown::Document.new(op.doc).to_html %></div>
<%  end %>
<b><%= op.name %></b>(<%= op.arguments.map { |name, _, _, cxx_type| "#{cxx_type} #{name}" }.join(", ") %>)
</li>
<% end %>

</ul>