Module:GetRandomCreature: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 9: | Line 9: | ||
--[Determine border color]-- | --[Determine border color]-- | ||
local bordercolorin = frame.args | local bordercolorin = frame.args.bordercolor | ||
if bordercolorin == nil or bordercolorin == 'c' then | if bordercolorin == nil or bordercolorin == 'c' then | ||
bordercolor = '' | bordercolor = '' | ||
Line 19: | Line 19: | ||
--[Determine Title Color]-- | --[Determine Title Color]-- | ||
local titlein= frame.args | local titlein= frame.args.title | ||
local title = colorparse.parse('&y'.. titlein) | local title = colorparse.parse('&y'.. titlein) | ||
Line 27: | Line 27: | ||
--[Determine body padding]-- | --[Determine body padding]-- | ||
local paddingin = frame.args | local paddingin = frame.args.padding | ||
if paddingin == nil or paddingin == '' then | if paddingin == nil or paddingin == '' then | ||
padding = '1.5' | padding = '1.5' | ||
Line 35: | Line 35: | ||
--[Determine bottomtext]-- | --[Determine bottomtext]-- | ||
local bottomin = frame.args | local bottomin = frame.args.bottomtext | ||
if bottomin == nil or bottomin == '' then | if bottomin == nil or bottomin == '' then | ||
bottomtext= 'Perfect' | bottomtext= 'Perfect' |
Revision as of 22:24, 8 August 2019
Documentation for this module may be created at Module:GetRandomCreature/doc
local p = {}
local colorparse = require'Module:ColorParse'
function p.qudlook(frame)
local bordercolor
local padding
local bottomtext
--[Determine border color]--
local bordercolorin = frame.args.bordercolor
if bordercolorin == nil or bordercolorin == 'c' then
bordercolor = ''
elseif bordercolorin == 'y' then
bordercolor='white-border'
else
error('bordercolor not set to either "c" or "y"',0)
end
--[Determine Title Color]--
local titlein= frame.args.title
local title = colorparse.parse('&y'.. titlein)
--[Determine qud text]--
local text = frame.args['text']
local qudtext = frame:extensionTag{ name='poem', content=colorparse.parse('&y' .. text) }
--[Determine body padding]--
local paddingin = frame.args.padding
if paddingin == nil or paddingin == '' then
padding = '1.5'
else
padding = paddingin
end
--[Determine bottomtext]--
local bottomin = frame.args.bottomtext
if bottomin == nil or bottomin == '' then
bottomtext= 'Perfect'
elseif bottomin == 'none' then
bottomtext= ''
else
bottomtext= bottomin
end
local parsedbottomtext=colorparse.parse('&Y'..bottomtext)
--[Return html]--
local html = {
'<div class="qud-box-wrapper' ..bordercolor..'">',
'<div class="qud-box">',
'<span class="qud-box-header"><b>' .. title .. '</b></span>',
'<div class="qud-box-content" style="font-weight:bold; line-height:1.5em; padding:0em '..padding..'em;">'..qudtext..'</div>',
'<span class="qud-box-footer-left">'..parsedbottomtext..'</span></div></div>'
}
return html .. '\n'
end
return p