Модуль:Infobox: различия между версиями
Перейти к навигации
Перейти к поиску
[отпатрулированная версия] | [отпатрулированная версия] |
Содержимое удалено Содержимое добавлено
Vlsergey (обсуждение | вклад) Перевод строки перед вставкой значения -- для поддержки таблиц в полях |
Перенос строк отдельных тегов таблицы для того, чтобы движок правильно рендерил вики-списки |
||
Строка 6: | Строка 6: | ||
if args[ 'заголовок' ] and args[ 'заголовок' ] ~= '' then |
if args[ 'заголовок' ] and args[ 'заголовок' ] ~= '' then |
||
local style = ( args[ 'стиль_заголовков' ] or '' ) .. ( args[ 'стиль_заголовка' ] or '' ); |
local style = ( args[ 'стиль_заголовков' ] or '' ) .. ( args[ 'стиль_заголовка' ] or '' ); |
||
return '<tr><th colspan="2" style="text-align:center;' .. style .. '">' .. |
return '\n<tr>\n<th colspan="2" style="text-align:center;' .. style .. '">' .. |
||
args[ 'заголовок' ] .. |
args[ 'заголовок' ] .. |
||
'</th></tr>'; |
'</th>\n</tr>'; |
||
end |
end |
||
Строка 47: | Строка 47: | ||
end |
end |
||
return '<tr><th' .. labelClass .. labelStyle .. '>' .. label .. '</th>' .. |
return '\n<tr>\n<th' .. labelClass .. labelStyle .. '>' .. label .. '</th>' .. |
||
'<td' .. class .. style .. '>\n' .. text .. '</td></tr>'; |
'\n<td' .. class .. style .. '>\n' .. text .. '</td>\n</tr>'; |
||
end |
end |
||
return '<tr><td colspan="2"' .. class .. style .. '>\n' .. text .. '</td></tr>'; |
return '\n<tr>\n<td colspan="2"' .. class .. style .. '>\n' .. text .. '</td>\n</tr>'; |
||
end |
end |
||
Версия от 17:29, 14 июня 2018
![]() | Внимание! Это один из самых используемых модулей. |
Используется для реализации средней части шаблона {{Карточка}} (ранее — посредством {{Карточка/строка}}) и шаблона {{Карточка/блок}}.
См. также
- Модуль:Infobox/компонент системы звёзд (временный форк, стоит одновременно обновлять)
local p = {};
function p.renderLine( frame )
local args = frame:getParent().args;
if args[ 'заголовок' ] and args[ 'заголовок' ] ~= '' then
local style = ( args[ 'стиль_заголовков' ] or '' ) .. ( args[ 'стиль_заголовка' ] or '' );
return '\n<tr>\n<th colspan="2" style="text-align:center;' .. style .. '">' ..
args[ 'заголовок' ] ..
'</th>\n</tr>';
end
local text = args[ 'текст' ] or '';
if args[ 'викиданные' ] and args[ 'викиданные' ] ~= '' then
text = frame:expandTemplate{ title = 'Wikidata', args = {
args[ 'викиданные' ],
text,
from = args[ 'from' ] or ''
} };
end
if text ~= '' then
local label = args[ 'метка' ] or '';
local class = args[ 'класс' ] or '';
if class ~= '' then
class = ' class="' .. class .. '"';
end
local style = ( args[ 'стиль_текстов' ] or '' ) .. ( args[ 'стиль_текста' ] or '' );
if label == '' then
style = 'text-align:center;' .. style;
end
if style ~= '' then
style = ' style="' .. style .. '"';
end
if label ~= '' then
local labelClass = args[ 'класс_меток' ] or '';
if labelClass ~= '' then
labelClass = ' class="' .. labelClass .. '"';
end
local labelStyle = ( args[ 'стиль_меток' ] or '' ) .. ( args[ 'стиль_метки' ] or '' );
if labelStyle ~= '' then
labelStyle = ' style="' .. labelStyle .. '"';
end
return '\n<tr>\n<th' .. labelClass .. labelStyle .. '>' .. label .. '</th>' ..
'\n<td' .. class .. style .. '>\n' .. text .. '</td>\n</tr>';
end
return '\n<tr>\n<td colspan="2"' .. class .. style .. '>\n' .. text .. '</td>\n</tr>';
end
return '';
end
return p;