6,834
edits
No edit summary |
Tag: Undo |
||
Line 407: | Line 407: | ||
else | else | ||
for i,arg in ipairs(entries) do | for i,arg in ipairs(entries) do | ||
local tokens = p.split(arg, ' ') | |||
local isOptional = tokens[1]:sub(1, 1) == '[' | |||
if isOptional then | |||
tokens[1] = tokens[1]:sub(2, tokens[1]:len()) | |||
tokens[4] = tokens[4]:sub(1, tokens[4]:len() - 1) | |||
end | |||
local defaultValue = isOptional and tokens[4] or "n/a" | |||
if isOptional then | |||
table.insert(argsText, '[ '..tokens[1]..' '..tokens[2]..' = '..defaultValue..' ]') | |||
else | |||
table.insert(argsText, tokens[1]..' '..tokens[2]) | |||
end | |||
end | end | ||
end | end | ||
Line 428: | Line 441: | ||
}) | }) | ||
end | end | ||
end | end | ||
Line 491: | Line 447: | ||
local entries = p.getIndexedArgs(frame, 'desc') | local entries = p.getIndexedArgs(frame, 'desc') | ||
local startTextFirstLine = "The <span style=\"font-family: 'Source Code Pro', monospace;\">"..p.getDisplayedNameColoured(frame).."</span> "..args.type | local startTextFirstLine = "The <span style=\"font-family: 'Source Code Pro', monospace;\">"..p.getDisplayedNameColoured(frame).."</span> [[HowTo/Functions|"..args.type.."]] is "..(args.type == "event" and "invoked when" or "used to").." " | ||
for i,entry in ipairs(entries) do | for i,entry in ipairs(entries) do | ||
Line 517: | Line 473: | ||
else | else | ||
for i,arg in ipairs(entries) do | for i,arg in ipairs(entries) do | ||
local | local tokens = p.split(arg, ' ') | ||
local isOptional = tokens[1]:sub(1, 1) == '[' | |||
if isOptional then | |||
tokens[1] = tokens[1]:sub(2, tokens[1]:len()) | |||
tokens[4] = tokens[4]:sub(1, tokens[4]:len() - 1) | |||
end | |||
local defaultValue = isOptional and "<span style='font-family: \"Source Code Pro\", monospace;'>"..tokens[4].."</span>" or "n/a" | |||
local description = p.formatDescription(table.concat(tokens, ' ', isOptional and 5 or 3)) | |||
if isEvent then | if isEvent then | ||
rows[i] = { (i + 1)..") ", p.formatType(tokens[1], frame), p.formatName(tokens[2], frame), | rows[i] = { (i + 1)..") ", p.formatType(tokens[1], frame), p.formatName(tokens[2], frame), description } | ||
else | else | ||
rows[i] = { i..") ", p.formatType(tokens[1], frame), p.formatName(tokens[2], frame), (isOptional and ("Optional, defaults to "..defaultValue..". ") or "")..description } | |||
end | end | ||
end | end | ||
Line 1,151: | Line 1,107: | ||
function p.formatName(name, frame) | function p.formatName(name, frame) | ||
return "<span style='font-family: \"Source Code Pro\", monospace; color: "..p.getNameRgb()..";\"'>"..name.."</span>" | return "<span style='font-family: \"Source Code Pro\", monospace; color: "..p.getNameRgb()..";\"'>"..name.."</span>" | ||
end | end | ||
Line 1,172: | Line 1,124: | ||
function p.standardizeNullType(type) | function p.standardizeNullType(type) | ||
type = type:lower() | |||
if | if type == 'void' or type == 'null' or type == 'undefined' or type == 'n/a' then | ||
return 'void' | return 'void' | ||
else | else | ||
Line 1,222: | Line 1,174: | ||
return r, n | return r, n | ||
end | end | ||
edits