Permanently protected module

Module:Italic title

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Documentation icon Module documentation[view] [edit] [history] [purge]

This is a Lua implementation of {{italic title}}. Please see the template page for documentation.

-- This module implements {{italic title}}.

local p = {}

function p._main(args, frame, title)
	args = args or {}
	frame = frame or mw.getCurrentFrame()
	title = title or mw.title.getCurrentTitle()
	local prefix, parentheses = mw.ustring.match(title.text, '^(.+) (%([^%(%)]+%))$')
	local result
	if prefix and parentheses and args.all ~= 'yes' then
		result = string.format("<i>%s</i> %s", prefix, parentheses)
		result = string.format("<i>%s</i>", title.text)
	if title.namespace ~= 0 then
		result = title.nsText .. ':' .. result
	return frame:callParserFunction('DISPLAYTITLE', result, args[1])

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

return p