Модуль:Предмет: различия между версиями

мНет описания правки
мНет описания правки
Строка 16: Строка 16:


     local prefix = args[2] or ""
     local prefix = args[2] or ""
    local label = args["label"] or itemName
     local size = args["size"] or "32px"
     local size = args["size"] or "32px"


Строка 35: Строка 34:
     local image
     local image
     if input_image == nil then
     if input_image == nil then
         image = ""
         image = string.format("[[Файл:%s.png|%s]]", id, size)
     else
     else
if input_image == "" then
if input_image == "" then
             image = string.format("[[Файл:%s.png|%s]]", id, size)
             image = ""
         else
         else
             image = string.format("[[Файл:%s|%s]]", input_image, size)
             image = string.format("[[Файл:%s|%s]]", input_image, size)
Строка 59: Строка 58:


     -- Сбор информации в зависимости от наличия репозитория
     -- Сбор информации в зависимости от наличия репозитория
     local additionalInfo = args["repository"]
     local input_repository = argsWithWhitespace.repository
     if additionalInfo == nil then
    local repository
         additionalInfo = itemStack .. " " .. labelOutput .. " " .. itemContained .. " " .. itemSlot .. " " .. itemChem
     if input_repository == nil then
         repository = prefix .. " " .. labelOutput
     else
     else
        additionalInfo = prefix .. " " .. labelOutput
repository = itemStack .. " " .. labelOutput .. " " .. itemContained .. " " .. itemSlot .. " " .. itemChem
     end
     end


     local result = image .. " " .. additionalInfo
     local result = image .. " " .. repository


     -- Формирование вывода через LinkCard, если указан непустой обёртка
     -- Формирование вывода через LinkCard, если указан непустой обёртка
Строка 72: Строка 72:
         local pixel = string.match(size, "(%d+)")
         local pixel = string.match(size, "(%d+)")
         local wrapperInfo
         local wrapperInfo
         if args["repository"] then
         if input_repository == nil then
            wrapperInfo = label .. prefix
        else
             wrapperInfo = label .. itemStack .. " " .. itemContained .. " " .. itemSlot .. " " .. itemChem
             wrapperInfo = label .. itemStack .. " " .. itemContained .. " " .. itemSlot .. " " .. itemChem
        else
            wrapperInfo = label .. prefix
         end
         end