The idea is pretty simple, we'll just look for lines starting with Markdown heading sections, and render them in the documentation. They appear both in the sidebar, and within the generated docs themselves in between functions. This, coupled with the order preservation of the declaration in a module should make the generated docs significantly more elegant to organize and present.
158 lines
5.3 KiB
HTML
158 lines
5.3 KiB
HTML
{% extends "_layout.html" %}
|
|
|
|
{% block sidebar_content %}
|
|
{% if !types.is_empty() %}
|
|
<h2>Types</h2>
|
|
<ul>
|
|
{% for type_info in types %}
|
|
<li><a href="#{{ type_info.name }}">{{ type_info.name }}</a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
{% if !constants.is_empty() %}
|
|
<h2>Constants</h2>
|
|
<ul>
|
|
{% for constant in constants %}
|
|
<li><a href="#{{ constant.name }}">{{ constant.name }}</a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
{% if !functions.is_empty() %}
|
|
<h2>Functions</h2>
|
|
<ul>
|
|
{% for function_or_section in functions %}
|
|
{% match function_or_section %}
|
|
{% when Interspersed::Function with (function) %}
|
|
<li><a href="#{{ function.name }}">{{ function.name }}</a></li>
|
|
|
|
{% when Interspersed::Section with (section) %}
|
|
<li data-heading="{{ section.heading }}"><a href="#{{ section.title|urlencode }}">{{ section.title }}</a></li>
|
|
{% endmatch %}
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<h1 id="module-name" class="module-name">
|
|
<a href="#module-name">{{ module_name }}</a>
|
|
</h1>
|
|
{{ documentation|safe }}
|
|
|
|
{% if !types.is_empty() %}
|
|
<section class="module-members">
|
|
<h1 id="module-types" class="module-member-kind">
|
|
<a href="#module-types">Types</a>
|
|
</h1>
|
|
|
|
{% for type_info in types %}
|
|
<div class="member">
|
|
<div class="member-name">
|
|
<h2 id="{{ type_info.name }}">
|
|
<a href="#{{ type_info.name }}">
|
|
{{ type_info.name }}{% if !type_info.parameters.is_empty() %}<{{ type_info.parameters.join(", ") }}>{% endif %}
|
|
</a>
|
|
</h2>
|
|
{% if !type_info.source_url.is_empty() %}
|
|
<!-- TODO: support source linking
|
|
<a class="member-source" alt="View Source" title="View Source" href="{{ type_info.source_url|safe }}">
|
|
</>
|
|
</a>
|
|
-->
|
|
{% endif %}
|
|
</div>
|
|
<div class="custom-type-constructors">
|
|
<div class="rendered-markdown">{{ type_info.documentation|safe }}</div>
|
|
{% if !type_info.constructors.is_empty() %}
|
|
<h3>Constructors</h3>
|
|
<ul class="constructor-list">
|
|
{% for constructor in type_info.constructors %}
|
|
<li class="constructor-item">
|
|
<div class="constructor-row">
|
|
<svg class="icon icon-box"><use xlink:href="#icon-box"></use></svg>
|
|
<pre class="constructor-name"><code class="hljs aiken">{{ constructor.definition }}</code></pre>
|
|
</div>
|
|
{% if !constructor.documentation.is_empty() %}
|
|
<div class="constructor-item-docs">
|
|
{{ constructor.documentation|safe }}
|
|
</div>
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% else if !type_info.opaque %}
|
|
<h3>Alias</h3>
|
|
<div class="constructor-row">
|
|
<svg class="icon icon-at"><use xlink:href="#icon-at"></use></svg>
|
|
<pre class="constructor-name"><code class="hljs aiken">{{ type_info.definition }}</code></pre>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</section>
|
|
{% endif %}
|
|
|
|
{% if !constants.is_empty() %}
|
|
<section class="module-members">
|
|
<h1 id="module-constants" class="module-member-kind">
|
|
<a href="#module-constants">Constants</a>
|
|
</h1>
|
|
|
|
{% for constant in constants %}
|
|
<div class="member">
|
|
<div class="member-name">
|
|
<h2 id="{{ constant.name }}"><pre class="hljs language-aiken">{{ constant.definition }}</pre></h2>
|
|
{% if !constant.source_url.is_empty() %}
|
|
<!-- TODO: support source linking
|
|
<a class="member-source" alt="View Source" title="View Source" href="{{ constant.source_url|safe }}">
|
|
</>
|
|
</a>
|
|
-->
|
|
{% endif %}
|
|
</div>
|
|
<div class="rendered-markdown">{{ constant.documentation|safe }}</div>
|
|
</div>
|
|
{% endfor %}
|
|
</section>
|
|
{% endif %}
|
|
|
|
{% if !functions.is_empty() %}
|
|
<section class="module-members">
|
|
<h1 id="module-functions" class="module-member-kind">
|
|
<a href="#module-functions">Functions</a>
|
|
</h1>
|
|
{% for function_or_section in functions %}
|
|
{% match function_or_section %}
|
|
{% when Interspersed::Function with (function) %}
|
|
<div class="member">
|
|
<div class="member-name">
|
|
<h2 id="{{ function.name }}"><pre class="hljs language-aiken">{{ function.signature }}</pre></h2>
|
|
{% if !function.source_url.is_empty() %}
|
|
<!-- TODO: support source linking
|
|
<a class="member-source" alt="View Source" title="View Source" href="{{ function.source_url|safe }}">
|
|
</>
|
|
</a>
|
|
-->
|
|
{% endif %}
|
|
</div>
|
|
<div class="rendered-markdown">{{ function.documentation|safe }}</div>
|
|
</div>
|
|
{% when Interspersed::Section with (section) %}
|
|
{% if section.heading == 1 %}
|
|
<h2 id="{{ section.title|urlencode }}" class="module-heading"><a href="#{{ section.title|urlencode }}">{{ section.title }}</a></h2>
|
|
{% else if section.heading == 2 %}
|
|
<h2 id="{{ section.title|urlencode }}" class="module-heading"><a href="#{{ section.title|urlencode }}">{{ section.title }}</a></h3>
|
|
{% else if section.heading == 3 %}
|
|
<h3 id="{{ section.title|urlencode }}" class="module-heading"><a href="#{{ section.title|urlencode }}">{{ section.title }}</a></h4>
|
|
{% else %}
|
|
<h4 id="{{ section.title|urlencode }}" class="module-heading"><a href="#{{ section.title|urlencode }}">{{ section.title }}</a></h5>
|
|
{% endif %}
|
|
{% endmatch %}
|
|
{% endfor %}
|
|
</section>
|
|
{% endif %}
|
|
{% endblock %}
|