Module:Infobox AFDO: Difference between revisions

Undo revision 184877 by ArrowHead294 (talk). The debug mode is used in several places on the wiki where categories should be disabled
Tag: Undo
m Bugfix
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
local p = {}
local p = {}
local getArgs = require("Module:Arguments").getArgs
local infobox = require("Module:Infobox")
local u = require("Module:Utils")
local u = require("Module:Utils")
local infobox = require("Module:Infobox")
local yesno = require("Module:Yesno")
local yesno = require("Module:Yesno")


function p.infobox_AFDO(frame)
function p.infobox_AFDO(frame)
local args = getArgs(frame)
-- debug mode will disable the categories
-- debug mode will disable the categories
local debug_mode = yesno(frame.args["debug"])
local debug_mode = yesno(frame.args["debug"] or args["debug"], false)
local wtext = yesno(frame.args["wtext"] or args["wtext"])
local categories = ""
local categories = ""
Line 32: Line 36:
})
})


     if(dualfifth) then
     if (dualfifth) then
     table.insert(infobox_data, {
     table.insert(infobox_data, {
"Dual sharp fifth",
"Dual sharp fifth",
Line 54: Line 58:


local result = infobox.build(
local result = infobox.build(
"[[" .. steps .. "afdo]]",
string.format("[[%safdo]]", steps),
infobox_data,
infobox_data,
"[[" .. (steps - 1) .. "afdo|← " .. (steps - 1) .. "afdo]]",
string.format("[[%safdo|← %safdo]]", steps - 1, steps - 1),
"[[" .. (steps + 1) .. "afdo|" .. (steps + 1) .. "afdo →]]"
string.format("[[%safdo|%safdo →]]", steps + 1, steps + 1)
)
)
if not debug_mode then
if not debug_mode then
result = result .. categories
result = result .. categories
end
if wtext then
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
end
end