Jump to content

Module:Exports

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by BrandonXLF (talk | contribs) at 15:41, 26 August 2024 (BrandonXLF moved page Module:Road data/strings/doc/exports to Module:Exports: Generalize). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}
local TableTools = require('Module:TableTools')

function p.exports(frame)
	local currentTitle = mw.title.getCurrentTitle()
	
	if currentTitle.contentModel ~= 'Scribunto' then
		return ''
	end
	
	local moduleExports = require(currentTitle.fullText)
	local keys = TableTools.keysToList(moduleExports, function (a, b)
		return string.lower(a) < string.lower(b)
	end)
	local outputKeys = {}
	
	for i, v in ipairs(keys) do
		outputKeys[i] = '<code><span style="white-space: pre;">' .. v .. '</span></code>'
	end
	
	return mw.text.listToText(outputKeys)
end

return p