diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua
index 8d0f9f544..eadea622b 100644
--- a/MCServer/Plugins/APIDump/main.lua
+++ b/MCServer/Plugins/APIDump/main.lua
@@ -632,6 +632,24 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
cf:write(" \n\n");
end
+ local function WriteConstants(a_Constants, a_InheritedName)
+ if (#a_Constants == 0) then
+ return;
+ end
+
+ if (a_InheritedName ~= nil) then
+ cf:write("
Constants inherited from " .. a_InheritedName .. "
\n");
+ end
+
+ cf:write(" \n \n Name | \n Value | \n Notes | \n
\n");
+ for i, cons in ipairs(a_Constants) do
+ cf:write(" \n " .. cons.Name .. " | \n");
+ cf:write(" " .. cons.Value .. " | \n");
+ cf:write(" " .. LinkifyString(cons.Notes or "", a_InheritedName or a_ClassAPI.Name) .. " | \n
\n");
+ end
+ cf:write("
\n\n");
+ end
+
local function WriteDescendants(a_Descendants)
if (#a_Descendants == 0) then
return;
@@ -676,12 +694,25 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
local HasInheritance = ((#a_ClassAPI.Descendants > 0) or (a_ClassAPI.Inherits ~= nil));
+ local HasConstants = (#a_ClassAPI.Constants > 0);
+ local HasFunctions = (#a_ClassAPI.Functions > 0);
+ if (a_ClassAPI.Inherits ~= nil) then
+ for idx, cls in ipairs(a_ClassAPI.Inherits) do
+ HasConstants = HasConstants or (#cls.Constants > 0);
+ HasFunctions = HasFunctions or (#cls.Functions > 0);
+ end
+ end
+
-- Write the table of contents:
if (HasInheritance) then
cf:write(" Inheritance\n");
end
- cf:write(" Constants\n");
- cf:write(" Functions\n");
+ if (HasConstants) then
+ cf:write(" Constants\n");
+ end
+ if (HasFunctions) then
+ cf:write(" Functions\n");
+ end
if (a_ClassAPI.AdditionalInfo ~= nil) then
for i, additional in ipairs(a_ClassAPI.AdditionalInfo) do
cf:write(" " .. additional.Header .. "\n");
@@ -715,20 +746,21 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
end
-- Write the constants:
- cf:write("
Constants
\n");
- cf:write(" \n \n Name | \n Value | \n Notes | \n
\n");
- for i, cons in ipairs(a_ClassAPI.Constants) do
- cf:write(" \n " .. cons.Name .. " | \n");
- cf:write(" " .. cons.Value .. " | \n");
- cf:write(" " .. LinkifyString(cons.Notes or "", ClassName) .. " | \n
\n");
- end
- cf:write("
\n\n");
+ if (HasConstants) then
+ cf:write("
Constants
\n");
+ WriteConstants(a_ClassAPI.Constants, nil);
+ for i, cls in ipairs(InheritanceChain) do
+ WriteConstants(cls.Constants, cls.Name);
+ end;
+ end;
-- Write the functions, including the inherited ones:
- cf:write("
Functions
\n");
- WriteFunctions(a_ClassAPI.Functions, nil);
- for i, cls in ipairs(InheritanceChain) do
- WriteFunctions(cls.Functions, cls.Name);
+ if (HasFunctions) then
+ cf:write("
Functions
\n");
+ WriteFunctions(a_ClassAPI.Functions, nil);
+ for i, cls in ipairs(InheritanceChain) do
+ WriteFunctions(cls.Functions, cls.Name);
+ end
end
-- Write the additional infos: