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:22, 4 November 2015 (Created page with 'local p = {} function p.italic(frame) local title = frame.args[1] local prefix, parentheses = mw.ustring.match(title.text, '^(.+) (%([^%(%)]+%))$') local res...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {}

function p.italic(frame)
	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)
	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