Module:Qud look: Difference between revisions

m Undo revision 97777 by Teamtoto (talk)
Tag: Undo
update with modern border image. remove padding arg
 
Line 6: Line 6:
     local args
     local args
local bordercolor
local bordercolor
local padding
local bottomtext
local bottomtext
local linebreaks  
local linebreaks  
Line 22: Line 21:
else
else
linebreaks = false
linebreaks = false
end
--[Determine border color]--
local bordercolorin = frame.args.bordercolor
if bordercolorin == nil then
  bordercolor = ''
elseif bordercolorin == 'c' then
  bordercolor = ''
elseif bordercolorin == 'y' then
  bordercolor='white-border'
else
  error('bordercolor not set to either "c" or "y"',0)
end
end


Line 45: Line 32:
end
end


--[Determine body padding]--
--[Determine img]--
local paddingin = frame.args.padding
local imgin = frame.args.image
if paddingin == nil or paddingin == '' then
if imgin == nil or imgin == '' then
   padding = '0'
   img = ''
else  
else  
   padding = paddingin
   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 colorparse.determinexml(titlein) then
         if titlein == nil or titlein == '' then
            title = colorparse.parse('&amp;y'.. titlein, 'xml')
        title = ''
         else
         else
             title = colorparse.parse('&y'..titlein, 'notxml')
             title = colorparse.parse('&y'..titlein, 'notxml')
Line 76: Line 67:
else
else
             textcontent=colorparse.parse('&y' .. text, 'notxml')
             textcontent=colorparse.parse('&y' .. text, 'notxml')
end
  if colorparse.determinexml(bottomtext) then
            parsedbottomtext=colorparse.parse('&amp;Y'..bottomtext, 'xml')
        else
      parsedbottomtext=colorparse.parse('&Y'..bottomtext, 'notxml')
end
end


Line 88: Line 74:
local html = mw.html.create('div')
local html = mw.html.create('div')
html
html
    :addClass('qud-box-wrapper ' .. bordercolor)
    :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-box')
         :addClass('qud-look-modern-text')
    :node(mw.html.create('div')
        :wikitext(qudtext))
            :addClass('qud-box-header')
    if bottomtext ~= '' then
            :wikitext('<b>' .. title .. '</b>'))
        html
         :node(mw.html.create('div')
         :node(mw.html.create('div')
             :addClass('qud-box-content')
             :addClass('qud-look-modern-status')
            :css({['font-weight']='bold', ['line-height']='1.5em', ['padding']='0em' .. padding .. 'em'})
             :wikitext(bottomtext))
             :wikitext(qudtext))
    end
        :node(mw.html.create('span')
if choices ~= '' then
            :addClass('qud-box-footer-left')
html:node(mw.html.create('div')
            :wikitext(parsedbottomtext)))
:wikitext(choices))
 
end
return tostring(html) .. '\n'
return "<div style='overflow:hidden;'>" .. tostring(html) .. '</div>\n'
end
end


return p
return p