From d2c2d4ba52242acc85e15872340b492a9dad1201 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 14 Sep 2013 16:20:54 +0200 Subject: APIDump: Moved sorting after the renaming. --- MCServer/Plugins/APIDump/APIDesc.lua | 1 + MCServer/Plugins/APIDump/main.lua | 45 +++++++++++++++++++----------------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 1578e01ed..1ee9e9a8d 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1315,6 +1315,7 @@ A list of items regarding WebPlugins that have been documented "%a+\.\.collector", -- AnyClass..collector "%a+\.new", -- AnyClass.new "%a+.new_local", -- AnyClass.new_local + "%a+.delete", -- AnyClass.delete }, } ; diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index e7f652bd5..0c9d683fb 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -128,26 +128,11 @@ function CreateAPITables() end end - local function SortClass(a_ClassAPI) - table.sort(a_ClassAPI.Functions, -- Sort function list - function(f1, f2) - return (f1.Name < f2.Name); - end - ); - table.sort(a_ClassAPI.Constants, -- Sort constant list - function(c1, c2) - return (c1.Name < c2.Name); - end - ); - end; - local function ParseClass(a_ClassName, a_ClassObj) local res = {Name = a_ClassName, Functions = {}, Constants = {}, Descendants = {}}; for i, v in pairs(a_ClassObj) do Add(res, i, v); end - - SortClass(res); return res; end @@ -164,12 +149,6 @@ function CreateAPITables() end end end - SortClass(Globals); - table.sort(API, - function(c1, c2) - return (c1.Name < c2.Name); - end - ); return API, Globals; end @@ -182,6 +161,15 @@ function DumpAPIHtml() LOG("Dumping all available functions and constants to API subfolder..."); local API, Globals = CreateAPITables(); + + -- Sort the classes by name: + table.sort(API, + function (c1, c2) + return (string.lower(c1.Name) < string.lower(c2.Name)); + end + ); + + -- Add Globals into the API: Globals.Name = "Globals"; table.insert(API, Globals); @@ -325,6 +313,20 @@ function ReadDescriptions(a_API) end end -- for j, fn cls.Functions = NewFunctions; + + -- Sort the functions (they may have been renamed): + table.sort(cls.Functions, + function(f1, f2) + return (f1.Name < f2.Name); + end + ); + + -- Sort the constants: + table.sort(cls.Constants, + function(c1, c2) + return (c1.Name < c2.Name); + end + ); end -- for i, cls -- Sort the descendants lists: @@ -359,6 +361,7 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI) if (#a_Functions == 0) then return; end + if (a_InheritedName ~= nil) then cf:write("

Functions inherited from " .. a_InheritedName .. "

"); end -- cgit v1.2.3