2734
правки
Изменения
local modData = modIds[mod]
if not modData and mw.title.new('Модуль:ИнвСпрайт/' .. mod .. '/ID').exists then
modData = mw.loadData('Модуль:ИнвСпрайт/' .. mod .. '/ID')["IDы"]
modIds[mod] = modData
end
end
local plainTitle
if title == '' then
local formatPattern = '&[0-9a-fk-or]'
if mw.ustring.match(plainTitle, formatPattern) then
plainTitle = mw.ustring.gsub(plainTitle, formatPattern, '')
end
elseif link then
if img then
else
plainTitle = ''
end
item:attr{
['data-minetip-title'] = formattedTitle,
['data-minetip-text'] = description
}
if img then
-- & is re-escaped because mw.html treats attributes
-- as plain text, but MediaWiki doesn't
local escapedTitle = mw.ustring.gsub((plainTitle or ''), :gsub( '&', '&')
item:addClass('invslot-item-image')
:wikitext('[[Файл:Grid ', img, '.png|32x32px|link=', link or '', '|', escapedTitle, ']]')
item:wikitext('[[', link, '|')
end
local image, spriteCat; if not mod then image, spriteCat = sprite{ ["данныеID"] = idData, ["назв"] = plainTitle, ["изобр"] = image, ["настройки"] = 'ИнвСпрайт' } else image, spriteCat = sprite{ ["данныеID"] = idData, ["назв"] = plainTitle, ["изобр"] = image, ["настройки"] = 'ИнвСпрайт/' .. mod } end
item:node(image)
category = spriteCat
return table.concat(expandedFrames, ';')
end
function p.getParts(frame, mod)
parts.title = mw.ustring.match(frame, '^%[%s*([^%]]+)%s*%]')
local modPattern if mw.ustring.match(frame, '^%[.*%]([a-zA-Zа-яА-Я0-9 _-]+):') then modPattern = '^%[.*%]([a-zA-Zа-яА-Я0-9 _-]+):' else modPattern = '^([a-zA-Zа-яА-Я0-9 _-]+):' end parts.mod = mw.text.trim(mw.ustring.match(frame, '([^:%]]+):'modPattern) or mod or '')
local vanilla = {v = 1, vanilla = 1, mc = 1, minecraft = 1}
parts.mod = nil
end
if nameStart - 1 == #frame then
nameStart = 1
end
parts.name = mw.text.trim(mw.ustring.sub(frame, nameStart, (mw.ustring.find(frame, '[,%[]', nameStart) or 0) - 1))
parts.num = math.floor(mw.ustring.match(frame, ',%s*(%d+)') or 0)