153 lines
3.9 KiB
Plaintext
153 lines
3.9 KiB
Plaintext
|
|
<header class="module">
|
|
<h1>{{mod.name}}</h1>
|
|
<h2>{* ldoc.markup(mod.summary) *}</h2>
|
|
</header>
|
|
|
|
<p>{* ldoc.markup(mod.description) *}</p>
|
|
|
|
{%
|
|
local kinds = {}
|
|
local kindsIpairs = {}
|
|
for kind, items in mod.kinds() do
|
|
local name = kind
|
|
if kind == "Tables" then
|
|
name = "Fields"
|
|
end
|
|
|
|
for item in items() do
|
|
if kinds[name] == nil then
|
|
kinds[name] = {}
|
|
|
|
local value = {}
|
|
value.kind = name
|
|
value.items = kinds[name]
|
|
table.insert(kindsIpairs, value)
|
|
end
|
|
kinds[name][item] = true
|
|
end
|
|
end
|
|
|
|
|
|
%}
|
|
|
|
{% for i, value in ipairs(kindsIpairs) do
|
|
local kind = value.kind
|
|
local items = value.items
|
|
%}
|
|
<h1 class="title">{{kind}}</h1>
|
|
|
|
{% for item, _ in pairs(items) do %}
|
|
<section class="method" id="{{item.name}}">
|
|
<header>
|
|
{* ldoc.item_header(item) *}
|
|
|
|
{% if item.tags.deprecated then %}
|
|
<div class="notice warning">
|
|
<div class="title">Deprecated</div>
|
|
<p>This API is deprecated and shouldn't be used anymore.</p>
|
|
</div>
|
|
{% end %}
|
|
|
|
{% if (item.tags.internal) then %}
|
|
<div class="notice error">
|
|
<div class="title">Internal</div>
|
|
<p>This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.</p>
|
|
</div>
|
|
{% end %}
|
|
|
|
{% if (ldoc.descript(item):len() == 0) then %}
|
|
<div class="notice warning">
|
|
<div class="title">Incomplete</div>
|
|
<p>Documentation for this section is incomplete and needs expanding.</p>
|
|
</div>
|
|
{% else %}
|
|
<p>{* ldoc.markup(ldoc.descript(item)) *}</p>
|
|
{% end %}
|
|
</header>
|
|
|
|
{# function arguments #}
|
|
{% if (item.params and #item.params > 0) then %}
|
|
{% local subnames = mod.kinds:type_of(item).subnames %}
|
|
|
|
{% if (subnames) then %}
|
|
<h3>{{subnames}}</h3>
|
|
{% end %}
|
|
|
|
{% for argument in ldoc.modules.iter(item.params) do %}
|
|
{% local argument, sublist = item:subparam(argument) %}
|
|
|
|
<ul>
|
|
{% for argumentName in ldoc.modules.iter(argument) do %}
|
|
{% local displayName = item:display_name_of(argumentName) %}
|
|
{% local type = ldoc.typename(item:type_of_param(argumentName)) %}
|
|
{% local default = item:default_of_param(argumentName) %}
|
|
|
|
<li>
|
|
<span class="tag parameter">{{displayName}}</span>
|
|
|
|
{% if (type ~= "") then %}
|
|
<span class="tag">{* type *}</span>
|
|
{% end %}
|
|
|
|
{% if (default and default ~= true) then %}
|
|
<span class="tag default">default: {{default}}</span>
|
|
{% elseif (default) then %}
|
|
<span class="tag default">optional</span>
|
|
{% end %}
|
|
|
|
<p>{* ldoc.markup(item.params.map[argumentName]) *}</p>
|
|
</li>
|
|
{% end %}
|
|
</ul>
|
|
{% end %}
|
|
{% end %}
|
|
|
|
{# function returns #}
|
|
{% if ((not ldoc.no_return_or_parms) and item.retgroups) then %}
|
|
{% local groups = item.retgroups %}
|
|
|
|
<h3>Returns</h3>
|
|
<ul>
|
|
{% for i, group in ldoc.ipairs(groups) do %}
|
|
{% for returnValue in group:iter() do %}
|
|
{% local type, ctypes = item:return_type(returnValue) %}
|
|
{% type = ldoc.typename(type) %}
|
|
|
|
<li>
|
|
{% if (type ~= "") then %}
|
|
{* type *}
|
|
{% else -- we'll assume that it will return a variable type if none is set %}
|
|
<span class="tag type">any</span>
|
|
{% end %}
|
|
|
|
<p>{* ldoc.markup(returnValue.text) *}</p>
|
|
</li>
|
|
{% end %}
|
|
|
|
{% if (i ~= #groups) then %}
|
|
<div class="or"><span>OR</span></div>
|
|
{% end %}
|
|
{% end %}
|
|
</ul>
|
|
{% end %}
|
|
|
|
{% if (item.usage) then -- function usage %}
|
|
<h3>Example Usage</h3>
|
|
{% for usage in ldoc.modules.iter(item.usage) do %}
|
|
<pre><code>{* usage *}</code></pre>
|
|
{% end %}
|
|
{% end %}
|
|
|
|
{% if (item.see) then %}
|
|
<h3>See Also</h3>
|
|
<ul>
|
|
{% for see in ldoc.modules.iter(item.see) do %}
|
|
<li><a href="{* ldoc.href(see) *}">{{see.label}}</a></li>
|
|
{% end %}
|
|
</ul>
|
|
{% end %}
|
|
</section>
|
|
{% end %}
|
|
{% end %}
|