Открыть меню
Открыть персональное меню
Вы не представились системе
Your IP address will be publicly visible if you make any edits.

Модуль:Link

Материал из Create Wiki

Для документации этого модуля может быть создана страница Модуль:Link/doc

local p = {}

local vanillaPages = mw.loadData('Module:Link/VanillaPages')

function p.mcWikiLink (f)
	local origArgs = f
	if f == mw.getCurrentFrame() then
		origArgs = f:getParent().args
	else
		f = mw.getCurrentFrame()
	end
	local args = {}
	for k,v in pairs(origArgs) do
		if type(k) == "string" then k = k:lower() end
		args[k] = v
	end
	
	local link = args[1]
	local alt = args[2] or link
	
	if vanillaPages[link] then return table.concat{'[[', link, '|', alt, ']]'} end
	if not link then return '[https://ru.mine'..'craft.wiki <span title="Minecraft Wiki">Minecraft Wiki</span>]' end
	return table.concat{
		'[https://ru.mine'..'craft.wiki/w/', string.gsub(link, " ", "_"), ' <span title="Minecraft Wiki: ', link, '">', alt, '</span>]'
	}
end
function p.githubLink (f)
	local origArgs = f
	if f == mw.getCurrentFrame() then
		origArgs = f:getParent().args
	else
		f = mw.getCurrentFrame()
	end
	local args = {}
	for k,v in pairs(origArgs) do
		if type(k) == "string" then k = k:lower() end
		args[k] = v
	end
	
	local link = args[1]
	local alt = args[2] or link
	
	if not link then return '[https://github.com/Creators-of-Create/Create/wiki/ <span title="Github Wiki">Github Wiki</span>]' end
	return table.concat{
		'[https://github.com/Creators-of-Create/Create/wiki/', string.gsub(link, " ", "-"), ' ', alt, ']'
	}
end
return p
Сайт использует Cookie для нормальной работы