Модуль:КУрез

Материал из Википедии — свободной энциклопедии
Перейти к навигации Перейти к поиску
Документация

Модуль для формирования списка обсуждений К удалению на странице ВП:Ы.

return {
    ["КУ"] = function(f)
        local ku,res,ru,wt = mw.title.new('К удалению',4):getContent(),{},mw.getLanguage('ru'),require('Module:Wikitext');
        for ymd,al in ku:gmatch("{{%s*Удаление статей%s*|%s*(%d+%-%d+%-%d+)%s*|%s*(.-)}}") do
            local hd,cr,sec,cls=ru:formatDate("j xg Y",ymd),{};
            table.insert(res,('==[[ВП:К удалению/%s|%s]]=='):format(hd,hd));
            for nom in mw.text.gsplit(al," • ",true) do
                if nom == 'Закрытые обсуждения' then break end;
                sec = sec or nom:sub(1,7)=="<small>"
                if sec then
                    sec = nom:sub(-8,-1)~="</small>"
                    if cls then
                        table.insert(cr,nom)
                    end
                else
                    cls = nom:sub(1,3)~='<s>'
                    if cls then table.insert(cr,("%s&nbsp;[[ВП:К удалению/%s#%s|↑]]"):format(nom,hd,wt.Delink(nom):gsub("^:","",1))) end
                end
            end
            table.insert(res,table.concat(cr," • "))
        end
        return table.concat(res,"\n")
    end
}