Module:Collapsed huge table: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
m Oops |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local | |||
local ET = require("Module:ET") | |||
local rat = require("Module:Rational") | local rat = require("Module:Rational") | ||
local ud = require("Module:Ups and downs notation") | local ud = require("Module:Ups and downs notation") | ||
local | local utils = require("Module:Utils") | ||
local yesno = require("Module:Yesno") | local yesno = require("Module:Yesno") | ||
| Line 82: | Line 83: | ||
[47] = ET.approximate(et, 47), | [47] = ET.approximate(et, 47), | ||
} -- NOTE: indices are prime numbers | } -- NOTE: indices are prime numbers | ||
local debugg = yesno(frame.args["debug"]) | |||
local t_head = "{| class=\"wikitable center-1 right-2\"\n" | local t_head = "{| class=\"wikitable center-1 right-2\"\n" | ||
| Line 94: | Line 96: | ||
-- List of all 23-limit ratios with numerator and denominator <= certain cents value and in the range 1/1 - 2/1 | -- List of all 23-limit ratios with numerator and denominator <= certain cents value and in the range 1/1 - 2/1 | ||
local ratios_list = get_ratios_list(54,2,23) | local ratios_list = get_ratios_list(54, 2, 23) | ||
result = t_head .. | |||
"|-\n" .. | |||
"! Steps\n" .. | "! Steps\n" .. | ||
"! Cents\n" .. | "! Cents\n" .. | ||
| Line 102: | Line 105: | ||
if rat.eq(et.equave, 2) then | if rat.eq(et.equave, 2) then | ||
if dual_fifth then | if dual_fifth then | ||
result = result | |||
.. "! [[Ups and downs notation|Ups and Downs Notation]]<br>(Dual Flat Fifth " | .. "! [[Ups and downs notation|Ups and Downs Notation]]<br>(Dual Flat Fifth " | ||
.. dual_flat_fifth | .. dual_flat_fifth | ||
| Line 108: | Line 111: | ||
.. et.size | .. et.size | ||
.. ")\n" | .. ")\n" | ||
result = result | |||
.. "! [[Ups and downs notation|Ups and Downs Notation]]<br>(Dual Sharp Fifth " | .. "! [[Ups and downs notation|Ups and Downs Notation]]<br>(Dual Sharp Fifth " | ||
.. dual_sharp_fifth | .. dual_sharp_fifth | ||
| Line 115: | Line 118: | ||
.. ")\n" | .. ")\n" | ||
else | else | ||
result = result .. "! [[Ups and downs notation|Ups and Downs Notation]]\n" | |||
end | end | ||
end | end | ||
| Line 121: | Line 124: | ||
if #additional_split > 0 then | if #additional_split > 0 then | ||
for i = 1, #additional_split[1] do | for i = 1, #additional_split[1] do | ||
result = result .. "! " .. additional_split[1][i] .. "\n" | |||
end | end | ||
end | end | ||
for i = 0, et.size do | for i = 0, et.size do | ||
result = result .. "|-\n" | |||
result = result .. "| " .. i .. "\n" | |||
result = result .. "| " .. utils._round_dec(ET.cents(et, i), 3) .. "\n" | |||
result = result .. "| " | |||
for j = 1, #ratios_list do | for j = 1, #ratios_list do | ||
-- Go through all ratios. | -- Go through all ratios. | ||
| Line 140: | Line 143: | ||
< (1200 / et.size) | < (1200 / et.size) | ||
then | then | ||
result = result .. "[[" .. ratios_list[j][1] .. "/" .. ratios_list[j][2] .. "]], " | |||
end | end | ||
end | end | ||
-- ??? | -- ??? | ||
if | if result:sub(-2, -1) == "| " then | ||
result = result .. "\n" | |||
else | else | ||
result = result:sub(0, -3) .. "\n" | |||
end | end | ||
if rat.eq(et.equave, 2) then | if rat.eq(et.equave, 2) then | ||
if dual_fifth then | if dual_fifth then | ||
result = result .. "| " .. ud_note(et, dual_flat_fifth, i) .. "\n" | |||
result = result .. "| " .. ud_note(et, dual_sharp_fifth, i) .. "\n" | |||
else | else | ||
result = result .. "| " .. ud_note(et, fifth, i) .. "\n" | |||
end | end | ||
end | end | ||
| Line 162: | Line 165: | ||
if (i + 2) <= #additional_split then | if (i + 2) <= #additional_split then | ||
for j = 1, #additional_split[i + 2] do | for j = 1, #additional_split[i + 2] do | ||
result = result .. "| " .. additional_split[i + 2][j] .. "\n" | |||
end | end | ||
end | end | ||
end | end | ||
result = result .. "|}" | |||
if debugg == true then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
return p | return p | ||