Module:ET sort key: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
Fredg999 (talk | contribs)
Bugfix
Fredg999 (talk | contribs)
Bugfix
Line 11: Line 11:
function p._et_sort_key(tuning)
function p._et_sort_key(tuning)
local et = ET.parse(tuning)
local et = ET.parse(tuning)
local size = et.size
local size = tostring(et.size)
local sort_key = string.rep("#", size:count("%d"))
local sort_key = string.rep("#", size:count("%d"))
return sort_key
return sort_key

Revision as of 15:46, 6 August 2025

Module documentation[view] [edit] [history] [purge]

This module returns an appropriate sort key for equal-step tuning-related pages to enable numerical sorting instead of alphabetical sorting.

Functions

et_sort_key
Return a string of #'s corresponding to the size (#notes/equave) of the ET

local getArgs = require("Module:Arguments").getArgs
local ET = require("Module:ET")
local p = {}

-- return a string of #'s corresponding to the size (#notes/equave) of the ET
function p.et_sort_key(frame)
	local args = getArgs(frame)
	return p._et_sort_key(args[1])
end

function p._et_sort_key(tuning)
	local et = ET.parse(tuning)
	local size = tostring(et.size)
	local sort_key = string.rep("#", size:count("%d"))
	return sort_key
end

return p