Мазмунга өтүү

Модуль:тилке

Wiktionary долбоорунан

Documentation for this module may be created at Модуль:тилке/doc

local p = {}

function p.create(frame)
    local args = frame:getParent().args
    local items = {}

    -- Аргументтерди тизмеге чогултабыз
    for i, v in ipairs(args) do
        if v and v ~= "" then
            local text = v
            -- Шилтемеси жок болсо, шилтеме жасайбыз
            if not mw.ustring.find(text, "%[%[") then
                text = "[[" .. text .. "]]"
            end
            
            -- Ар бир саптын дизайны (чекиттер жана жылдыруу)
            local li_style = "break-inside: avoid-column; page-break-inside: avoid; list-style-type: none; position: relative; padding-left: 1.2em; margin-bottom: 2px;"
            local bullet_style = "position: absolute; left: 0; color: #aaa;"
            
            -- HTML тизме элементин түзүү
            table.insert(items, '<li style="' .. li_style .. '"><span style="' .. bullet_style .. '">•</span> ' .. text .. '</li>')
        end
    end

    if #items == 0 then
        return ""
    end

    -- Негизги блоктун дизайны (Колонкалар ушул жерде аныкталат)
    -- column-width: 15em -> экран кенен болсо 3-4 колонка, тар болсо 1-2 болот.
    local div_style = "column-width: 15em; column-gap: 20px; -moz-column-width: 15em; -webkit-column-width: 15em; margin-top: 10px;"
    
    local result = '<div style="' .. div_style .. '"><ul style="margin: 0; padding: 0; list-style: none;">'
    result = result .. table.concat(items, "\n")
    result = result .. '</ul></div>'

    return result
end

return p