Module:Sandbox/DarthKitty/Quote

--

-- Script for Template:Quote.

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

-- Describe the following function here.

function p.builder(text, source) checkType('Module:Quote.builder', 1, text, 'string') checkType('Module:Quote.builder', 2, source, 'string')

local quote = mw.html.create('blockquote'):addClass('template-quote')

-- manually parse wikitext to improve HTML output for paragraph in mw.text.gsplit(text, '\n\n') do       quote:tag('p'):wikitext(paragraph) end

quote:tag('cite'):wikitext(source)

return tostring(quote) end

-- Describe the following function here.

function p.main(frame) local args = getArgs(frame) local text = args.text or args[1] or '' local source = args.source or args[2] or 'In-game description'

return p.builder(text, source) end

return p

-- --