<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    {%- if description is defined %}    <meta name="description" content="{{ description }}">{% endif %}
    {%- if author is defined %}    <meta name="author" content="{{ content }}">{% endif %}

    <title>{{ title }}</title>

    <style>
        body {margin: 0; font-family: sans}
        .page {width: 50em; margin: 0 auto;}
        .sub {margin: 0 1em 0 1em;}
        code {font-size: 11pt;}
        pre { background-color: #ddd; font-size: 11pt;}
        pre > b { color: #b02c29;}
        pre > u { color: #306900; text-decoration: none;}
        pre > i { color: #003069; font-style: normal;}
        code.param { white-space: pre; font-weight: bold; margin-left: 1em;}
    </style>

  </head>
  <body>
    <div class="page">
    {% set manuals = [] %}
    
      <div class="content">
        <h1>{{ title }}</h1>

{% macro generate_doc(api) %}
      {% for type, name, args, doc in api %}
      {% set doc = wiki(doc) %}
      {% if type == 'submodule' %}
        <big class="sub"><a href="#{{ name }}">{{ name }}</a></big>
        {% set rv = manuals.append(load_module(name)) %}
        {% set rv = keywords(api) %}
      {% elif type == 'module' %}
        <h2><small>module</small> <a name="{{ name }}">{{ name }}</a></h2>
        <div>{{ doc }}</div>
      {% elif type == 'class' %}
        <h3><small>class</small> {{ name }}</h3>
        <div>{{ doc }}</div>
      {% elif type == 'property' %}
        <h4><code>{{ name }} {{ property_info(args)|e }}</code></h4>
        <div>{{ doc }}</div>
      {% elif type in ('method', 'staticmethod', 'descriptor') %}
        <h4><code>{{ name }}{{ args|e }}</code></h4>
        <div>{{ doc }}</div>
      {% elif type == 'function' and name[0] != '_' %}
        <h3><code><small>def</small> {{ name }}{{ args|e }}</code></h3>
        <div>{{ doc }}</div>
      {% endif %}
      {% endfor %}
      <h2>Variables</h2>
      {% for type, name, args, doc in api %}
      {% set doc = wiki(doc) %}
      {% if type == 'variable' %}
        <h4><code>{{ name }} = {{ args|truncate(70, end='...)')|e }}</code></h4>
      {% endif %}
      {% endfor %}
{%- endmacro %}

{% if api is not defined %}
    {% set api = (('module', 'api variable is not defined', None, ''),) %}
{% endif %}
{{ keywords(api) }}
{{ generate_doc(api) }}
{% for n in range(100) %} {% if length(manuals) > 0 %}
  {{ generate_doc(manuals.pop()) }}
{% endif %}{% endfor %}

      </div>
    
      <hr>
      <small>Generate by <a href="http://poorhttp.zeropage.cz/jinjadoc24.html">Jinja24doc</a>.</small>
    </div><!-- /page -->
  </body>
</html>
