Module:Infobox AFDO: Difference between revisions
CompactStar (talk | contribs) No edit summary |
Reinstall some functionalities from Infobox ET |
||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local u = require('Module:Utils') | local u = require('Module:Utils') | ||
local infobox = require('Module:Infobox') | local infobox = require('Module:Infobox') | ||
function p.infobox_AFDO(frame) | function p.infobox_AFDO(frame) | ||
-- debug mode will disable the categories | |||
local debug_mode = frame.args['debug'] ~= nil | |||
local categories = '' | |||
local steps = frame.args['steps'] | local steps = frame.args['steps'] | ||
local stepnum = tonumber(steps) | local stepnum = tonumber(steps) | ||
| Line 11: | Line 14: | ||
local special_properties = "" | local special_properties = "" | ||
-- if | -- category of the main article | ||
-- | --categories = categories .. '[[Category:' .. tuning .. '| ]]' | ||
-- category of the equal division | |||
--if rat.eq(et.equave, 2) then | |||
categories = categories .. '[[Category:AFDO|' .. string.rep ('#', string.len (stepnum)) .. ']]' | |||
--else | |||
-- categories = categories .. '[[Category:' .. et.suffix .. '|' .. string.rep ('#', string.len (et.size)) .. ']]' | |||
--end | |||
-- prime test | |||
local prime = "" | |||
if u.is_prime(et.size) then | |||
prime = " (prime)" | |||
if rat.eq(et.equave, 2) then | |||
categories = categories .. '[[Category:Prime AFDO|' .. string.rep ('#', string.len (et.size)) .. ']]' | |||
end | |||
end | |||
local infobox_data = {} | local infobox_data = {} | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
'Prime factorization', | 'Prime factorization', | ||
u._prime_factorization(stepnum) | u._prime_factorization(stepnum) .. prime | ||
}) | }) | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
'Fifth', | 'Fifth', | ||
fifth .. '/' .. steps .. ' (' .. math.floor(math.log(fifth/steps)/math.log(2) * 1200 * 1000)/1000 .. 'c)' | fifth .. '/' .. steps .. ' (' .. math.floor(math.log(fifth/steps)/math.log(2) * 1200 * 1000)/1000 .. 'c)' | ||
}) | }) | ||
if(dualfifth) then | if(dualfifth) then | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
| Line 42: | Line 61: | ||
'<-<small> [[' .. (steps - 1).. 'afdo]] </small>' .. '[[' .. steps .. 'afdo]]' .. '<small> [[' .. (steps + 1).. 'afdo]] -></small>', | '<-<small> [[' .. (steps - 1).. 'afdo]] </small>' .. '[[' .. steps .. 'afdo]]' .. '<small> [[' .. (steps + 1).. 'afdo]] -></small>', | ||
infobox_data | infobox_data | ||
) | ) | ||
if not debug_mode then | |||
result = result .. categories | |||
end | |||
return result | return result | ||
end | end | ||
return p | return p | ||