"मोड्युल:Italic title" का संशोधनहरू बिचको अन्तर

विकिपिडिया, एक स्वतन्त्र विश्वकोशबाट
Content deleted Content added
allow this to be called from Lua, and make it more compact
imported>Izkala
Use <i> to italicise apostrophes, per ER
पङ्क्ति १०: पङ्क्ति १०:
local result
local result
if prefix and parentheses and args.all ~= 'yes' then
if prefix and parentheses and args.all ~= 'yes' then
result = string.format("''%s'' %s", prefix, parentheses)
result = string.format("<i>%s</i> %s", prefix, parentheses)
else
else
result = string.format("''%s''", title.text)
result = string.format("<i>%s</i>", title.text)
end
end
if title.namespace ~= 0 then
if title.namespace ~= 0 then

२३:४२, ३० जुलाई २०१५ जस्तै गरी पुनरावलोकन

-- 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)
	else
		result = string.format("<i>%s</i>", title.text)
	end
	if title.namespace ~= 0 then
		result = title.nsText .. ':' .. result
	end
	return frame:callParserFunction('DISPLAYTITLE', result, args[1])
end

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

return p