跳转到内容

模組:If darkmode

本页使用了标题或全文手工转换
维基百科,自由的百科全书

local p = {}

function p._main(args)
    local frame = mw.getCurrentFrame()
    local root = mw.html.create()

    if args["Tag"] then
        args["tag"] = args["Tag"]
    end

    local ifdarkmode = root:tag(args["tag"] or 'span')
    ifdarkmode
        :addClass('ifdarkmode')

    local nodarkmode = ifdarkmode:tag(args["tag"] or 'span')
    local isdarkmode = ifdarkmode:tag(args["tag"] or 'span')

    nodarkmode
        :addClass('nodarkmode')
        :wikitext(args[2])

    isdarkmode
        :addClass('isdarkmode')
        :wikitext(args[1])

    return frame:extensionTag {name = 'templatestyles', args = {src = 'if darkmode/styles.css'}} .. tostring(root)
end

function p.main(frame)
    local args = require('Module:Arguments').getArgs(frame, {
        wrappers = 'Template:if darkmode'
    })
    return p._main(args)
end

return p