Модуль:gases
| Строка 95: | Строка 95: | ||
end | end | ||
return table.concat(lines, "<br>") | return table.concat(lines, "<br>") | ||
end | |||
local function getProperties(gasPrototype) | |||
return table.concat({ | |||
"Теплоёмкость: " .. tostring(gasPrototype.specificHeat) .. " Дж/(моль·K)", | |||
"Адиабата: " .. tostring(gasPrototype.heatCapacityRatio), | |||
"Масса: " .. tostring(gasPrototype.molarMass) .. " г/моль", | |||
"Цена: " .. tostring(gasPrototype.pricePerMole) .. " за моль", | |||
}, "<br>") | |||
end | |||
local function getCollapsedEffects(gasPrototype) | |||
local effects = getEffects(gasPrototype) | |||
if effects == "" then | |||
return "" | |||
end | |||
return '<div class="mw-collapsible mw-collapsed" data-expandtext="Показать" data-collapsetext="Скрыть">Эффекты при вдыхании' .. '<div class="mw-collapsible-content">' .. effects .. '\n</div></div>' | |||
end | end | ||
| Строка 107: | Строка 124: | ||
end | end | ||
out = out .. '{| class="wikitable sortable" style="width: 100%; | out = out .. '{| class="wikitable sortable" style="width: 100%; table-layout: fixed; overflow-wrap: anywhere; font-size: 90%;"' | ||
out = out .. | out = out .. '\n! style="width: 13%;" | Газ !! style="width: 24%;" | Описание !! style="width: 21%;" | Свойства !! style="width: 17%;" | Получение !! style="width: 25%;" | Эффекты' | ||
local additional = frame.args.additional | local additional = frame.args.additional | ||
| Строка 135: | Строка 152: | ||
local textColor = gasPrototype.textColor or "#FFFFFF" | local textColor = gasPrototype.textColor or "#FFFFFF" | ||
out = out .. '\n|- id="gas_' .. gasId | out = out .. '\n|- id="gas_' .. gasId .. '"' | ||
out = out .. '\n! scope="row" style=" | out = out .. '\n! scope="row" style="background: ' .. color .. '; color: ' .. textColor .. ';" | ' .. gasPrototype.name .. '<br><small>' .. gasPrototype.abbreviation .. '</small>' | ||
out = out .. '\n| ' .. gasPrototype.desc | |||
out = out .. '\n| ' .. getProperties(gasPrototype) | |||
out = out .. '\n| ' .. getRecipes(gasId) | |||
out = out .. '\n| ' .. getCollapsedEffects(gasPrototype) | |||
out = out .. '\n| ' .. | |||
out = out .. '\n| ' .. | |||
out = out .. '\n | |||
out = out .. '\n | |||
return out | return out | ||
| Строка 150: | Строка 163: | ||
function p.reactionTable(frame) | function p.reactionTable(frame) | ||
local out = '{| class="wikitable sortable" style="width: 100%;"' | local out = '{| class="wikitable sortable" style="width: 100%; table-layout: fixed; overflow-wrap: anywhere; font-size: 90%;"' | ||
out = out .. | out = out .. '\n! style="width: 15%;" | Реакция !! style="width: 20%;" | Условия !! style="width: 18%;" | Расходуется !! style="width: 17%;" | Получается !! style="width: 30%;" | Примечания' | ||
for _, reaction in ipairs(sortedReactions()) do | for _, reaction in ipairs(sortedReactions()) do | ||