Module:Qud look: Difference between revisions
mNo edit summary |
update with modern border image. remove padding arg |
||
(5 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
local args | local args | ||
local bordercolor | local bordercolor | ||
local bottomtext | local bottomtext | ||
local linebreaks | local linebreaks | ||
Line 22: | Line 21: | ||
else | else | ||
linebreaks = false | linebreaks = false | ||
end | end | ||
Line 41: | Line 28: | ||
--[Determine qud text]-- | --[Determine qud text]-- | ||
local text = frame.args['text'] or "" | local text = frame.args['text'] or "" | ||
if linebreaks then | |||
text = colorparse.linebreaks(text) | |||
end | |||
--[Determine | --[Determine img]-- | ||
local | local imgin = frame.args.image | ||
if | if imgin == nil or imgin == '' then | ||
img = '' | |||
else | else | ||
img = '[[File:' .. imgin .. '|32px]]' | |||
end | end | ||
--[Determine bottomtext]-- | --[Determine bottomtext]-- | ||
local bottomin = frame.args.bottomtext | local bottomin = frame.args.bottomtext | ||
if bottomin == nil or bottomin == '' then | if bottomin == nil or bottomin == '' then | ||
bottomtext = 'Perfect' | bottomtext = '<span style="color:white;">Perfect</span>' | ||
elseif bottomin == 'none' then | elseif bottomin == 'none' then | ||
bottomtext = '' | bottomtext = '' | ||
else | else | ||
bottomtext = bottomin | bottomtext = colorparse.parse('&Y'..bottomin, 'notxml') | ||
end | end | ||
--[Pass choices through]-- | |||
local choices = frame.args.choices | |||
if choices == nil then | |||
choices = '' | |||
end | |||
--[parse color]-- | --[parse color]-- | ||
local title | local title | ||
local textcontent | local textcontent | ||
local parsedbottomtext | local parsedbottomtext | ||
if titlein == nil or titlein == '' then | |||
title = '' | |||
else | |||
title = colorparse.parse('&y'..titlein, 'notxml') | |||
end | |||
if colorparse.determinexml(text) then | |||
textcontent=colorparse.parse('&y' .. text, 'xml') | |||
else | else | ||
textcontent=colorparse.parse('&y' .. text, 'notxml') | |||
end | end | ||
Line 79: | Line 74: | ||
local html = mw.html.create('div') | local html = mw.html.create('div') | ||
html | html | ||
:addClass('qud-look-modern-box') | |||
:node(mw.html.create('div') | |||
:addClass('qud-look-modern-title') | |||
:node(mw.html.create('div') | |||
:wikitext(img)) | |||
:node(mw.html.create('div') | |||
:wikitext(title))) | |||
if title ~= '' then | |||
html:node(mw.html.create('hr')) | |||
end | |||
html | |||
:node(mw.html.create('div') | :node(mw.html.create('div') | ||
:addClass('qud- | :addClass('qud-look-modern-text') | ||
:wikitext(qudtext)) | |||
if bottomtext ~= '' then | |||
html | |||
:node(mw.html.create('div') | :node(mw.html.create('div') | ||
:addClass('qud- | :addClass('qud-look-modern-status') | ||
:wikitext(bottomtext)) | |||
:wikitext( | end | ||
if choices ~= '' then | |||
html:node(mw.html.create('div') | |||
:wikitext(choices)) | |||
end | |||
return tostring(html) .. '\n' | return "<div style='overflow:hidden;'>" .. tostring(html) .. '</div>\n' | ||
end | end | ||
return p | return p |