Module:Infobox interval: Difference between revisions
Undo revision 184879 by ArrowHead294 (talk). The debug mode is used in several places on the wiki where categories should be disabled Tag: Undo |
+prime harmonics and highly composite harmonics as special properties |
||
| Line 111: | Line 111: | ||
end | end | ||
if rat.is_harmonic(ratio) then | if rat.is_harmonic(ratio) then | ||
num, den = rat.as_pair (ratio) | |||
table.insert(special_properties, "[[harmonic]]") | table.insert(special_properties, "[[harmonic]]") | ||
cats = cats .. "[[Category:Harmonics|" .. string.rep("#", string.len(num)) .. "]]" | cats = cats .. "[[Category:Harmonics|" .. string.rep("#", string.len(num)) .. "]]" | ||
if rat.is_prime(ratio) then | |||
table.insert(special_properties, "[[prime harmonic]]") | |||
cats = cats .. "[[Category:Prime harmonics|" .. string.rep("#", string.len(num)) .. "]]" | |||
end | |||
if rat.is_highly_composite(ratio) then | |||
table.insert(special_properties, "[[highly composite harmonic]]") | |||
cats = cats .. "[[Category:Highly composite harmonics|" .. string.rep("#", string.len(num)) .. "]]" | |||
end | |||
elseif rat.is_harmonic(ratio, true, not small) then | elseif rat.is_harmonic(ratio, true, not small) then | ||
table.insert(special_properties, "[[Harmonic|reduced harmonic]]") | table.insert(special_properties, "[[Harmonic|reduced harmonic]]") | ||
| Line 193: | Line 201: | ||
name = name:gsub(",%s+", ",") | name = name:gsub(",%s+", ",") | ||
-- placing line breaks after commas | -- placing line breaks after commas | ||
name = name:gsub(",", ",<br | name = name:gsub(",", ",<br>") | ||
end | end | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
| Line 250: | Line 258: | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
"Special properties", | "Special properties", | ||
table.concat(special_properties, ",<br | table.concat(special_properties, ",<br>"), | ||
}) | }) | ||
end | end | ||
| Line 272: | Line 280: | ||
if regular then | if regular then | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
"[[Harmonic entropy]]<br | "[[Harmonic entropy]]<br>(Shannon, <math>\\sqrt{nd}</math>)", | ||
"~" .. utils._round(he.harmonic_entropy(cents), 6) .. " bits", | "~" .. utils._round(he.harmonic_entropy(cents), 6) .. " bits", | ||
}) | }) | ||
| Line 312: | Line 320: | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
caption, | caption, | ||
table.concat(S_expressions, ",<br | table.concat(S_expressions, ",<br>"), | ||
}) | }) | ||
end | end | ||
| Line 321: | Line 329: | ||
cats = cats .. "[[Category:Pages with internal sound examples]]" | cats = cats .. "[[Category:Pages with internal sound examples]]" | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
"[[File:" .. sound .. "|270px]]<br | "[[File:" .. sound .. "|270px]]<br><span style=\"font-size: 75%;\">[[:File:" .. sound .. "|<nowiki>[sound info]</nowiki>]]</span>", | ||
}) | }) | ||
elseif debug_mode and debug_mode ~= "hide" and regular then | elseif debug_mode and debug_mode ~= "hide" and regular then | ||