Модуль:Новости
Материал из AbduloverA.com
Для документации этого модуля может быть создана страница Модуль:Новости/doc
local p = {}
local str_p = ""
local index = 2;
function p.render_once(frame, index)
mw.log(index);
local pageName = "Шаблон:Новости"
local content = mw.title.new(pageName):getContent()
if not content then
return "Страница не найдена или пуста."
end
local rows = {}
for row in content:gmatch("{{Новость|date[^}}]+}}", "%a+") do
table.insert(rows, row)
end
-- Вывод первых 5 строк
local result = {}
for i = 1, math.min(5, #rows) do
table.insert(result, rows[index])
str_p = rows[index];
-- str_p = str_p .. "\n"
-- mw.log(str_p);
-- mw.log(rows[i]);
end
-- return table.concat(result)
mw.log(str_p)
return str_p
end
return p