<html>
	<head>
		<title>Directory</title>
		{% include 'sharrock/style.html' %}
	</head>
	<body>
		<div class="toc">
			<h3>Table of Contents</h3>
			<ul>
				{% for app,versions in descriptors.items %}
				<li>
					<h4>{{ app }}</h4>
					<ul>
						{% for version,services in versions.items %}
						<li>
							<h4>{{ version }}</h4>
							<ul>
								{% if services.resources %}
								{% for resource in services.resources %}
								<li><a href="#{{ app|slugify }}-{{ version|slugify }}-{{ resource.name|slugify }}">{{ resource.name }} (resource)</a></li>
								{% endfor %}
								{% endif %}
								{% if services.functions %}
								{% for descriptor in services.functions %}
								<li><a href="#{{ app|slugify }}-{{ version|slugify }}-{{ descriptor.service_name|slugify }}">{{ descriptor.service_name }}</a></li>
								{% endfor %}
								{% endif %}
							</ul>
						</li>
						{% endfor %}
					</ul>
				</li>
				{% endfor %}
			</ul>
		</div>
		{% for app,versions in descriptors.items %}
		<h1>{{ app }}</h1>
		{% for version,services in versions.items %}
		<h2>Version {{ version }}</h2>
		{% if services.resources %}
		<h2>Resources</h2>
		{% for resource in services.resources %}
		<div class="resource">
			{% include 'sharrock/resource_body.html' %}
		</div>
		{% endfor %}
		{% endif %}
		{% if services.functions %}
		<h2>Functions</h2>
		{% for descriptor in services.functions %}
		<div class="descriptor">
			{% include 'sharrock/descriptor_body.html' %}
		</div>
		{% endfor %}
		{% endif %}
		{% empty %}
		<p>Sorry, this version of the API doesn't exist.</p>
		{% endfor %}
		{% endfor %}
	</body>
</html>