×
Create a new article
Write your page title here:
We currently have 142 articles on The Sonic the Hedgehog Wiki. Type your article name above or click on one of the titles below and start writing!



The Sonic the Hedgehog Wiki
Revision as of 01:23, 26 December 2024 by Sonic City (talk | contribs) (Created page with "local p = {} function p._main(args, frame, title) args = args or {} frame = frame or mw.getCurrentFrame() title = title or mw.title.getCurrentTitle() local italics, italicsAll, lowerCase = false, false, false for k, v in pairs(args) do if type(k) == 'number' then if v == 'kiçik hərf' or v == 'kiçik' then lowerCase = true end if v == 'kursiv' then italics = true italicsAll = false end if v == 'hamısı kursiv' then italicsAll =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Usage[edit source]

{{#invoke:Sandbox|function_name}}



local p = {}

function p._main(args, frame, title)
	args = args or {}
	frame = frame or mw.getCurrentFrame()
	title = title or mw.title.getCurrentTitle()
	
	local italics, italicsAll, lowerCase = false, false, false
	for k, v in pairs(args) do
		if type(k) == 'number' then
			if v == 'kiçik hərf' or v == 'kiçik' then
				lowerCase = true
			end
			if v == 'kursiv' then
				italics = true
				italicsAll = false
			end
			if v == 'hamısı kursiv' then
				italicsAll = true
				italics = false
			end
		end
	end
	
	local result = title.text
	if lowerCase then
		result = mw.language.getContentLanguage():lcfirst(result)
	end
	if italics or italicsAll then
		local prefix, parentheses = mw.ustring.match(result, '^(.+) (%([^%(%)]+%))$')
		if prefix and parentheses and italicsAll == false then
			result = string.format("<i>%s</i> %s", prefix, parentheses)
		else
			result = string.format("<i>%s</i>", result)
		end
	end
	if title.namespace ~= 0 then
		result = title.nsText:gsub('_', ' ') .. ':' .. result
	end
	
	if args['başlıq'] then
		return result
	else
		return frame:callParserFunction('DISPLAYTITLE', result, 'noerror')
	end
end

function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame, {
		wrappers = 'Şablon:Başlıq'
	})
	local title
	if args['başlıq'] then
		title = mw.title.new(args['başlıq'])
	end
	return p._main(args, frame, title)
end

return p