|
|
| Ligne 289 : |
Ligne 289 : |
| function p.render(frame) | | function p.render(frame) |
| local args = frame:getParent().args | | local args = frame:getParent().args |
| local titre = getParam(args, "titre") or "Roadmap"
| | local rawContenu = args["contenu"] or args[1] or "(vide)" |
| local subtitle = getParam(args, "subtitle")
| | return '<pre>' .. mw.text.nowiki(tostring(rawContenu)) .. '</pre>' |
| local rawContenu = trim(args["contenu"] or args[1] or "") | |
| local showStats = getParam(args, "stats") ~= "non"
| |
| local showLegende = getParam(args, "legende") ~= "non"
| |
| local elements = parseContenu(rawContenu)
| |
| local pct, done, total = calcProgression(elements)
| |
| local html = {}
| |
| table.insert(html, '<div class="roadmap-container">')
| |
| -- Header
| |
| table.insert(html, '<div class="roadmap-header">')
| |
| table.insert(html, string.format(
| |
| '<div class="roadmap-header-content"><div class="roadmap-header-title">%s</div>',
| |
| escapeHtml(titre)
| |
| ))
| |
| if subtitle then
| |
| table.insert(html, string.format(
| |
| '<div class="roadmap-subtitle">%s</div>',
| |
| escapeHtml(subtitle)
| |
| )) | |
| end
| |
| table.insert(html, '</div></div>')
| |
| -- Stats
| |
| if showStats and #elements > 0 then
| |
| table.insert(html, htmlStats(elements))
| |
| end
| |
| -- Progression
| |
| if total > 0 then
| |
| table.insert(html, htmlProgressBar(pct, done, total))
| |
| end
| |
| -- Contenu
| |
| local inSection = false
| |
| for _, el in ipairs(elements) do
| |
| if el.type == "section" then
| |
| if inSection then
| |
| table.insert(html, '</div>')
| |
| end
| |
| table.insert(html, htmlSection(el))
| |
| inSection = true
| |
| elseif el.type == "item" then
| |
| table.insert(html, htmlItem(el))
| |
| end
| |
| end
| |
| if inSection then
| |
| table.insert(html, '</div>')
| |
| end
| |
| -- Légende
| |
| if showLegende then
| |
| table.insert(html, htmlLegende())
| |
| end
| |
| table.insert(html, '</div>')
| |
| return table.concat(html, "\n")
| |
| end | | end |
| | |
|
| |
|
| -- ------------------------------------------------------------ | | -- ------------------------------------------------------------ |