diff options
author | madmaxoft <github@xoft.cz> | 2013-10-20 14:56:09 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-10-20 14:56:09 +0200 |
commit | 0230936f619e8dcce6144e6489debca1a9bcc121 (patch) | |
tree | 45c0e6b23bbf2f1bcb3ce82957f63c73b939adbf /MCServer/Plugins | |
parent | Fixed memory leak in cMobFamilyCollecter. (diff) | |
download | cuberite-0230936f619e8dcce6144e6489debca1a9bcc121.tar cuberite-0230936f619e8dcce6144e6489debca1a9bcc121.tar.gz cuberite-0230936f619e8dcce6144e6489debca1a9bcc121.tar.bz2 cuberite-0230936f619e8dcce6144e6489debca1a9bcc121.tar.lz cuberite-0230936f619e8dcce6144e6489debca1a9bcc121.tar.xz cuberite-0230936f619e8dcce6144e6489debca1a9bcc121.tar.zst cuberite-0230936f619e8dcce6144e6489debca1a9bcc121.zip |
Diffstat (limited to '')
-rw-r--r-- | MCServer/Plugins/APIDump/main.lua | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index 69cbfbfa5..b608ce256 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -1162,33 +1162,63 @@ end --- Writes the documentation statistics (in g_Stats) into the given HTML file function WriteStats(f) + local function ExportMeter(a_Percent) + local Color; + if (a_Percent > 95) then + Color = "green"; + elseif (a_Percent > 50) then + Color = "orange"; + else + Color = "red"; + end + + local meter = { + "\n", + "<div style=\"background-color: black; padding: 1px; width: 100px\">\n", + "<div style=\"background-color: ", + Color, + "; width: ", + a_Percent, + "%; height: 16px\"></div></div>\n</td><td>", + string.format("%.2f", a_Percent), + " %", + }; + return table.concat(meter, ""); + end + f:write([[ <hr /><a name="docstats"><h2>Documentation statistics</h2></a> - <table><tr><th>Object</th><th>Total</th><th>Documented</th><th>Undocumented</th><th>Documented %</th></tr> + <table><tr><th>Object</th><th>Total</th><th>Documented</th><th>Undocumented</th><th colspan="2">Documented %</th></tr> ]]); f:write("<tr><td>Classes</td><td>", g_Stats.NumTotalClasses); f:write("</td><td>", g_Stats.NumTotalClasses - g_Stats.NumUndocumentedClasses); f:write("</td><td>", g_Stats.NumUndocumentedClasses); - f:write("</td><td>", 100 * (g_Stats.NumTotalClasses - g_Stats.NumUndocumentedClasses) / g_Stats.NumTotalClasses); - f:write("</td></tr>"); + f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalClasses - g_Stats.NumUndocumentedClasses) / g_Stats.NumTotalClasses)); + f:write("</td></tr>\n"); f:write("<tr><td>Functions</td><td>", g_Stats.NumTotalFunctions); f:write("</td><td>", g_Stats.NumTotalFunctions - g_Stats.NumUndocumentedFunctions); f:write("</td><td>", g_Stats.NumUndocumentedFunctions); - f:write("</td><td>", 100 * (g_Stats.NumTotalFunctions - g_Stats.NumUndocumentedFunctions) / g_Stats.NumTotalFunctions); - f:write("</td></tr>"); + f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalFunctions - g_Stats.NumUndocumentedFunctions) / g_Stats.NumTotalFunctions)); + f:write("</td></tr>\n"); f:write("<tr><td>Member variables</td><td>", g_Stats.NumTotalVariables); f:write("</td><td>", g_Stats.NumTotalVariables - g_Stats.NumUndocumentedVariables); f:write("</td><td>", g_Stats.NumUndocumentedVariables); - f:write("</td><td>", 100 * (g_Stats.NumTotalVariables - g_Stats.NumUndocumentedVariables) / g_Stats.NumTotalVariables); - f:write("</td></tr>"); + f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalVariables - g_Stats.NumUndocumentedVariables) / g_Stats.NumTotalVariables)); + f:write("</td></tr>\n"); f:write("<tr><td>Constants</td><td>", g_Stats.NumTotalConstants); f:write("</td><td>", g_Stats.NumTotalConstants - g_Stats.NumUndocumentedConstants); f:write("</td><td>", g_Stats.NumUndocumentedConstants); - f:write("</td><td>", 100 * (g_Stats.NumTotalConstants - g_Stats.NumUndocumentedConstants) / g_Stats.NumTotalConstants); - f:write("</td></tr>"); + f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalConstants - g_Stats.NumUndocumentedConstants) / g_Stats.NumTotalConstants)); + f:write("</td></tr>\n"); + + f:write("<tr><td>Hooks</td><td>", g_Stats.NumTotalHooks); + f:write("</td><td>", g_Stats.NumTotalHooks - g_Stats.NumUndocumentedHooks); + f:write("</td><td>", g_Stats.NumUndocumentedHooks); + f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalHooks - g_Stats.NumUndocumentedHooks) / g_Stats.NumTotalHooks)); + f:write("</td></tr>\n"); f:write([[ </table> |