Module:Infobox MOS: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 19: | Line 19: | ||
categories = categories .. '[[Category:' .. tuning .. '| ]]' | categories = categories .. '[[Category:' .. tuning .. '| ]]' | ||
local | local equave_link = '(' .. mos.equave .. '-equivalent)' | ||
local equave_disp = '<' .. mos.equave .. '>' | |||
if rat.eq(equave, rat.new(2, 1)) then | |||
equave_link = '' | |||
equave_disp = '' | |||
end | |||
local prev_L, prev_s = '', '' | local prev_L, prev_s = '', '' | ||
if mos.nL > 1 then | if mos.nL > 1 then | ||
prev_L = '[[' .. (mos.nL - 1) .. 'L' .. mos.ns .. 's' .. | prev_L = '[[' .. (mos.nL - 1) .. 'L' .. mos.ns .. 's' .. equave_link .. '|← ' .. (mos.nL - 1) .. 'L' .. mos.ns .. 's <' .. mos.equave .. '>]]' | ||
end | end | ||
local next_L = '[[' .. (mos.nL + 1) .. 'L' .. mos.ns .. 's' .. | local next_L = '[[' .. (mos.nL + 1) .. 'L' .. mos.ns .. 's' .. equave_link .. '|' .. (mos.nL + 1) .. 'L' .. mos.ns .. 's <' .. mos.equave .. '> →]]' | ||
if mos.ns > 1 then | if mos.ns > 1 then | ||
prev_s = '[[' .. mos.nL .. 'L' .. (mos.ns - 1) .. 's' .. | prev_s = '[[' .. mos.nL .. 'L' .. (mos.ns - 1) .. 's' .. equave_link .. '|↑\n' .. mos.nL .. 'L' .. (mos.ns - 1) .. 's <' .. mos.equave .. '>]]' | ||
end | end | ||
local next_s = '[[' .. mos.nL .. 'L' .. (mos.ns + 1) .. 's' .. | local next_s = '[[' .. mos.nL .. 'L' .. (mos.ns + 1) .. 's' .. equave_link .. '|' .. mos.nL .. 'L' .. (mos.ns + 1) .. 's <' .. mos.equave .. '>\n↓]]' | ||
local infobox_data = {} | local infobox_data = {} | ||
Revision as of 16:25, 31 March 2023
- This module should not be invoked directly; use its corresponding template instead: Template:Infobox MOS.
This module generates an infobox providing information about a given moment of symmetry (MOS) scale.
| Introspection summary for Module:Infobox MOS | |||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| ||||||||||||||||||||||||||||||
No function descriptions were provided. The Lua code may have further information.
local p = {}
local i = require('Module:Interval')
local u = require('Module:Utils')
local rat = require('Module:Rational')
local l = require('Module:Limits')
local MOS = require('Module:MOS')
local ET = require('Module:ET')
local infobox = require('Module:Infobox')
function p.infobox_MOS(frame)
-- debug mode
local debug_mode = frame.args['debug'] ~= nil
local categories = ''
local tuning = frame.args['tuning']
local mos = MOS.parse(tuning) or MOS.parse('5L 2s')
assert(mos, "failed to parse variable mos")
-- category of the main article
categories = categories .. '[[Category:' .. tuning .. '| ]]'
local equave_link = '(' .. mos.equave .. '-equivalent)'
local equave_disp = '<' .. mos.equave .. '>'
if rat.eq(equave, rat.new(2, 1)) then
equave_link = ''
equave_disp = ''
end
local prev_L, prev_s = '', ''
if mos.nL > 1 then
prev_L = '[[' .. (mos.nL - 1) .. 'L' .. mos.ns .. 's' .. equave_link .. '|← ' .. (mos.nL - 1) .. 'L' .. mos.ns .. 's <' .. mos.equave .. '>]]'
end
local next_L = '[[' .. (mos.nL + 1) .. 'L' .. mos.ns .. 's' .. equave_link .. '|' .. (mos.nL + 1) .. 'L' .. mos.ns .. 's <' .. mos.equave .. '> →]]'
if mos.ns > 1 then
prev_s = '[[' .. mos.nL .. 'L' .. (mos.ns - 1) .. 's' .. equave_link .. '|↑\n' .. mos.nL .. 'L' .. (mos.ns - 1) .. 's <' .. mos.equave .. '>]]'
end
local next_s = '[[' .. mos.nL .. 'L' .. (mos.ns + 1) .. 's' .. equave_link .. '|' .. mos.nL .. 'L' .. (mos.ns + 1) .. 's <' .. mos.equave .. '>\n↓]]'
local infobox_data = {}
table.insert(infobox_data, {
'Brightest mode',
'LLLsLLs'
})
result = infobox.build(
tuning,
infobox_data,
prev_L,
next_L--,
--prev_s,
--next_s
)
if not debug_mode then
result = result .. categories
end
return result
end
return p