<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>API Documentation</title>
    <link href="shared/css/documentation.css" media="screen" rel="stylesheet" type="text/css"> 
    <link href="shared/css/pygments.css" media="screen" rel="stylesheet" type="text/css"> 
    <link href="css/style.css" media="screen" rel="stylesheet" type="text/css"> 
    <script src="shared/js/jquery.js" type="text/javascript"></script> 
    <script src="shared/js/documentation.js" type="text/javascript"></script> 
    <script src="js/json2.js" type="text/javascript"></script> 
    <script src="js/underscore.js" type="text/javascript"></script> 
    <script src="js/backbone.js" type="text/javascript"></script> 
    <script src="js/docurium.js" type="text/javascript"></script> 

    <!-- Changelog -->
    <script type="text/template" id="changelog-item-template">
      <p>
	<ul>
	  <% _.each(dels, function(elem) { %>
	  <li class="deletes"><%= elem %></li>
	  <% }) %>
	</ul>
      </p>
      <p>
	<ul>
	  <% _.each(adds, function(elem) { %>
	  <li class="adds"><a href="#<%= elem.link %>"><%= elem.text %></a></li>
	  <% }) %>
	</ul>
      </p>
    </script>

    <script type="text/template" id="changelog-template">
      <h1>Function Changelog</h1>
      <% _.each(versions, function(version) { %>
      <h3><%= version.title %></h3>
      <div class="changelog">
	<%= version.listing %>
      </div>
      <% }) %>
    </script>

    <!-- Version picker -->
    <script type="text/template" id="version-picker-template">
      <% _.each(versions, function(version) { %>
      <li><a href="#<%= version %>"><%= version %></a></li>
      <% }) %>
      <li><a href="#p/changelog">Changelog</a></li>
    </script>

  </head>

  <body class="documentation">

    <!-- Sidebar where the groups and types appear -->
    <script type="text/template" id="type-list-template">
      <li>
	<li><span class="divide"><%= title %></span></li>
	<% _.each(elements, function(e) { %>
	<li>
	  <a href="#<%= e.link %>" ref="<%= e.ref %>" class="type", id="typeItem<%= e.name %>">
	  <%= e.name %>
	  </a>
	</li>
	<% }) %>
      </li>
    </script>
    <script type="text/template" id="file-list-template">
     <li>
       <h3><a href="#">Functions</a></h3>
       <ul>
	 <% _.each(funs, function(fun, i) { %>
	 <li>
	   <a href="#<%= fun.link %>" ref="<%= i %>" class="group" id="groupItem<%= fun.name %>">
	   <%= fun.name %>&nbsp;<small>(<%= fun.num %>)</small>
	   </a>
	 </li>
	 <% }) %>
       </ul>
     </li>
     <li>
       <h3><a href="#">Types</a></h3>
       <ul class="hidden" id="types-list" />
     </li>
     <li>
       <h3><a href="#">Files</a></h3>
       <ul class="hidden">
	 <% _.each(files, function(file) { %>
	 <li>
	   <a target="github" href="<%= file.url %>"><%= file.name %></a>
	 </li>
	 <% }) %>
       </ul>
     </li>
     <li>
       <h3><a href="#">Examples</a></h3>
       <ul>
	 <% _.each(examples, function(example) { %>
	 <li>
	   <a href="<%= example.path %>"><%= example.name %></a>
	 </li>
	 <% }) %>
       </ul>
     </li>
    </script>

    <!-- Listing of the details of a single function -->
    <script type="text/template" id="function-args-template">
      <table class="funcTable">
	<% _.each(args, function(arg) { %>
	<tr>
	  <td valign="top" nowrap="true"><%= arg.link %></td>
	  <td valign="top" class="var"><%= arg.name %></td>
	  <td class="comment"><%= arg.comment %></td>
	</tr>
	<% }) %>
      </table>
    </script>
    <script type="text/template" id="function-template">
     <h1 class="funcTitle"><%= name %></h1>
     <h3 class="funcDesc"><%= data.description %></h3>
     <!-- The args table -->
     <%= argsTemplate({args: args}) %>
     <div class="returns">
       <h3>returns</h3>
       <table class="funcTable">
	 <tr>
	   <td valign="top"><%= returns.link %></td>
	   <td class="comment"><%= returns.comment %></td>
	 </tr>
       </table>
     </div>
     <div><%= data.comments %></div>
     <!-- function signature -->
     <div class="example">
       <h3>signature</h3>
       <code class="params"><%= sig %></code>
     </div>
     <!-- function history -->
     <div class="signatures">
       <h3>versions</h3>
       <ul>
	 <% _.each(sigs, function(sig) { %>
	 <li><a href="<%= sig.url %>" class="<%= sig.klass %>"><%= sig.name %></a></li>
	 <% }) %>
       </ul>
     </div>
     <div class="fileLink">Defined in: <a href="<%= fileLink %>"> <%= data.file %></a></div>
     <% if (data.examples) { %>
     <div class="funcEx">Used in examples:
     <ul>
     <% _.each(data.examples, function(uses, filename) { %>
     <li>
       <strong><%= filename %></strong>
       <% _.each(uses, function(use, i) { %>
       <a href="<%= use %>">[<%= i + 1 %>]</a>
       <% }) %> <!-- loop over the uses -->
     </li>
     <% }) %> <!-- loop over the files -->
     </ul>
     </div>
     <% } %> <!-- if we have examples -->
     <div class="also">
       Also in <a href="<%= alsoGroup %>"><%= groupName %></a> group: <br/>
       <% _.each(_.initial(alsoLinks), function(link) { %>
       <a href="<%= link.url %>"><%= link.name %></a>, 
       <% }) %>
       <% var link = _.last(alsoLinks) %>
       <a href="<%= link.url %>"><%= link.name %></a>
     </div>
    </script>

    <!-- main page, list of groups and their functions -->
    <script type="text/template" id="index-template">
      <h1>Public API Functions</h1>
      <% _.each(groups, function(group) { %>
      <h2 class="funcGroup"><%= group.name %></h2>
      <p class="functionList">
	<% _.each(_.initial(group.funs), function(fun) { %>
	<a href="<%= fun.url %>" class="<%= fun.klass %>"><%= fun.name %></a>
	<% }) %> <!-- loop through all but the last function -->
	<% var fun = _.last(group.funs) %>
	<a href="<%= fun.url %>" class="<%= fun.klass %>"><%= fun.name %></a>
      </p>
      <% }) %> <!-- loop through the groups -->
    </script>

    <script type="text/template" id="uses-template">
      <% if (returns.length > 0) { %>
      <h3>Returns</h3>
      <% _.each(_.initial(returns), function(fun) { %>
      <a href="<%= fun.url %>"><%= fun.name %></a>
      <% }) %> <!-- loop over each 'return' -->
      <% var fun = _.last(returns) %>
      <a href="<%= fun.url %>"><%= fun.name %></a>
      <% } %> <!-- if we have 'returns' -->

      <% if (needs.length > 0) { %>
      <h3>Argument In</h3>
      <% _.each(_.initial(needs), function(fun) { %>
      <a href="<%= fun.url %>"><%= fun.name %></a>
      <% }) %> <!-- loop over each 'need' -->
      <% var fun = _.last(needs) %>
      <a href="<%= fun.url %>"><%= fun.name %></a>
      <% } %> <!-- if we have 'needs' -->

      <div class="fileLink">
	Defined in:
	<a href="<%= fileLink.url %>"><%= fileLink.name %></a>
      </div>
    </script>

    <!-- listing for an enum -->
    <script type="text/template" id="enum-template">
      <h1 class="funcTitle"><%= type.tname %><small><%= type.type %></small></h1>
      <p><%= type.value %></p>

      <% if (type.data.description) { %>
      <p><%= type.data.description %></p>
      <% } %>
      <% if (type.data.comments) { %>
      <p><%= type.data.comments %></p>
      <% } %>

      <table>
	<% _.each(type.data.fields, function(field) { %>
	<tr>
	  <td><code><%= field.name %></code></td>
	<tr>
	  <% if (field.comments) { %>
	  <tr>
	    <td class="type-comment"><%= field.comments %></td>
	  </tr>
	  <% } %>
	<% }) %>
      </table>
      <%= uses %>
    </script>
    <!-- listing for a struct -->
    <script type="text/template" id="struct-template">
      <h1 class="funcTitle"><%= type.tname %><small><%= type.type %></small></h1>
      <p><%= type.value %></p>

      <% if (type.data.description) { %>
      <p><%= type.data.description %></p>
      <% } %>
      <% if (type.data.comments) { %>
      <p><%= type.data.comments %></p>
      <% } %>

      <table>
	<% _.each(type.data.fields, function(field) { %>
	<tr>
	  <td><code><%= field.type %></code></td>
	  <td><code><%= field.name %></code></td>
	<tr>
	  <% if (field.comments) { %>
	  <tr>
	    <td colspan="2" class="type-comment"><%= field.comments %></td>
	  </tr>
	  <% } %>
	<% }) %>
      </table>

      <%= uses %>
    </script>

    <script type="text/template" id="group-template">
      <h1><%= gname %> functions</h1>
      <!-- table with all the functions -->
      <table class="methods">
	<% _.each(functions, function(fun) { %>
	<tr>
	  <td valign="top" nowrap="true">
	    <%= fun.returns %>
	  </td>
	  <td valign="top" class="methodName">
	    <a href="<%= fun.url %>"><%= fun.name %></a>
	  </td>
	  <td>
	    <% _.each(fun.args, function(arg) { %>
	    <%= arg.type %> <%= arg.name %><br/>
	    <% }) %> <!-- loop over the args of a function -->
	  </td>
	</tr>
	<% }) %> <!-- loop over the functions -->
      </table>
      <!-- list of the functions with the descriptions -->
      <% _.each(functions, function(fun) { %>
      <h2><a href="<%= fun.url %>"><%= fun.name %></a><small>(<%= fun.argline %>)</small></h2>
      <div class="description">
	<%= fun.description %>
	<%= fun.comments %>
      </div>
      <% }) %> <!-- loop over the functions -->
    </script>

    <script type="text/template" id="search-template">
      <h1>Search Results</h1>
      <table>
	<% _.each(results, function(result) { %>
	<tr>
	  <td><a href="<%= result.url %>"><%= result.name %></a></td>
	  <td><%= result.match %></td>
	</tr>
	<% }) %>
      </table>
    </script>

    <div id="not-footer">
    <div id="header-wrapper">
      <div id="header">
        <div>
          <a class="logo" href="#" id="site-title">API</a>
          <ul class="nav">
            <li><input type="text" class="search" id="search-field" name="q" autocomplete="off"></li>
          </ul>
        </div>
      </div><!-- #header -->
    </div><!-- #header-wrapper -->

    <div id="wrapper">

      <div id="content" class="content"></div>

      <div id="js-help-sidebar" class="sidebar-shell">
        <div class="sidebar-module">
          <ul class="subgroup" id="versions">
            <li>
              <h3 id="version-picker">Version: <span id="version"></span></h3>
              <ul id="version-list" class="hidden"></ul>
            </li>
          </ul>
        </div> <!-- /sidebar-module -->
        <div class="sidebar-module">
          <ul class="subgroup" id="files-list">
            <li><h3><a>Loading...</a></h3></li>
          </ul>
        </div> <!-- /sidebar-module -->
      </div><!-- /sidebar-shell -->

    </div><!-- #wrapper -->

  </div><!-- /not-footer -->
  <div id="footer-wrapper">
    <div id="footer">
      <div class="left-col">
        Powered by <a href="https://github.com/libgit2/docurium">Docurium</a><br/>
        Sponsored by GitHub<br/>
        <br/>
      </div>
      <div class="right-col"></div>
    </div><!-- #footer -->
  </div><!-- #footer-wrapper -->

  </body>
</html>