「モジュール:Icon」の版間の差分

提供:TAIchannelWiki
ja>Rxy
(「モジュール:Icon」を保護しました: 影響が特に大きいテンプレート: 現時点で 15333 ページからの読み込み ([編集=管理者のみに許可] (無期限) [移動=管理者のみに許可] (無期限)))
 
(1版 をインポートしました)
 
(相違点なし)

2024年5月19日 (日) 15:25時点における最新版

このモジュールについての説明文ページを モジュール:Icon/doc に作成できます

-- This module implements [[Template:Icon]].

local data = mw.loadData('Module:Icon/data')

local p = {}

function p._main(args)
	local code = args.class or args[1] or args['クラス']
	local iconData
	if code then
		code = code:match('^%s*(.-)%s*$'):lower() -- trim whitespace and put in lower case
		iconData = data[code]
	end
	if not iconData then
		iconData = data._DEFAULT
	end
	return string.format(
		'[[File:%s%s|%s]]',
		iconData.image,
		iconData.tooltip and '|' .. iconData.tooltip or '',
		args.size or '16x16px'
	)
end

function p.main(frame)
	local args = {}
	for k, v in pairs(frame:getParent().args) do
		args[k] = v
	end
	return p._main(args)
end

return p
Cookieは私達のサービスを提供するのに役立ちます。このサービスを使用することにより、お客様はCookieの使用に同意するものとします。