Module:Quote

-- -- Module:Quote -- -- 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[3] and frame.args[3] ~= '' then speaker = mw.html.create('table') local link = frame.args[3] local text = frame.args[3] if mw.ustring.find(frame.args[1], '\!\!') then link = mw.ustring.sub(frame.args[1], 0, mw.ustring.find(frame.args[3], '\!\!') - 1) text = mw.ustring.sub(frame.args[1], mw.ustring.find(frame.args[3], '\!\!') + 2) end if mw.ustring.find(frame.args[1], '\!\!') then link = mw.ustring.sub(frame.args[2], 0, mw.ustring.find(frame.args[2], '\!\!') - 1) text = mw.ustring.sub(frame.args[2], mw.ustring.find(frame.args[2], '\!\!') + 2) end speaker :attr('class', 'speaker') :cssText(               'border: 1px solid #000;' ..                '-moz-border-radius: 5px 2px 2x 2px;' ..                'border-radius: 0px 0px 5px 5px;' ..                'margin:0 0 -1px 5px'            ) :tag('td') :cssText(                   'line-height: 15px;' ..                    'font-size: small'                ) :wikitext(' ' .. text .. ' ') :done :allDone end quotetext :attr('class', 'quotetext') :cssText(           '-moz-border-radius: 5px;' ..            'border-radius: 5px 0px 5px 5px;' ..            'border: 1px solid #000;' ..            'background: #ffeded;' ..            'color: black'        ) :tag('td') :cssText(               'line-height: 19px;' ..                'padding: 2px'            ) :wikitext(frame.args[1]) :done :allDone if frame.args[2] and frame.args[2] ~= '' 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[2]) :done :allDone end local div = mw.html.create('div') div :attr('class', 'quote') :css('margin', '0 10px 10px 0') if speaker ~= '' then div :node(quotetext) end div :node(speaker, source) if source ~= '' then div :node(source) end return tostring(div) end

return p