Updated docs

This commit is contained in:
Björn Ritzl
2019-11-12 13:31:00 +01:00
parent 056618f6ba
commit daf85dbba5
37 changed files with 135 additions and 386 deletions

112
docs/_includes/api_ref.md Normal file
View File

@@ -0,0 +1,112 @@
## Modules
{% for item in site.data.api %}
### <code>{{ item.name }}</code>
{{ item.desc }}
{% endfor %}
## Enums
<table>
<tbody>
{% for module in site.data.api %}
{% for item in module.members %}
{% if item.type contains 'number' %}
<tr>
<td><strong>{{ module.name }}.{{ item.name }}</strong></td>
<td>{{ item.desc | markdownify | replace: "[icon:attention]","<br><br>⚠️"}}</td>
</tr>
{% endif %}
{% endfor %}
{% endfor %}
</tbody>
</table>
<hr>
## Functions
<table>
<tbody>
{% for module in site.data.api %}
{% for item in module.members %}
{% if item.type contains 'function' %}
<tr>
<td><a href="#{{ item.name | url_encode }}"><strong>{{ module.name }}.{{ item.name }}()</strong></a></td>
<td>{{ item.desc | truncate: 80 }}</td>
</tr>
{% endif %}
{% endfor %}
{% endfor %}
</tbody>
</table>
{% for module in site.data.api %}
{% for function in module.members %}
{% if function.type contains 'function' %}
<div class="function-wrap">
<h3 class="function-header"><a href="#{{ function.name | url_encode }}" id="{{ function.name | url_encode }}"><code>{{ module.name }}.{{ function.name }}({% for param in function.parameters %}{{param.name}}{% unless forloop.last %}, {% endunless %}{% endfor %})</code></a></h3>
{% if function.parameters %}
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{% for param in function.parameters %}
<tr>
<td style="text-align: right;">
<strong>{{ param.name }}</strong>
{% if param.optional %}
(optional)
{% endif %}
</td>
<td><code>{{ param.type }}</code></td>
<td>{{ param.desc | markdownify }}
{% if param.type == "function" %}
{% include type-function.md params=param.parameters %}
{% endif %}
{% if param.type == "table" %}
{% include type-table.md fields=param.members %}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% if function.returns %}
<table>
<thead>
<tr>
<th>Return value</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<h4>Returns</h4>
{% for return in function.returns %}
<tr>
<td>{{ return.name }}</td>
<td><code class="inline-code-block">{{ return.type }}</code></td>
<td>{{ return.desc | markdownify }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{{ function.desc | markdownify | replace: "[icon:attention]","<br><br>⚠️" | replace: "[type:string]","<code class='inline-code-block'>string</code>" | replace: "[type:number]","<code class='inline-code-block'>number</code>" | replace: "[type:table]","<code class='inline-code-block'>table</code>" | markdownify}}
{% if function.examples %}
<h4>Examples</h4>
{% for example in function.examples %}
{{ example.desc | markdownify }}
{% endfor %}
{% endif %}
</div>
{% endif %}
{% endfor %}
{% endfor %}

View File

@@ -1,38 +0,0 @@
{% assign truncate = 10000 %}
{% if include.truncate %}
{% assign truncate = include.truncate %}
{% endif %}
{{ include.desc
| truncate: truncate
| replace: "[type:string]","<code class='inline-code-block'>string</code>"
| replace: "[type:number]","<code class='inline-code-block'>number</code>"
| replace: "[type:table]","<code class='inline-code-block'>table</code>"
| replace: "[icon:attention]","<br><br><span class='icon-attention'></span>"
| replace: "[icon:android]", "<span class='icon-android'></span>"
| replace: "[icon:gameroom]", "<span class='icon-gameroom'></span>"
| replace: "[icon:apple]", "<span class='icon-apple'></span>"
| replace: "[icon:clipboard]", "<span class='icon-clipboard'></span>"
| replace: "[icon:king]", "<span class='icon-king'></span>"
| replace: "[icon:defold]", "<span class='icon-defold'></span>"
| replace: "[icon:search]", "<span class='icon-search'></span>"
| replace: "[icon:link-ext]", "<span class='icon-link-ext'></span>"
| replace: "[icon:link]", "<span class='icon-link'></span>"
| replace: "[icon:amazon]", "<span class='icon-amazon'></span>"
| replace: "[icon:html5]", "<span class='icon-html5'></span>"
| replace: "[icon:ios]", "<span class='icon-ios'></span>"
| replace: "[icon:linux]", "<span class='icon-linux'></span>"
| replace: "[icon:windows]", "<span class='icon-windows'></span>"
| replace: "[icon:macos]", "<span class='icon-macos'></span>"
| replace: "[icon:clock]", "<span class='icon-clock'></span>"
| replace: "[icon:star]", "<span class='icon-star'></span>"
| replace: "[icon:googleplay]", "<span class='icon-googleplay'></span>"
| replace: "[icon:dropbox]", "<span class='icon-dropbox'></span>"
| replace: "[icon:twitter]", "<span class='icon-twitter'></span>"
| replace: "[icon:slack]", "<span class='icon-slack'></span>"
| replace: "[icon:instagram]", "<span class='icon-instagram'></span>"
| replace: "[icon:steam]", "<span class='icon-steam'></span>"
| replace: "[icon:github]", "<span class='icon-github'></span>"
| replace: "[icon:facebook]", "<span class='icon-facebook'></span>"
| markdownify
}}

View File

@@ -11,7 +11,7 @@
<tr>
<td><strong>{{ param.name }}</strong></td>
<td><code>{{ param.type }}</code></td>
<td>{% include description.md desc=param.desc %}
<td>{{ param.desc | markdownify }}
{% if param.type == "table" %}
{% include type-table.md fields=param.members %}

View File

@@ -5,7 +5,7 @@
{% if field.optional %}
(optional)
{% endif %}
<code>{{ field.type }}</code> - {% include description.md desc=field.desc %}
<code>{{ field.type }}</code> - {{ field.desc | markdownify }}
</li>
{% endfor %}
</ul>