Mobius Final Fantasy Wiki
Advertisement

Documentation for this module may be created at Module:Quote/doc

--[[
See https://en.wikipedia.org/w/index.php?title=Template:Quote&oldid=854294576
]]
local getArgs = require("Module:Arguments").getArgs
local _error = require("Module:Error")._error

local lorem_ipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

local Quote = {}

function Quote._quote(args)
	local style = args.style
	local text = args.text or args.content or args.quotetext or args.quote or args[1] or (mw.title.equals(mw.title.new("Template:Quote"), mw.title.getCurrentTitle()) and (_error{"Error: No text given for quotation (or equals sign used in the actual argument to an unnamed parameter)"}.."[[Category:Pages incorrectly using the quote template]]") or lorem_ipsum)
	local sign = args.sign or args.cite or args.author or args.by or args.personquoted or args[2]
	local title = args.title or args.publication or args.ts or args.quotesource or args[3]
	local source = args.source or args[4]
	local character = args.char or args.character
	local multiline = args.multiline
	
	local root = mw.html.create("")
	local blockquote = root:tag("blockquote")
		:addClass("templatequote")
		:cssText("overflow:hidden;margin:1em 0;padding:0 40px;")
		:cssText(style)
		:wikitext(text)
	if sign or title or source or character then
		if multiline then
			blockquote:wikitext(frame:preprocess("<nowiki />")):newline()
		end
		local cite = blockquote:tag("div")
			:addClass("templatequotecite")
			:cssText("line-height:1.5em;/* @noflip */text-align:left;/* @noflip */padding-left:1.6em;margin-top:0;")
			:wikitext("—&thinsp;")
			:tag("cite")
		if character then
			cite:wikitext(character..", &#32;")
		end
		local csv = {}
		csv[#csv+1] = sign
		csv[#csv+1] = title
		csv[#csv+1] = source
		cite:wikitext(table.concat(csv, ", "))
	end
	--blockquote:newline() -- Is this absolutely required?
	
	if args.class or args.id or args.diff or args[4] or args[5] then
		root:wikitext("[[Category:Pages incorrectly using the quote template]]")
	end
	return tostring(root)
end

function Quote.quote(frame)
	local args = getArgs(frame, {
		wrappers = "Template:Quote",
	})
	return Quote._quote(args)
end

return Quote
Advertisement