Enhance documentation

fix [] errors in types
fix int not set as basetype
add generated date to bottom of page
Rename Crates to All Classes and remove it from the class view
This commit is contained in:
Rochet2
2015-05-10 01:43:13 +03:00
parent 196a432e7d
commit f3cd70c401
9 changed files with 38 additions and 28 deletions

View File

@@ -5,6 +5,7 @@ from jinja2 import Environment, FileSystemLoader
from typedecorator import params, returns
from parser import ClassParser, MethodDoc
import glob
import time
@returns([(str, FileType)])
@@ -39,9 +40,10 @@ def make_renderer(template_path, link_parser_factory):
template = env.get_template(template_name)
static = make_static(level)
root = make_root(level)
currdate = time.strftime("%d/%m/%Y")
with open('build/' + output_path, 'w') as out:
out.write(template.render(level=level, static=static, root=root, **kwargs))
out.write(template.render(level=level, static=static, root=root, currdate=currdate, **kwargs))
return inner

View File

@@ -42,7 +42,7 @@ class ParameterDoc(object):
self.description = ''
# If the data type is a C++ number, convert to Lua number and add range info to description.
if self.data_type in ['float', 'double', 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32']:
if self.data_type in ['float', 'double', 'int', 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32']:
range = ParameterDoc.valid_ranges[self.data_type]
if range:
self.description += '<p><em>Valid numbers</em>: integers from {0} to {1}.</p>'.format(range[0], range[1])
@@ -57,6 +57,9 @@ class ParameterDoc(object):
elif self.data_type == 'int64' or self.data_type == 'uint64':
self.data_type = '[' + self.data_type + ']'
elif not self.data_type in ['nil', 'boolean', 'number', 'string', 'table', 'function', '...'] and self.data_type[:1] != '[':
print "Missing [] from data type `" + self.data_type + "`"
class MethodDoc(object):
"""The documentation data of an Eluna method."""

View File

@@ -678,7 +678,7 @@
if (rootPath == '../') {
var sidebar = $('.sidebar');
var div = $('<div>').attr('class', 'block crate');
div.append($('<h2>').text('Crates'));
div.append($('<h2>').text('All Classes'));
var crates = [];
for (var crate in rawSearchIndex) {

View File

@@ -99,6 +99,7 @@
<script src="{{ static('jquery.js') }}"></script>
<script src="{{ static('main.js') }}"></script>
<script async src="{{ root('search-index.js') }}"></script>
<center>Generated on {{ currdate }}</center>
<center>&copy;2015 - Eluna Lua Engine</center>
</body>
</html>

View File

@@ -16,6 +16,10 @@
{%- endblock %}
{% block sidebar %}
{% endblock %}
{% block content %}
{{ current_class.description|parse_links }}