Module:Quote

-- -- Module:Quote3 -- -- Used to generate game-like textboxes for quoting -- Does not work when invoked directly -- See Template:Quote3 for usage -- -- authors: User:Slyst

local p = {}

function p.quote(frame) frame = frame:getParent local speaker = '' local quotetext = mw.html.create('table') local source = '' if frame.args[1] and frame.args[1] ~= '' then speaker = mw.html.create('table') local link = frame.args[1] local text = frame.args[1] if mw.ustring.find(frame.args[1], '\!\!') then link = mw.ustring.sub(frame.args[1], 0, mw.ustring.find(frame.args[1], '\!\!') - 1) text = mw.ustring.sub(frame.args[1], mw.ustring.find(frame.args[1], '\!\!') + 2) end speaker :attr('class', 'speaker') :cssText(               'border: 1px solid #000;' ..                '-moz-border-radius: 5px 5px 0 0;' ..                'border-radius: 5px 5px 0 0;' ..                'background: rgba(0, 0, 200, .8);' ..                'margin:0 0 -1px 5px'            ) :tag('td') :cssText(                   'line-height: 15px;' ..                    'font-size: 1em'                ) :wikitext(' ' .. text .. ' ') :done :allDone end quotetext :attr('class', 'quotetext') :cssText(           '-moz-border-radius: 5px;' ..            'border-radius: 5px;' ..            'border: 1px solid #000;' ..            'background: rgba(0, 0, 0, .8);' ..            'color: #fff'        ) :tag('td') :cssText(               'line-height: 19px;' ..                'padding: 2px'            ) :wikitext(frame.args[2]) :done :allDone if frame.args[3] and frame.args[3] ~= '' then source = mw.html.create('div') source :attr('class', 'source') :cssText(               'margin: 5px 0 0 10px;' ..                'font-size: small'            ) :wikitext('&mdash; ') :tag('cite') :wikitext(frame.args[3]) :done :allDone end local div = mw.html.create('div') div :attr('class', 'quote') :css('margin', '0 10px 10px 0') if speaker ~= '' then div :node(speaker) end div :node(quotetext) if source ~= '' then div :node(source) end return tostring(div) end

return p