summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/APIDump/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'MCServer/Plugins/APIDump/main.lua')
-rw-r--r--MCServer/Plugins/APIDump/main.lua53
1 files changed, 29 insertions, 24 deletions
diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua
index d84926b53..fa9d29423 100644
--- a/MCServer/Plugins/APIDump/main.lua
+++ b/MCServer/Plugins/APIDump/main.lua
@@ -373,13 +373,18 @@ function ReadDescriptions(a_API)
return false;
end
- -- Returns true if the function (specified by its fully qualified name) is to be ignored
- local function IsFunctionIgnored(a_FnName)
+ -- Returns true if the function is to be ignored
+ local function IsFunctionIgnored(a_ClassName, a_FnName)
if (g_APIDesc.IgnoreFunctions == nil) then
return false;
end
+ if (((g_APIDesc.Classes[a_ClassName] or {}).Functions or {})[a_FnName] ~= nil) then
+ -- The function is documented, don't ignore
+ return false;
+ end
+ local FnName = a_ClassName .. "." .. a_FnName;
for i, name in ipairs(g_APIDesc.IgnoreFunctions) do
- if (a_FnName:match(name)) then
+ if (FnName:match(name)) then
return true;
end
end
@@ -482,7 +487,7 @@ function ReadDescriptions(a_API)
if (FnDesc == nil) then
-- No description for this API function
AddFunction(func.Name);
- if not(IsFunctionIgnored(cls.Name .. "." .. FnName)) then
+ if not(IsFunctionIgnored(cls.Name, FnName)) then
table.insert(cls.UndocumentedFunctions, FnName);
end
else
@@ -505,7 +510,7 @@ function ReadDescriptions(a_API)
else -- if (APIDesc.Functions ~= nil)
for j, func in ipairs(cls.Functions) do
local FnName = func.DocID or func.Name;
- if not(IsFunctionIgnored(cls.Name .. "." .. FnName)) then
+ if not(IsFunctionIgnored(cls.Name, FnName)) then
table.insert(cls.UndocumentedFunctions, FnName);
end
end
@@ -567,7 +572,7 @@ function ReadDescriptions(a_API)
g_Stats.NumUndocumentedClasses = g_Stats.NumUndocumentedClasses + 1;
for j, func in ipairs(cls.Functions) do
local FnName = func.DocID or func.Name;
- if not(IsFunctionIgnored(cls.Name .. "." .. FnName)) then
+ if not(IsFunctionIgnored(cls.Name, FnName)) then
table.insert(cls.UndocumentedFunctions, FnName);
end
end -- for j, func - cls.Functions[]
@@ -586,7 +591,7 @@ function ReadDescriptions(a_API)
-- Remove ignored functions:
local NewFunctions = {};
for j, fn in ipairs(cls.Functions) do
- if (not(IsFunctionIgnored(cls.Name .. "." .. fn.Name))) then
+ if (not(IsFunctionIgnored(cls.Name, fn.Name))) then
table.insert(NewFunctions, fn);
end
end -- for j, fn
@@ -735,14 +740,14 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
end
if (a_InheritedName ~= nil) then
- cf:write(" <h2>Functions inherited from " .. a_InheritedName .. "</h2>\n");
+ 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");
for i, func in ipairs(a_Functions) do
cf:write(" <tr>\n <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.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");
end
cf:write(" </table>\n\n");
end
@@ -753,14 +758,14 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
end
if (a_InheritedName ~= nil) then
- cf:write(" <h2>Constants inherited from " .. a_InheritedName .. "</h2>\n");
+ cf:write(" <h2>Constants inherited from ", a_InheritedName, "</h2>\n");
end
cf:write(" <table>\n <tr>\n <th>Name</th>\n <th>Value</th>\n <th>Notes</th>\n </tr>\n");
for i, cons in ipairs(a_Constants) do
- cf:write(" <tr>\n <td>" .. cons.Name .. "</td>\n");
- cf:write(" <td>" .. cons.Value .. "</td>\n");
- cf:write(" <td>" .. LinkifyString(cons.Notes or "", a_InheritedName or a_ClassAPI.Name) .. "</td>\n </tr>\n");
+ cf:write(" <tr>\n <td>", cons.Name, "</td>\n");
+ cf:write(" <td>", cons.Value, "</td>\n");
+ cf:write(" <td>", LinkifyString(cons.Notes or "", a_InheritedName or a_ClassAPI.Name), "</td>\n </tr>\n");
end
cf:write(" </table>\n\n");
end
@@ -771,14 +776,14 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
end
if (a_InheritedName ~= nil) then
- cf:write(" <h2>Member variables inherited from " .. a_InheritedName .. "</h2>\n");
+ 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");
for i, var in ipairs(a_Variables) do
- cf:write(" <tr>\n <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");
+ cf:write(" <tr>\n <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
cf:write(" </table>\n\n");
end
@@ -789,7 +794,7 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
end
cf:write("<ul>");
for i, desc in ipairs(a_Descendants) do
- cf:write("<li><a href=\"".. desc.Name .. ".html\">" .. desc.Name .. "</a>");
+ cf:write("<li><a href=\"", desc.Name, ".html\">", desc.Name, "</a>");
WriteDescendants(desc.Descendants);
cf:write("</li>\n");
end
@@ -809,7 +814,7 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
cf:write([[<!DOCTYPE html>
<html>
<head>
- <title>MCServer API - ]] .. a_ClassAPI.Name .. [[ Class</title>
+ <title>MCServer API - ]], a_ClassAPI.Name, [[ Class</title>
<link rel="stylesheet" type="text/css" href="main.css" />
<link rel="stylesheet" type="text/css" href="prettify.css" />
<script src="prettify.js"></script>
@@ -818,7 +823,7 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
<body>
<div id="content">
<header>
- <h1>]] .. a_ClassAPI.Name .. [[</h1>
+ <h1>]], a_ClassAPI.Name, [[</h1>
<hr />
</header>
<h1>Contents</h1>
@@ -852,7 +857,7 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
end
if (a_ClassAPI.AdditionalInfo ~= nil) then
for i, additional in ipairs(a_ClassAPI.AdditionalInfo) do
- cf:write(" <li><a href=\"#additionalinfo_" .. i .. "\">" .. (additional.Header or "<i>(No header)</i>").. "</a></li>\n");
+ cf:write(" <li><a href=\"#additionalinfo_", i, "\">", (additional.Header or "<i>(No header)</i>"), "</a></li>\n");
end
end
cf:write(" </ul>\n\n");
@@ -915,7 +920,7 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
-- Write the additional infos:
if (a_ClassAPI.AdditionalInfo ~= nil) then
for i, additional in ipairs(a_ClassAPI.AdditionalInfo) do
- cf:write(" <a name=\"additionalinfo_" .. i .. "\"><h1>" .. additional.Header .. "</h1></a>\n");
+ cf:write(" <a name=\"additionalinfo_", i, "\"><h1>", additional.Header, "</h1></a>\n");
cf:write(LinkifyString(additional.Contents, ClassName));
end
end