Module:Infobox interval: Difference between revisions
-the check for subharmonic and -Category: Subharmonics (unproductive since we don't distinguish individual harmonics and subharmonics on this wiki) |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| Line 184: | Line 184: | ||
-- removing manual line breaks | -- removing manual line breaks | ||
local matches | local matches | ||
name, matches = name:gsub("<br/?>", "") | name, matches = name:gsub("<br%s*/?>", "") | ||
if matches > 0 then | if matches > 0 then | ||
cats = cats .. "[[Category:Todo:remove manual line breaks]]" | cats = cats .. "[[Category:Todo:remove manual line breaks]]" | ||
| Line 191: | Line 191: | ||
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 221: | Line 221: | ||
local matches | local matches | ||
FJS_name = FJS_name:gsub("%s", "") | FJS_name = FJS_name:gsub("%s", "") | ||
FJS_name, matches = FJS_name:gsub("<br/?>", "") | FJS_name, matches = FJS_name:gsub("<br%s*/?>", "") | ||
if matches > 0 then | if matches > 0 then | ||
cats = cats .. "[[Category:Todo:remove manual line breaks]]" | cats = cats .. "[[Category:Todo:remove manual line breaks]]" | ||
| Line 248: | Line 248: | ||
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 270: | Line 270: | ||
if regular then | if regular then | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
frame:preprocess("[[Harmonic entropy]]<br/>(Shannon, <math>\\sqrt{nd}</math>)"), | frame:preprocess("[[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 310: | Line 310: | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
caption, | caption, | ||
table.concat(S_expressions, ",<br/>"), | table.concat(S_expressions, ",<br />"), | ||
}) | }) | ||
end | end | ||
| Line 319: | Line 319: | ||
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 .. "|[sound info]]]</span>", | ||
}) | }) | ||
elseif debug_mode and debug_mode ~= "hide" and regular then | elseif debug_mode and debug_mode ~= "hide" and regular then | ||
| Line 327: | Line 327: | ||
local html_id = "interval_" .. tostring(math.floor(cents)) | local html_id = "interval_" .. tostring(math.floor(cents)) | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
"<div style=\"display: flex; justify-content: space-around;\"><div style=\"width: 270px; text-align: center;\">" | |||
.. frame:expandTemplate({ | .. frame:expandTemplate({ | ||
title = "User:Plumtree/Interval Sound", | title = "User:Plumtree/Interval Sound", | ||
| Line 334: | Line 334: | ||
Center = "true", | Center = "true", | ||
Label = "Audio demonstration", | Label = "Audio demonstration", | ||
Attributes = | Attributes = "id=\"" .. html_id .. "\"", | ||
}, | }, | ||
}) | }) | ||
.. | .. "<div class=\"sequence-audio-timbre-selector\" data-target=\"" | ||
.. html_id | .. html_id | ||
.. | .. "\" data-key=\"interval-audio\" data-default=\"semisine\"></div>" | ||
.. "</div></div>", | .. "</div></div>", | ||
}) | }) | ||
| Line 356: | Line 356: | ||
query = mw.uri.encode(query) | query = mw.uri.encode(query) | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
"< | "<span style=\"font-size: 75%;\">[https://www.yacavone.net/xen-calc/?q=" .. query .. " open this interval in ''xen-calc'']</span>", | ||
}) | }) | ||
end | end | ||