Модуль:TagsList: различия между версиями
Материал из Eco - Русская Wiki
[досмотренная версия] | [досмотренная версия] |
Avaren (обсуждение | вклад) (Port module from EN) |
StalEF (обсуждение | вклад) м (Защитил страницу Модуль:TagsList ([Редактирование=Разрешено только администраторам] (бессрочно) [Переименование=Разрешено только администраторам] (бессрочно))) |
(нет различий)
|
Текущая версия от 13:03, 21 февраля 2021
Для документации этого модуля может быть создана страница Модуль:TagsList/doc
-- Credit: Original SkillList was created by Fyre (FishAus) then edited by Scotty (ZeelNightwolf) and used as a base for tagsList.
local p = {}
local Utils = require('Module:Utils')
-- Main entry point for the Module
function p.main(frame)
-- get args from the Template
local args = Utils.normaliseArgs(frame)
if args.list == nil or args.list == '' then
return '\'list\' must be specified.'
end
-- assign variables for list
local list = args.list
-- load lists
local itemData = require("Module:ItemData")
local tagsList = ''
--Check Passes
if list ~= 'tags' then
return tagsList .. ' Incorrect use of pass. '
end
local a = {}
--Tags List
if list == 'tags' then
tagsList = tagsList .. '=== Tags List ===\n'
tagsList = tagsList .. '<div style=\"column-count:3;-moz-column-count:3;-webkit-column-count:3\">\n'
for k, v in pairs(itemData.tags) do
if itemData.tags[k] ~= nil then
table.insert(a, k)
end
end
table.sort(a)
for i, n in ipairs(a) do
tagsList = tagsList .. '* [[' .. n .. 'Тег|' .. n .. ']]\n'
end
tagsList = tagsList .. '</div>'
end
return tagsList
end
return p