From e9a809dfb9da77b032a98de6395e46a36fb7fa77 Mon Sep 17 00:00:00 2001
From: madmaxoft
"; -- Replace empty lines with paragraph delimiters; add only when there's a followup text on next line + AddNextTime = "
\n\t\t"; -- Replace empty lines with paragraph delimiters; add only when there's a followup text on next line else + Desc = Desc .. AddNextTime .. line .. "\n"; AddNextTime = ""; end elseif (state == 2) then @@ -406,7 +413,8 @@ function ConvertWikiToDesc() notes = notes:sub(1, notes:len() - 2); -- Remove the trailing " |" local name = (Split[2] or ""); if ((name == "( )") or (name == "()")) then - name = "constructor"; -- Special name is used for the constructor in the wiki + name = "constructor" .. ConstructorNumber; -- Special name is used for the constructor in the wiki + ConstructorNumber = ConstructorNumber + 1; end table.insert(Functions, {Name = name, Params = Split[3], Return = Split[4], Notes = notes}); end @@ -415,19 +423,22 @@ function ConvertWikiToDesc() fin:close(); -- Write the info into the output file: - fout:write(ClassName .. " =\n{\n\tDesc = [[" .. Desc .. "]]\n\tFunctions =\n\t{\n"); + fout:write("\t\t" .. ClassName .. " =\n\t\t{\n\t\t\tDesc = [[" .. Desc .. "]],\n\t\t\tFunctions =\n\t\t\t{\n"); for i, func in ipairs(Functions) do - fout:write("\t\t{ " .. func.Name .. " = { Params = \"" .. func.Params .. "\", Return =\"" .. - func.Return .. "\", Desc = \"" .. func.Notes .. "\" },\n" - ); + fout:write(string.format("\t\t\t\t{ %s = { Params = %q, Return = %q, Notes = %q } },\n", + func.Name, func.Params, func.Return, func.Notes + )); end - fout:write("\t},\n\tConstants =\n\t{\n"); + fout:write("\t\t\t},\n\t\t\tConstants =\n\t\t\t{\n"); for i, cons in ipairs(Constants) do - fout:write("\t\t{ " .. cons.Name .. " = { Notes = \"" .. cons.Notes .. "\" },\n"); + fout:write(string.format("\t\t\t\t{ %s = { Notes = %q } },\n", + cons.Name, cons.Notes + )); end - fout:write("\t},\n},\n\n\n"); + fout:write("\t\t\t},\n\t\t},\n\n"); end -- if fin ~= nil end -- for file + fout:write("\t}\n}\n\n\n\n\n\n"); fout:close(); end -- cgit v1.2.3