Module:TempScriptItem: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 517: Line 517:
else
else
for i,arg in ipairs(entries) do
for i,arg in ipairs(entries) do
local tokens = p.split(arg, ' ')
local parts = p.getArgParts(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), description }
rows[i] = { (i + 1)..") ", p.formatType(tokens[1], frame), p.formatName(tokens[2], frame), p.formatDescription(parts.description) }
else
else
rows[i] = { i..") ", p.formatType(tokens[1], frame), p.formatName(tokens[2], frame), (isOptional and ("Optional, defaults to "..defaultValue..". ") or "")..description }
if parts.optional then
if parts.defaultValueIsSpecified then
rows[i] = { i..") ", p.formatType(parts.type, frame), p.formatName(parts.name, frame), "Optional, defaults to "..p.formatDefaultValue(parts.defaultValue)..". "..p.formatDescription(parts.description) }
else
rows[i] = { i..") ", p.formatType(parts.type, frame), p.formatName(parts.name, frame), "Optional, the default value has not been documented here yet. "..p.formatDescription(parts.description) }
end
else
rows[i] = { i..") ", p.formatType(parts.type, frame), p.formatName(parts.name, frame), p.formatDescription(parts.description) }
end
end
end
end
end
Line 1,151: Line 1,151:
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
function p.formatDefaultValue(value, frame)
return "<span style='font-family: \"Source Code Pro\", monospace; color: "..p.getNameRgb()..";\"'>"..value.."</span>"
end
end


6,834

edits