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

мНет описания правки
Нет описания правки
Строка 692: Строка 692:
         return ""
         return ""
     end
     end
    local okDp, dp = pcall(require, "Module:GetField")


     local calls = {}
     local calls = {}
Строка 699: Строка 701:
         local parts = { "{{" .. tplPath, "id=" .. id }
         local parts = { "{{" .. tplPath, "id=" .. id }
         if type(obj) == "table" then
         if type(obj) == "table" then
             for k, v in pairs(obj) do
             if okDp and dp and type(dp.flattenParams) == "function" then
                if v ~= nil then
                local extra = dp.flattenParams(obj)
                    parts[#parts + 1] = tostring(k) .. "=" .. tostring(v)
                for i = 1, #extra do
                    parts[#parts + 1] = extra[i]
                end
            else
                for k, v in pairs(obj) do
                    if v ~= nil then
                        parts[#parts + 1] = tostring(k) .. "=" .. tostring(v)
                    end
                 end
                 end
             end
             end
Строка 728: Строка 737:


     local rendered = table.concat(calls, "\n")
     local rendered = table.concat(calls, "\n")
     return frame:preprocess("<nowiki>" .. rendered .. "</nowiki>")
     return frame:preprocess(rendered)
end
end