Jump to content

Module:Format title

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Swpb (talk | contribs) at 18:32, 4 November 2015. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}

function p.italic(frame)
	frame = frame or mw.getCurrentFrame()
	local title = frame.args[1]
	local prefix, parentheses = mw.ustring.match(title.text, '^(.+) (%([^%(%)]+%))$')
	local result
	result = string.format("<i>%s</i> %s", prefix, parentheses)
	return result
end

function p.quotes(frame)
	frame = frame or mw.getCurrentFrame()
	local title = frame.args[1]
	local prefix, parentheses = mw.ustring.match(title.text, '^(.+) (%([^%(%)]+%))$')
	local result
	result = string.format("\"%s\" %s", prefix, parentheses)
	return result		
end

function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame, {
		wrappers = 'Template:Format title'
	})
	return p._main(args, frame)
end

return p