Модуль:ChemTable
Для документации этого модуля может быть создана страница Модуль:ChemTable/doc
local p = {}
function p.main(frame)
local args = frame:getParent().args
-- Создаём таблицу с данными
local chemData = {
name = args['название'] or 'Неизвестно',
reagent = args['reagent'] or '',
color = args['цвет'] or '#000000',
description = args['описание'] or 'Описание отсутствует',
metabolize = args['метаболизм'] or 'Нет',
overdose = args['передозировка'] or '-',
addiction = args['зависимость'] or '-',
recipe = args['рецепт'] or 'Неизвестен'
}
-- Генерируем HTML-вывод
local output = string.format([[
<div style="border: 1px solid #ddd; padding: 10px; margin: 5px; background: white;">
<div style="display: flex; align-items: center;">
<div style="width: 20px; height: 20px; background: %s; margin-right: 10px; border: 1px solid #000;"></div>
<h3 style="margin: 0;">%s</h3>
<small style="margin-left: 10px; color: #666;">%s</small>
</div>
<p><strong>Описание:</strong> %s</p>
<p><strong>Метаболизм:</strong> %s</p>
<p><strong>Передозировка:</strong> %s</p>
<p><strong>Зависимость:</strong> %s</p>
<p><strong>Рецепт:</strong><br>%s</p>
</div>
]],
chemData.color, chemData.name, chemData.reagent, chemData.description,
chemData.metabolize, chemData.overdose, chemData.addiction, chemData.recipe)
return output
end
return p