|
Метки: очистка ручная отмена |
| (не показано 36 промежуточных версий этого же участника) |
| Строка 1: |
Строка 1: |
| local p = {}
| |
|
| |
|
| function p.card(frame)
| |
| local args = frame:getParent().args
| |
| local title = args["Название"] or "Без названия"
| |
| local ingredients = args["Ингредиенты"] or ""
| |
| local result = args["Результат"] or ""
| |
| local effects = args["Эффекты"] or ""
| |
|
| |
| local borderColor = args["ЦветРамки"] or "#ccc"
| |
| local backgroundColor = args["ЦветФона"] or "#f9f9f9"
| |
|
| |
| local function listBlock(text)
| |
| local items = {}
| |
| for item in mw.text.gsplit(text, ";") do
| |
| table.insert(items, "<li>" .. mw.text.trim(item) .. "</li>")
| |
| end
| |
| return table.concat(items, "\n")
| |
| end
| |
|
| |
| local html = {}
| |
| table.insert(html, '<div style="border: 2px solid ' .. borderColor .. '; padding: 1em; border-radius: 8px; background: ' .. backgroundColor .. '; max-width: 400px;">')
| |
| table.insert(html, '<h3 style="margin-top:0;">' .. title .. '</h3>')
| |
|
| |
| table.insert(html, "<b>Рецепт:</b><ul>")
| |
| table.insert(html, listBlock(ingredients))
| |
| table.insert(html, "</ul>")
| |
|
| |
| table.insert(html, "<b>Результат:</b><ul>")
| |
| table.insert(html, listBlock(result))
| |
| table.insert(html, "</ul>")
| |
|
| |
| table.insert(html, "<b>Эффекты:</b><ul>")
| |
| table.insert(html, listBlock(effects))
| |
| table.insert(html, "</ul>")
| |
|
| |
| table.insert(html, "</div>")
| |
| return table.concat(html, "\n")
| |
| end
| |
|
| |
| return p
| |