-- Used to implement -- This is not the same as, which uses mw-ui.local getArgs = require('Module:Arguments').getArgslocal yesno = require('Module:Yesno')local p =
local finalCategories =
function p.main(frame) local args = getArgs(frame,)
return p._main(frame, args)end
function p._main(frame, args) -- aliases args["label"] = args["1"] or args["label"] return tostring(renderButtonWidget(args))end
function renderButtonWidget(args) local wrapper = mw.html.create("span") :addClass("oo-ui-widget") :addClass("oo-ui-buttonElement") :addClass("oo-ui-buttonWidget") --
"destructive" or yesno(args["destructive"]) then wrapper:addClass("oo-ui-flaggedElement-destructive") end -- frame if yesno(args["framed"] or "yes") then wrapper:addClass("oo-ui-buttonElement-framed") else wrapper:addClass("oo-ui-buttonElement-frameless") end -- disabled if yesno(args["disabled"] or "no") then wrapper:addClass("oo-ui-widget-disabled") wrapper:attr("aria-diasbled", "true") else wrapper:addClass("oo-ui-widget-enabled") wrapper:attr("aria-diasbled", "false") end wrapper:node(renderButton(args)) return wrapperend
function renderButton(args) return mw.html.create("span") :addClass("oo-ui-buttonElement-button") :attr("role", "button") :attr("title", args["title"] or args["label"]) :attr("aria-disabled", yesno(args["disabled"] or "no") and "true" or "false") :node(renderIcon(args["icon"])) :node(renderLabel(args["label"])) :node(renderIndicator(args["indicator"]))end
function renderIcon(icon) return mw.html.create("span") :addClass("oo-ui-iconElement-icon") :addClass((icon and string.len(icon) > 0) and ("oo-ui-icon-" .. icon) or "oo-ui-iconElement-noIcon")end
function renderLabel(label) return mw.html.create("span") :addClass("oo-ui-labelElement-label") :wikitext(label)end
function renderIndicator(indicator) if indicator ~= "clear" and indicator ~= "down" and indicator ~= "required" and indicator ~= "up" and indicator ~= "" and indicator ~= nil then mw.addWarning("Unrecognized indicator: " .. indicator .. "") indicator = "" end return mw.html.create("span") :addClass("oo-ui-indicatorElement-indicator") :addClass((indicator and string.len(indicator) > 0) and ("oo-ui-indicator-" .. indicator) or "oo-ui-indicatorElement-noIndicator")end
return p