Module:Quote

-- This Module is used for making templates based in the Lua language. -- See more details about Lua in w:Help:Lua. -- The Fandom Developer's Wiki hosts Global Lua Modules that can be imported and locally overridden. -- The next line imports the Quote module from the w:c:dev:Global Lua Modules. --local Quote = require('Dev:Quote') -- See more details about this module at w:c:dev:Global_Lua_Modules/Quote

-- The last line produces the output for the template --return Quote

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