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

мНет описания правки
мНет описания правки
Строка 17: Строка 17:
     local size = args["size"] or "32px"
     local size = args["size"] or "32px"


     -- Формирование строки изображения
     -- Формирование строки изображения с проверкой на пустое значение
     local image = ""
     local image
     if args["image"] ~= nil then
     if args["image"] == nil then
         if args["image"] ~= "" then
         image = ""
    else
if args["image"] == "" then
            image = string.format("[[Файл:%s.png|%s]]", id, size)
        else
             image = string.format("[[Файл:%s|%s]]", args["image"], size)
             image = string.format("[[Файл:%s|%s]]", args["image"], size)
        else
            image = ""
         end
         end
    else
        image = string.format("[[Файл:%s.png|%s]]", id, size)
     end
     end


Строка 44: Строка 44:


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


     -- Формирование вывода через LinkCard, если указан обёртка
     -- Формирование вывода через LinkCard, если указан непустой обёртка
     if args["wrapper"] and args["wrapper"] ~= "" then
     if args["wrapper"] and args["wrapper"] ~= "" then
         local pixel = string.match(size, "(%d+)")
         local pixel = string.match(size, "(%d+)")
Строка 62: Строка 62:
             wrapperInfo = label .. prefix
             wrapperInfo = label .. prefix
         end
         end
         local imageParam = ""
 
         if args["image"] ~= nil then
         local imageParam
             if args["image"] ~= "" then
         if args["image"] then
             if args["image"] == "" then
                imageParam = ""
            else
                 imageParam = args["image"]
                 imageParam = args["image"]
            else
                imageParam = ""
             end
             end
         else
         else