Нет описания правки |
(дополнения к комментариям) |
||
Строка 23: | Строка 23: | ||
local n = 0; |
local n = 0; |
||
while args[i] ~= 'end' do |
while args[i] ~= 'end' do |
||
− | -- добавляет название |
+ | -- добавляет название и иконку аспекта и всплывающий текст |
table.insert(out, temp1 .. args[i] .. temp2 .. args[i] .. temp3 .. args[i + 1] .. '\">' .. args[i] .. '</span>') |
table.insert(out, temp1 .. args[i] .. temp2 .. args[i] .. temp3 .. args[i + 1] .. '\">' .. args[i] .. '</span>') |
||
Строка 85: | Строка 85: | ||
n = n + 1; |
n = n + 1; |
||
+ | -- делит аспекты на 3 столбца |
||
if n == 3 then |
if n == 3 then |
||
table.insert(out, '\n|-\n'); |
table.insert(out, '\n|-\n'); |
Версия от 12:34, 12 мая 2019
local p = {};
function p.list(f)
local args = f;
if f == mw.getCurrentFrame() then
args = f:getParent().args;
else
f = mw.getCurrentFrame();
end;
local slot = require('Модуль:Инвентарный слот').slot;
local out = {"{|class=\"invslot-plain\""};
local temp1 = "\n|valign=\"top\"|\n<span id=\"";
local temp2 = "\">\n{|class=\"wikitable collapsible collapsed\" style=\"margin: 0px\"\n!width=250px style=\"text-align: left\"|{{ИнвСпрайт/Thaumcraft 3|";
local temp3 = "}} <span class=\"explain tooltip\" title=\"";
local notDelimiter = function(arg)
return (arg ~= '-\n') and (arg ~= '') and (arg ~= '+');
end;
local i = 1;
local n = 0;
while args[i] ~= 'end' do
-- добавляет название и иконку аспекта и всплывающий текст
table.insert(out, temp1 .. args[i] .. temp2 .. args[i] .. temp3 .. args[i + 1] .. '\">' .. args[i] .. '</span>')
i = i + 3;
while args[i] ~= '-\n' do
table.insert(out, '\n|-\n|' .. args[i] .. '×');
i = i + 1;
-- добавляет иконки
table.insert(out, slot({args[i]}));
local text = args[i]
local m = 1;
if notDelimiter(args[i + 1]) then
m = 2;
table.insert(out, slot({args[i + 1]}));
if notDelimiter(args[i + 2]) then
m = 3;
table.insert(out, slot({args[i + 2]}));
if notDelimiter(args[i + 3]) then
m = 4;
table.insert(out, slot({args[i + 3]}));
if notDelimiter(args[i + 4]) then
m = 5;
table.insert(out, slot({args[i + 4]}));
if notDelimiter(args[i + 5]) then
m = 6;
table.insert(out, slot({args[i + 5]}));
end;
end;
end;
end;
end;
-- добавляет текст
if args[i + m] == '' then
i = i + m + 1;
text = args[i];
else
local at, r = string.find(text, ':');
if at ~= nil then
if string.sub(text, 1, at - 1) == 'thaum3' then
-- относительная ссылка
text = '[[../' .. string.sub(text, at + 1) .. '/]]';
end;
else
text = '[[' .. text .. ']]';
end;
if args[i + 1] == '+' then
i = i + 2;
text = text .. ' ' .. args[i];
end;
end;
i = i + 2;
table.insert(out, ' ' .. text);
end;
table.insert(out, '\n|}');
i = i + 1;
n = n + 1;
-- делит аспекты на 3 столбца
if n == 3 then
table.insert(out, '\n|-\n');
n = 0;
end;
end;
table.insert(out, '\n|}');
return table.concat(out);
end;
return p;