Module:Infobox AFDO: Difference between revisions
Trying to make it so that “fifth” doesn’t show up when “sharp dual fifth” and “flat dual fifth” show up, because then it is being shown twice which is redundant. I will check the afdo pages immediately to see if it has broken them, and will undo immediately if it has Tags: Mobile edit Mobile web edit Advanced mobile edit |
m Bugfix |
||
| (6 intermediate revisions by 2 users 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 | 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 = 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 31: | Line 36: | ||
}) | }) | ||
if(dualfifth) then | if (dualfifth) then | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
"Dual sharp fifth", | "Dual sharp fifth", | ||
| Line 48: | Line 53: | ||
end | end | ||
if (special_properties ~= "") then | |||
table.insert(infobox_data, {"Special properties", special_properties}) | table.insert(infobox_data, {"Special properties", special_properties}) | ||
end | end | ||
local result = infobox.build( | local result = infobox.build( | ||
"[[ | string.format("[[%safdo]]", steps), | ||
infobox_data, | infobox_data, | ||
"[[ | string.format("[[%safdo|← %safdo]]", steps - 1, steps - 1), | ||
"[[ | string.format("[[%safdo|%safdo →]]", steps + 1, steps + 1) | ||
) | ) | ||
| Line 62: | Line 67: | ||
result = result .. categories | result = result .. categories | ||
end | end | ||
return result | |||
if wtext then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
return p | return p | ||