| 🌟 | 現在、 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
モジュール:Utility/mw.html Extensions
ナビゲーションに移動
検索に移動
このモジュールについての説明文ページを モジュール:Utility/mw.html Extensions/doc に作成できます
local p = {}
local mwHtml = getmetatable(mw.html.create()).__index -- Trick to get acces to the mw.html class
local function wikitext(builder, text)
if text == nil then
return builder
end
local typename = type(text)
if typename == 'table' then
for _, value in ipairs(text) do
if value == nil then
break
end
builder = builder:wikitext(text)
end
return builder
elseif typename == 'function' then
return wikitext(builder, text())
else
return builder:wikitext(text)
end
end
function mwHtml:wikitextIf(cond, thentext, elsetext)
if cond then
return wikitext(self, thentext)
else
return wikitext(self, elsetext)
end
end
local function addClass(builder, class)
if class ~= nil then
return builder:addClass(class)
else
return builder
end
end
function mwHtml:addClassIf(cond, thenclass, elseclass)
if cond then
return addClass(self, thenclass)
else
return addClass(self, elseclass)
end
end
local function attr(builder, attr)
if attr == nil then
return builder
end
local typename = type(attr)
if typename == 'table' then
return builder:attr(attr)
elseif typename == 'function' then
return attr(builder, attr())
else
return builder
end
end
function mwHtml:attrIf(cond, thenattr, elseattr)
if cond then
return attr(self, thenattr)
else
return attr(self, elseattr)
end
end
local function css(builder, css)
if css == nil then
return builder
end
local typename = type(css)
if typename == 'table' then
return builder:css(css)
elseif typename == 'function' then
return css(builder, css())
else
return builder
end
end
function mwHtml:cssIf(cond, thencss, elsecss)
if cond then
return css(self, thencss)
else
return css(self, elsecss)
end
end
return p