{% extends '_base.html' %}


{% block title -%}
    {{ current_class.name }}:{{ current_method.name }} - Eluna
{%- endblock %}


{% block description -%}
    API documentation for the {{ current_class.name }}:{{ current_method.name }} method in the Eluna engine.
{%- endblock %}


{% block document_title -%}
    Method
    <a class="mod" href="{{ root(current_class.name + '/index.html') }}">
        {{- current_class.name -}}
    </a>:<a class="fn" href="{{ root(current_class.name + '/' + current_method.name + '.html') }}">
        {{- current_method.name -}}
    </a>
{%- endblock %}


{% block sidebar %}
    <h2>{{ current_class.name }} Methods</h2>
    <script src="sidebar.js"></script>
    <script>
      // Highlight current method by adding "current" class to it
      var element = document.getElementById("{{ current_class.name + ':' + current_method.name }}");
      if (element) {
        var classname = "current";
        arr = element.className.split(" ");
        if (arr.indexOf(classname) == -1) {
          element.className += " " + classname;
        }
      }
    </script>
{% endblock %}


{% block content %}
    <div class='docblock'>
        {%- if current_method.documented %}
        {{ current_method.description|parse_links }}
        {%- else %}
        <p>This method is <em>undocumented</em>. <strong>Use at your own risk.</strong></p>
        <p>For temporary documentation, please check the <a href="https://github.com/ElunaLuaEngine/Eluna/blob/master/LuaFunctions.cpp">LuaFunctions</a> source file.</p>
        {%- endif %}

        <h2 id="synopsis" class='section-header'>
            <a href="#synopsis">Synopsis</a>
        </h2>
        {%- for prototype in current_method.prototypes %}
        <p>
            <code>{{ prototype }}</code>
        </p>
        {%- endfor %}

        <h2 id="arguments" class='section-header'>
            <a href="#arguments">Arguments</a>
        </h2>
        <p>
            {%- if current_method.parameters|length > 0 %}
            {%- for param in current_method.parameters %}
            <dl>
                <dt><code>{{ param.data_type|escape|parse_data_type }} {{ param.name if param.data_type != '...' }} {{- ' (' + param.default_value + ')' if param.default_value }}</code></dt>
                <dd class="docblock">{{ param.description|parse_links if param.description else '<em>See method description.</em>' }}</dd>
            </dl>
            {%- endfor %}
            {%- elif not current_method.documented %}
            Unknown.
            {%- else %}
            None.
            {%- endif %}
        </p>

        <h2 id="returns" class='section-header'>
            <a href="#returns">Returns</a>
        </h2>
        <p>
            {%- if current_method.returned|length > 0 %}
            {%- for returned in current_method.returned %}
            <dl>
                <dt><code>{{ returned.data_type|escape|parse_data_type }} {{ returned.name }}</code></dt>
                <dd class="docblock">{{ returned.description|parse_links if returned.description else '<em>See method description.</em>' }}</dd>
            </dl>
            {%- endfor %}
            {%- elif not current_method.documented %}
            Unknown.
            {%- else %}
            Nothing.
            {%- endif %}
        </p>
    </div>
{% endblock %}
