docs(api): sort unreleased nvim__ functions last #28580

This commit is contained in:
Justin M. Keyes
2024-04-30 06:06:14 -07:00
committed by GitHub
parent ee41153a94
commit dafa51c16d
4 changed files with 103 additions and 96 deletions

View File

@@ -768,10 +768,17 @@ local function render_funs(funs, classes, cfg)
ret[#ret + 1] = render_fun(f, classes, cfg)
end
-- Sort via prototype
-- Sort via prototype. Experimental API functions ("nvim__") sort last.
table.sort(ret, function(a, b)
local a1 = ('\n' .. a):match('\n[a-zA-Z_][^\n]+\n')
local b1 = ('\n' .. b):match('\n[a-zA-Z_][^\n]+\n')
local a1__ = a1:find('^%s*nvim__') and 1 or 0
local b1__ = b1:find('^%s*nvim__') and 1 or 0
if a1__ ~= b1__ then
return a1__ < b1__
end
return a1:lower() < b1:lower()
end)