APIDump: Removed needless whitespace output.
This commit is contained in:
parent
38fe16d8b6
commit
51b02854f9
@ -301,32 +301,35 @@ function DumpAPIHtml()
|
||||
<hr />
|
||||
</header>
|
||||
<p>The API reference is divided into the following sections:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="#classes">Class index</a></li>
|
||||
<li><a href="#hooks">Hooks</a></li>
|
||||
<li><a href="#extra">Extra pages</a></li>
|
||||
<li><a href="#docstats">Documentation statistics</a></li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
<a name="classes"><h2>Class index</h2></a>
|
||||
<p>The following classes are available in the MCServer Lua scripting language:</p>
|
||||
|
||||
<p>The following classes are available in the MCServer Lua scripting language:
|
||||
<ul>
|
||||
]]);
|
||||
for i, cls in ipairs(API) do
|
||||
f:write(" <li><a href=\"" .. cls.Name .. ".html\">" .. cls.Name .. "</a></li>\n");
|
||||
f:write("<li><a href=\"", cls.Name, ".html\">", cls.Name, "</a></li>\n");
|
||||
WriteHtmlClass(cls, API);
|
||||
end
|
||||
f:write([[ </ul>
|
||||
|
||||
f:write([[
|
||||
</ul></p>
|
||||
<hr />
|
||||
<a name="hooks"><h2>Hooks</h2></a>
|
||||
|
||||
<p>A plugin can register to be called whenever an "interesting event" occurs. It does so by calling <a href="cPluginManager.html">cPluginManager</a>'s AddHook() function and implementing a callback function to handle the event.</p>
|
||||
<p>A plugin can decide whether it will let the event pass through to the rest of the plugins, or hide it from them. This is determined by the return value from the hook callback function. If the function returns false or no value, the event is propagated further. If the function returns true, the processing is stopped, no other plugin receives the notification (and possibly MCServer disables the default behavior for the event). See each hook's details to see the exact behavior.</p>
|
||||
|
||||
<p>
|
||||
A plugin can register to be called whenever an "interesting event" occurs. It does so by calling
|
||||
<a href="cPluginManager.html">cPluginManager</a>'s AddHook() function and implementing a callback
|
||||
function to handle the event.</p>
|
||||
<p>
|
||||
A plugin can decide whether it will let the event pass through to the rest of the plugins, or hide it
|
||||
from them. This is determined by the return value from the hook callback function. If the function
|
||||
returns false or no value, the event is propagated further. If the function returns true, the processing
|
||||
is stopped, no other plugin receives the notification (and possibly MCServer disables the default
|
||||
behavior for the event). See each hook's details to see the exact behavior.</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Hook name</th>
|
||||
@ -828,14 +831,14 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
|
||||
if (a_InheritedName ~= nil) then
|
||||
cf:write("<h2>Functions inherited from ", a_InheritedName, "</h2>\n");
|
||||
end
|
||||
cf:write(" <table>\n <tr>\n <th>Name</th>\n <th>Parameters</th>\n <th>Return value</th>\n <th>Notes</th>\n </tr>\n");
|
||||
cf:write("<table>\n<tr><th>Name</th><th>Parameters</th><th>Return value</th><th>Notes</th></tr>\n");
|
||||
for i, func in ipairs(a_Functions) do
|
||||
cf:write(" <tr>\n <td>" .. func.Name .. "</td>\n");
|
||||
cf:write("<tr><td>", func.Name, "</td>\n");
|
||||
cf:write("<td>", LinkifyString(func.Params or "", (a_InheritedName or a_ClassAPI.Name)), "</td>\n");
|
||||
cf:write("<td>", LinkifyString(func.Return or "", (a_InheritedName or a_ClassAPI.Name)), "</td>\n");
|
||||
cf:write(" <td>", LinkifyString(func.Notes or "<i>(undocumented)</i>", (a_InheritedName or a_ClassAPI.Name)), "</td>\n </tr>\n");
|
||||
cf:write("<td>", LinkifyString(func.Notes or "<i>(undocumented)</i>", (a_InheritedName or a_ClassAPI.Name)), "</td></tr>\n");
|
||||
end
|
||||
cf:write(" </table>\n\n");
|
||||
cf:write("</table>\n");
|
||||
end
|
||||
|
||||
local function WriteConstantTable(a_Constants, a_Source)
|
||||
@ -882,9 +885,9 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
|
||||
cf:write("<h2>Member variables inherited from ", a_InheritedName, "</h2>\n");
|
||||
end
|
||||
|
||||
cf:write(" <table>\n <tr>\n <th>Name</th>\n <th>Type</th>\n <th>Notes</th>\n </tr>\n");
|
||||
cf:write("<table><tr><th>Name</th><th>Type</th><th>Notes</th></tr>\n");
|
||||
for i, var in ipairs(a_Variables) do
|
||||
cf:write(" <tr>\n <td>", var.Name, "</td>\n");
|
||||
cf:write("<tr><td>", var.Name, "</td>\n");
|
||||
cf:write("<td>", LinkifyString(var.Type or "<i>(undocumented)</i>", a_InheritedName or a_ClassAPI.Name), "</td>\n");
|
||||
cf:write("<td>", LinkifyString(var.Notes or "", a_InheritedName or a_ClassAPI.Name), "</td>\n </tr>\n");
|
||||
end
|
||||
@ -914,8 +917,7 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
|
||||
CurrInheritance = CurrInheritance.Inherits;
|
||||
end
|
||||
|
||||
cf:write([[<!DOCTYPE html>
|
||||
<html>
|
||||
cf:write([[<!DOCTYPE html><html>
|
||||
<head>
|
||||
<title>MCServer API - ]], a_ClassAPI.Name, [[ Class</title>
|
||||
<link rel="stylesheet" type="text/css" href="main.css" />
|
||||
@ -930,8 +932,7 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
|
||||
<hr />
|
||||
</header>
|
||||
<h1>Contents</h1>
|
||||
|
||||
<ul>
|
||||
<p><ul>
|
||||
]]);
|
||||
|
||||
local HasInheritance = ((#a_ClassAPI.Descendants > 0) or (a_ClassAPI.Inherits ~= nil));
|
||||
@ -963,10 +964,10 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
|
||||
cf:write("<li><a href=\"#additionalinfo_", i, "\">", (additional.Header or "<i>(No header)</i>"), "</a></li>\n");
|
||||
end
|
||||
end
|
||||
cf:write(" </ul>\n\n");
|
||||
cf:write("</ul></p>\n");
|
||||
|
||||
-- Write the class description:
|
||||
cf:write(" <a name=\"desc\"><hr /><h1>" .. ClassName .. " class</h1></a>\n");
|
||||
cf:write("<hr /><a name=\"desc\"><h1>", ClassName, " class</h1></a>\n");
|
||||
if (a_ClassAPI.Desc ~= nil) then
|
||||
cf:write("<p>");
|
||||
cf:write(LinkifyString(a_ClassAPI.Desc, ClassName));
|
||||
@ -975,13 +976,13 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
|
||||
|
||||
-- Write the inheritance, if available:
|
||||
if (HasInheritance) then
|
||||
cf:write(" <a name=\"inherits\">\n <hr /><h1>Inheritance</h1></a>\n");
|
||||
cf:write("<hr /><a name=\"inherits\"><h1>Inheritance</h1></a>\n");
|
||||
if (#InheritanceChain > 0) then
|
||||
cf:write(" <p>This class inherits from the following parent classes:</p>\n\n <ul>\n");
|
||||
cf:write("<p>This class inherits from the following parent classes:<ul>\n");
|
||||
for i, cls in ipairs(InheritanceChain) do
|
||||
cf:write(" <li><a href=\"" .. cls.Name .. ".html\">" .. cls.Name .. "</a></li>\n");
|
||||
cf:write("<li><a href=\"", cls.Name, ".html\">", cls.Name, "</a></li>\n");
|
||||
end
|
||||
cf:write(" </ul>\n\n");
|
||||
cf:write("</ul></p>\n");
|
||||
end
|
||||
if (#a_ClassAPI.Descendants > 0) then
|
||||
cf:write("<p>This class has the following descendants:\n");
|
||||
@ -1028,14 +1029,7 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
|
||||
end
|
||||
end
|
||||
|
||||
cf:write([[
|
||||
</div>
|
||||
<script>
|
||||
prettyPrint();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
]]);
|
||||
cf:write([[</div><script>prettyPrint();</script></body></html>]]);
|
||||
cf:close();
|
||||
end
|
||||
|
||||
@ -1052,10 +1046,9 @@ function WriteHtmlHook(a_Hook)
|
||||
end
|
||||
local HookName = a_Hook.DefaultFnName;
|
||||
|
||||
f:write([[<!DOCTYPE html>
|
||||
<html>
|
||||
f:write([[<!DOCTYPE html><html>
|
||||
<head>
|
||||
<title>MCServer API - ]] .. HookName .. [[ Hook</title>
|
||||
<title>MCServer API - ]], HookName, [[ Hook</title>
|
||||
<link rel="stylesheet" type="text/css" href="main.css" />
|
||||
<link rel="stylesheet" type="text/css" href="prettify.css" />
|
||||
<script src="prettify.js"></script>
|
||||
@ -1064,15 +1057,15 @@ function WriteHtmlHook(a_Hook)
|
||||
<body>
|
||||
<div id="content">
|
||||
<header>
|
||||
<h1>]] .. a_Hook.Name .. [[</h1>
|
||||
<h1>]], a_Hook.Name, [[</h1>
|
||||
<hr />
|
||||
</header>
|
||||
<p>
|
||||
]]);
|
||||
f:write(LinkifyString(a_Hook.Desc, HookName));
|
||||
f:write("</p>\n<hr /><h1>Callback function</h1>\n<p>The default name for the callback function is ");
|
||||
f:write(a_Hook.DefaultFnName .. ". It has the following signature:\n\n");
|
||||
f:write(" <pre class=\"prettyprint lang-lua\">function " .. HookName .. "(");
|
||||
f:write(a_Hook.DefaultFnName, ". It has the following signature:\n");
|
||||
f:write("<pre class=\"prettyprint lang-lua\">function ", HookName, "(");
|
||||
if (a_Hook.Params == nil) then
|
||||
a_Hook.Params = {};
|
||||
end
|
||||
@ -1082,30 +1075,22 @@ function WriteHtmlHook(a_Hook)
|
||||
end
|
||||
f:write(param.Name);
|
||||
end
|
||||
f:write(")</pre>\n\n <hr /><h1>Parameters:</h1>\n\n <table>\n <tr>\n <th>Name</th>\n <th>Type</th>\n <th>Notes</th>\n </tr>\n");
|
||||
f:write(")</pre>\n<hr /><h1>Parameters:</h1>\n<table><tr><th>Name</th><th>Type</th><th>Notes</th></tr>\n");
|
||||
for i, param in ipairs(a_Hook.Params) do
|
||||
f:write(" <tr>\n <td>" .. param.Name .. "</td>\n <td>" .. LinkifyString(param.Type, HookName) .. "</td>\n <td>" .. LinkifyString(param.Notes, HookName) .. "</td>\n </tr>\n");
|
||||
f:write("<tr><td>", param.Name, "</td><td>", LinkifyString(param.Type, HookName), "</td><td>", LinkifyString(param.Notes, HookName), "</td></tr>\n");
|
||||
end
|
||||
f:write(" </table>\n\n <p>" .. (a_Hook.Returns or "") .. "</p>\n\n");
|
||||
f:write([[ <hr /><h1>Code examples</h1>
|
||||
<h2>Registering the callback</h2>
|
||||
|
||||
]]);
|
||||
f:write("</table>\n<p>" .. (a_Hook.Returns or "") .. "</p>\n\n");
|
||||
f:write([[<hr /><h1>Code examples</h1><h2>Registering the callback</h2>]]);
|
||||
f:write("<pre class=\"prettyprint lang-lua\">\n");
|
||||
f:write([[cPluginManager.AddHook(cPluginManager.]] .. a_Hook.Name .. ", My" .. a_Hook.DefaultFnName .. [[);]]);
|
||||
f:write("</pre>\n\n");
|
||||
local Examples = a_Hook.CodeExamples or {};
|
||||
for i, example in ipairs(Examples) do
|
||||
f:write(" <h2>" .. (example.Title or "<i>missing Title</i>") .. "</h2>\n");
|
||||
f:write(" <p>" .. (example.Desc or "<i>missing Desc</i>") .. "</p>\n\n");
|
||||
f:write(" <pre class=\"prettyprint lang-lua\">" .. (example.Code or "<i>missing Code</i>") .. "\n </pre>\n\n");
|
||||
f:write("<h2>", (example.Title or "<i>missing Title</i>"), "</h2>\n");
|
||||
f:write("<p>", (example.Desc or "<i>missing Desc</i>"), "</p>\n");
|
||||
f:write("<pre class=\"prettyprint lang-lua\">", (example.Code or "<i>missing Code</i>"), "\n</pre>\n\n");
|
||||
end
|
||||
f:write([[ </div>
|
||||
<script>
|
||||
prettyPrint();
|
||||
</script>
|
||||
</body>
|
||||
</html>]]);
|
||||
f:write([[</div><script>prettyPrint();</script></body></html>]]);
|
||||
f:close();
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user