Add documentation generator.

This commit is contained in:
Patman64
2014-08-10 03:36:18 -04:00
parent eb2b9d78b9
commit a693bcae7e
24 changed files with 2043 additions and 0 deletions

View File

@@ -0,0 +1,103 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{% block description %}API documentation for the Eluna engine.{% endblock %}">
<meta name="keywords" content="eluna, lua, lua engine, trinitycore, trinity, mangos, cmangos, script, scripting, doc, docs, documentation">
<title>{% block title %}Eluna API{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{{ static('main.css') }}">
<link rel="shortcut icon" href="{{ static('favicon.ico') }}">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<section class="sidebar">
<a href='{{ root('index.html') }}'><img src='{{ static('eluna-logo.png') }}' alt='Eluna Logo' width='100'></a>
<div class="block">
{% block sidebar %}
<h2>All Classes</h2>
{% for class in classes -%}
<a class="mod {{ 'current' if class == current_class }}" href="{{ root(class.name + '/index.html') }}">{{ class.name }}</a>
{%- endfor %}
{% endblock %}
</div>
</section>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press 'S' to search, '?' for more options..."
type="search">
</div>
</form>
</nav>
<section id='main' class="content mod">
<h1 class='fqn'>
{% block document_title %}Title Missing{% endblock %}
<span class='out-of-band'>
<span id='render-detail'>
<a id="collapse-all" href="#">[-]</a>
<a id="expand-all" href="#">[+]</a>
</span>
</span>
</h1>
{% block content %}<h2>Content missing.</h2>{% endblock %}
</section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<div id="help" class="hidden">
<div class="shortcuts">
<h1>Keyboard shortcuts</h1>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
</dl>
</div>
<div class="infos">
<h1>Search tricks</h1>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code> (or <code>str</code>), <code>enum</code>,
<code>trait</code>, <code>typedef</code> (or
<code>tdef</code>).
</p>
</div>
</div>
<script>
window.rootPath = "{{ ('../' * level) if level }}";
</script>
<script src="{{ static('jquery.js') }}"></script>
<script src="{{ static('main.js') }}"></script>
<script async src="{{ root('search-index.js') }}"></script>
</body>
</html>

View File

@@ -0,0 +1,36 @@
{% extends '_base.html' %}
{% block title -%}
{{ current_class.name }} - {{ super() }}
{%- endblock %}
{% block description -%}
API documentation for the {{ current_class.name }} class in the Eluna engine.
{%- endblock %}
{% block document_title -%}
Class <a class="mod" href="">{{ current_class.name }}</a>
{%- endblock %}
{% block content %}
{{ current_class.description|parse_links }}
<h2 id='methods' class='section-header'><a href="#methods">Methods</a></h2>
<table>
{%- for method in current_class.methods %}
<tr>
<td>
<a class='stability {{ 'Stable' if method.documented else 'Experimental' }}' title='{{ 'Documented' if method.documented else 'Undocumented' }}'></a>
<a class='fn' href='{{ method.name }}.html'>{{ method.name }}</a>
</td>
<td class='docblock short'>
<p>{{ method.short_description|parse_links }}</p>
</td>
</tr>
{%- endfor %}
</table>
{% endblock %}

View File

@@ -0,0 +1 @@
{% extends '_base.html' %}

View File

@@ -0,0 +1,77 @@
{% extends '_base.html' %}
{% block document_title -%}
Eluna API Documentation
{%- endblock %}
{% block content %}
<div class='docblock'>
<h1 id="the-eluna-engine-api" class='section-header'>
<a href="#the-eluna-engine-api">The Eluna Engine API</a>
</h1>
<p>
The Eluna Engine's API allows you to add your own Lua code to be executed when certain events (called "hooks") occur.
</p>
<p>
Add a new in-game command, give life to creatures with new AI, or even light players who try to duel on fire!
If the hook exists, you can script it.
</p>
<h2 id="about-eluna" class='section-header'>
<a href="#about-eluna">About Eluna</a>
</h2>
<p>
Eluna is a <a href="http://www.lua.org/">Lua</a> engine for World of Warcraft emulators.
Eluna supports <a href="http://cmangos.net/">CMaNGOS</a>/<a href="https://www.getmangos.eu/home.php">MaNGOS</a>
and <a href="http://www.trinitycore.org/">TrinityCore</a>.
</p>
<p>
To get Eluna, simply clone your favorite version of MaNGOS or Trinity from
<a href="https://github.com/ElunaLuaEngine">our Github account</a>.
Each fork there has Eluna already integrated, so you just need to compile and go!
</p>
<p>
Follow us on <a href="https://twitter.com/EmuDevs">our Twitter page</a> to view the latest news about what's going on with Eluna.
</p>
<h2 id="tutorials-and-guides" class='section-header'>
<a href="#tutorials-and-guides">Tutorials & Guides</a>
</h2>
<p>
We haven't written tutorials yet, but when we do, we'll put the links here.
</p>
<h2 id="about-this-documentation" class='section-header'>
<a href="#about-this-documentation">About this documentation</a>
</h2>
<p>
The layout, CSS, and Javascript code for this documentation was borrowed from <a href="http://doc.rust-lang.org/">doc.rust-lang.org</a>.
</p>
<p>
The documentation generator was originally written by <a href="https://github.com/Patman64">Patman64</a> and is maintained by the Eluna team.
</p>
</div>
<h2 id='modules' class='section-header'><a href="#modules">Classes</a></h2>
<table>
{%- for class in classes %}
<tr>
<td>
{%- if class.fully_documented %}
<a class='stability Stable' title='Fully Documented'></a>
{%- elif class.fully_undocumented %}
<a class='stability Experimental' title='Fully Undocumented'></a>
{%- else %}
<a class='stability Unstable' title='Partially Documented'></a>
{%- endif %}
<a class='mod' href='{{ root(class.name + '/index.html') }}'>{{ class.name }}</a>
</td>
<td class='docblock short'>
<p>{{ class.short_description|parse_links }}</p>
</td>
</tr>
{%- endfor %}
</table>
{% endblock %}

View File

@@ -0,0 +1,94 @@
{% 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>
{%- for method in current_class.methods %}
<a class="fn {{ 'current' if method == current_method }}" href="{{ root(current_class.name + '/' + method.name + '.html') }}">{{ method.name }}</a>
{%- endfor %}
{% 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>
{%- endif %}
<h2 id="synopsis" class='section-header'>
<a href="#synopsis">Synopsis</a>
</h2>
<p>
<code>
{%- for returned in current_method.returned -%}
{{ returned.name }} {{- ', ' if not loop.last }}
{%- endfor %}
{{- ' = ' if current_method.returned|length > 0 }}
{{- current_class.name -}} : {{- current_method.name -}} (
{%- for param in current_method.parameters -%}
{{ param.name }} {{- ', ' if not loop.last }}
{%- endfor -%}
)</code>
</p>
<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 }} {{ 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 %}

View File

@@ -0,0 +1,17 @@
var searchIndex = {};
//{%- for class in classes %}
searchIndex["{{ class.name }}"] = {
"items": [
[0, "", "{{ class.name }}", "{{ class.short_description|replace('\n', ' ')|replace('\"', '&#34;') }}"],
//{%- for method in class.methods %}
[3, "{{ method.name }}", "", "{{ method.short_description|replace('\n', ' ')|replace('\"', '&#34;') }}"],
//{%- endfor %}
],
"paths": [
]
};
//{%- endfor %}
initSearch(searchIndex);