Module:Infobox ET: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 38: | Line 38: | ||
local link = rat.as_table(ratio)[2] .. et.suffix | local link = rat.as_table(ratio)[2] .. et.suffix | ||
ratio = string.format(" (→ [[%s|%s%s]])", | ratio = string.format(" (→ [[%s|%s%s]])", | ||
link, | link, rat.as_ratio(ratio, "\\"), (rat.eq(et.equave, 2) == false and et.suffix or "")) | ||
else | else | ||
ratio = "" | ratio = "" | ||
| Line 47: | Line 45: | ||
local cents = utils._round(ET.cents(et, approx), 6) | local cents = utils._round(ET.cents(et, approx), 6) | ||
return | return string.format("%s\\%s (%s{{c}})%s%s", | ||
approx, tuning, utils._round(ET.cents(et, approx), 6), ratio, convergement_notice) | |||
end | end | ||
| Line 56: | Line 55: | ||
local debug_mode = yesno(frame.args["debug"] or args["debug"], false) | local debug_mode = yesno(frame.args["debug"] or args["debug"], false) | ||
local wtext = yesno(frame.args["wtext"] or args["wtext"]) | local wtext = yesno(frame.args["wtext"] or args["wtext"]) | ||
local tuning = frame.args["tuning"] | local tuning = frame.args["tuning"] | ||
| Line 62: | Line 60: | ||
-- category of the main article | -- category of the main article | ||
categories = | local categories = string.format(" {{#ifexist: Category:%s|[[Category:%s| ]]|}}", tuning, tuning) | ||
-- category of the equal division | -- category of the equal division | ||
if rat.eq(et.equave, 2) then | if rat.eq(et.equave, 2) then | ||
categories = categories | categories = categories | ||
.. "[[Category:Equal divisions of the octave|" | .. string.format(" [[Category:Equal divisions of the octave|%s]]", | ||
string.rep("#", string.len(et.size))) | |||
elseif rat.eq(et.equave, 3) then | elseif rat.eq(et.equave, 3) then | ||
categories = categories .. "[[Category:Edts|" | categories = categories .. string.format(" [[Category:Edts|%s]]", | ||
string.rep("#", string.len(et.size))) | |||
elseif rat.eq(et.equave, rat.new (3, 2)) then | elseif rat.eq(et.equave, rat.new (3, 2)) then | ||
categories = categories .. "[[Category:Edfs|" | categories = categories .. string.format(" [[Category:Edfs|%s]]", | ||
string.rep("#", string.len(et.size))) | |||
else | else | ||
categories = categories .. "[[Category: | categories = categories .. string.format(" [[Category:%s's|%s]]", | ||
et.suffix, string.rep("#", string.len(et.size))) | |||
end | end | ||
| Line 86: | Line 86: | ||
if rat.eq(et.equave, 2) then | if rat.eq(et.equave, 2) then | ||
categories = categories | categories = categories | ||
.. "[[Category:Prime EDOs|" | .. string.format(" [[Category:Prime EDOs|%s]]", | ||
string.rep("#", string.len(et.size))) | |||
end | end | ||
end | end | ||
| Line 93: | Line 94: | ||
if rat.eq(et.equave, 2) then | if rat.eq(et.equave, 2) then | ||
categories = categories | categories = categories | ||
.. "[[Category:Highly composite EDOs|" | .. string.format(" [[Category:Highly composite EDOs|%s]]", | ||
string.rep("#", string.len(et.size))) | |||
end | end | ||
end | end | ||
| Line 116: | Line 118: | ||
local prev_one = "" | local prev_one = "" | ||
if et.size >= increment then | if et.size >= increment then | ||
prev_one = "[[" | prev_one = string.format("[[%s|← %s]]", | ||
(et.size - increment) .. et.suffix, (et.size - increment) .. et.suffix) | |||
end | end | ||
local next_one = "[[" | local next_one = string.format("[[%s|%s →]]", | ||
(et.size + increment) .. et.suffix, (et.size + increment) .. et.suffix) | |||
-- step size in cents | -- step size in cents | ||
local step_size = ET.cents(et, 1) | local step_size = ET.cents(et, 1) | ||
if step_size > 100 then | if step_size > 100 then | ||
categories = categories .. "[[Category:Macrotonal|" | categories = categories .. string.format(" [[Category:Macrotonal|%s]]", | ||
string.rep("#", string.len(et.size))) | |||
end | end | ||
local note_12edo = "" | local note_12edo = "" | ||
| Line 153: | Line 158: | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
"Step size", | "Step size", | ||
string.format("%s{{c}}%s ", | |||
utils._round(step_size, 6), note_12edo) | |||
}) | }) | ||
| Line 174: | Line 180: | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
"Semitones (A1:m2)", | "Semitones (A1:m2)", | ||
string.format("%s:%s (%s{{c}} : %s{{c}})", | |||
A1, m2, A1_cents, m2_cents) | |||
}) | }) | ||
if is_dual_fifth and et.size > 0 then | if is_dual_fifth and et.size > 0 then | ||
| Line 192: | Line 199: | ||
}) | }) | ||
categories = categories | categories = categories | ||
.. "[[Category:Dual-fifth temperaments|" | .. string.format(" [[Category:Dual-fifth temperaments|%s]]", | ||
string.rep("#", string.len(et.size))) | |||
end | end | ||
end | end | ||
| Line 233: | Line 239: | ||
if rat.eq(et.equave, 2) then | if rat.eq(et.equave, 2) then | ||
categories = categories | categories = categories | ||
.. "[[Category:Zeta record EDOs|" | .. string.format(" [[Category:Zeta record EDOs|%s]]", | ||
string.rep("#", string.len(et.size))) | |||
if zeta_switch then | if zeta_switch then | ||
text = text .. ET.why_zeta(et) | text = text .. ET.why_zeta(et) | ||