Module:Quote

-- local p = {} local getArgs = require('Dev:Arguments').getArgs

function p.main(frame) local args = getArgs(frame) local quotetext = args.quote or args[1] local person = args.speaker or args[2] local source = args.source or args[3] local quotecontents = mw.html.create('p') :addClass('pull-quote__text') :wikitext(quotetext) local quotesource = person if person and source then quotesource = person .. ', ' .. source elseif source then quotesource = source end return p.build(quotecontents, quotesource, options) end

function p.build(quotecontents, quotesource, options) local quotecontainer = mw.html.create('blockquote') :addClass('pull-quote') quotecontainer:node(quotecontents) if quotesource then quotecontainer:tag('div') :wikitext('—' .. quotesource) :done end return quotecontainer end

function p.dialogue(frame) local args = getArgs(frame) local options = options(args) local quotecontents = mw.html.create('div') :addClass('pull-quote__text') local quotesource

for i, v in ipairs(args) do       local next_param = i + 1 if i % 2 ~= 0 then quotecontents:tag('div') :addClass('pull-quote__line') :tag('strong') :addClass('pull-quote__speaker') :wikitext(v .. ':') :done :wikitext(' ' .. args[next_param]) :done end end local context = i18n:parameter('context', args) local source = i18n:parameter('source', args) if context and source then quotesource = context .. ', ' .. source elseif context and not source then quotesource = context elseif source and not context then quotesource = source end return build(quotecontents, quotesource, options) end

return p