Module:Essay sidebar: Difference between revisions

From ProleWiki, the proletarian encyclopedia
(test)
 
m (test2)
 
Line 1: Line 1:
-- This module implements collapsing a div for the "Last Updated" section.
-- This module implements collapsing a div for the "Last Updated" section.
-- doesn't work yet.


local p = {}
local p = {}

Latest revision as of 09:34, 6 October 2023

-- This module implements collapsing a div for the "Last Updated" section.
-- doesn't work yet.

local p = {}

function p.collapse(frame)
    local content = frame.args[1] or ''
    local isExpanded = frame.args.expanded == 'yes'

    local collapseClass = isExpanded and '' or 'mw-collapsed'

    local result = mw.html.create('div')
    result:addClass('lastupdate-container')
    result
        :wikitext('\'\'\'<span class="collapse-icon">▼</span> Last Updated\'\'\'')
        :tag('div')
        :addClass('collapsible-content ' .. collapseClass)
        :wikitext(content)

    return tostring(result)
end

return p