From daeb37b27b9732bd34e02566f708f961bb6003a5 Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 27 Dec 2013 15:01:49 +0100
Subject: [PATCH] APIDump: Extra pages renamed to articles and moved to front.
---
MCServer/Plugins/APIDump/main_APIDump.lua | 63 ++++++++++++++---------
1 file changed, 39 insertions(+), 24 deletions(-)
diff --git a/MCServer/Plugins/APIDump/main_APIDump.lua b/MCServer/Plugins/APIDump/main_APIDump.lua
index 06dd451d7..c36285099 100644
--- a/MCServer/Plugins/APIDump/main_APIDump.lua
+++ b/MCServer/Plugins/APIDump/main_APIDump.lua
@@ -229,6 +229,32 @@ end
+local function WriteArticles(f)
+ f:write([[
+ Articles
+ The following articles provide various extra information on plugin development
+
+ ]]);
+ for i, extra in ipairs(g_APIDesc.ExtraPages) do
+ local SrcFileName = g_PluginFolder .. "/" .. extra.FileName;
+ if (cFile:Exists(SrcFileName)) then
+ local DstFileName = "API/" .. extra.FileName;
+ if (cFile:Exists(DstFileName)) then
+ cFile:Delete(DstFileName);
+ end
+ cFile:Copy(SrcFileName, DstFileName);
+ f:write("- " .. extra.Title .. "
\n");
+ else
+ f:write("- " .. extra.Title .. " (file is missing)
\n");
+ end
+ end
+ f:write("
");
+end
+
+
+
+
+
function DumpAPIHtml()
LOG("Dumping all available functions and constants to API subfolder...");
@@ -308,12 +334,17 @@ function DumpAPIHtml()
The API reference is divided into the following sections:
+ ]]);
+
+ WriteArticles(f);
+
+ f:write([[
Class index
The following classes are available in the MCServer Lua scripting language:
@@ -325,6 +356,9 @@ function DumpAPIHtml()
f:write([[
+ ]]);
+
+ f:write([[
Hooks
A plugin can register to be called whenever an "interesting event" occurs. It does so by calling
@@ -352,30 +386,11 @@ function DumpAPIHtml()
WriteHtmlHook(hook);
end
end
- f:write([[
-
+ f:write([[
+
- Extra pages
-
- The following pages provide various extra information
-
-
-]]);
- for i, extra in ipairs(g_APIDesc.ExtraPages) do
- local SrcFileName = g_PluginFolder .. "/" .. extra.FileName;
- if (cFile:Exists(SrcFileName)) then
- local DstFileName = "API/" .. extra.FileName;
- if (cFile:Exists(DstFileName)) then
- cFile:Delete(DstFileName);
- end
- cFile:Copy(SrcFileName, DstFileName);
- f:write(" - " .. extra.Title .. "
\n");
- else
- f:write(" - " .. extra.Title .. " (file is missing)
\n");
- end
- end
- f:write("
");
-
+ ]]);
+
-- Copy the static files to the output folder (overwrite any existing):
cFile:Copy(g_Plugin:GetLocalFolder() .. "/main.css", "API/main.css");
cFile:Copy(g_Plugin:GetLocalFolder() .. "/prettify.js", "API/prettify.js");