Dallime mes rishikimeve të "Moduli:parameters/track"

Nga Enciklopedi Puro Shqiptare
Jump to navigation Jump to search
(Krijoi faqen me "local debug_track_module = "Module:debug/track" local string_gline_module = "Module:string/gline" local match = string.match local new_title = mw.title.new local require = require local traceback = debug.traceback local function debug_track(...) debug_track = require(debug_track_module) return debug_track(...) end local function gline(...) gline = require(string_gline_module) return gline(...) end local params_title local function get_params_title() params_title,...")
 
(Pa ndryshime)

Versioni aktual i datës 10 gusht 2025 08:59

Udhëzuesi për këtë modul mund të krijohet te Moduli:parameters/track/doc.

local debug_track_module = "Module:debug/track"
local string_gline_module = "Module:string/gline"

local match = string.match
local new_title = mw.title.new
local require = require
local traceback = debug.traceback

local function debug_track(...)
	debug_track = require(debug_track_module)
	return debug_track(...)
end

local function gline(...)
	gline = require(string_gline_module)
	return gline(...)
end

local params_title
local function get_params_title()
	params_title, get_params_title = new_title("parameters", 828), nil
	return params_title
end

return function(page, param_name)
	debug_track("parameters/" .. page)
	if param_name ~= nil then
		debug_track("parameters/" .. page .. "/" .. param_name .. "=")
	end
	-- Check through the traceback to get the calling module and function.
	local mod_title
	for line in gline((traceback())) do
		local mod, func = match(line, "^\t*(.-):%d+: in function (.*)$")
		-- Must match a conventional module, not a tail call, C function, in-
		-- built Scribunto file etc. If `mod` matches `mod_title`, it means the
		-- module has been seen before, so there is nothing else to check.
		if mod and not (mod_title and mod == mod_title.prefixedText) then
			mod_title = new_title(mod)
			if mod_title and mod_title.namespace == 828 and not (
				mod_title == (params_title or get_params_title()) or
				mod_title:isSubpageOf(params_title)
			) then
				mod = mod_title.text
				debug_track("parameters/" .. page .. "/" .. mod)
				-- traceback() encloses function names in single quotes.
				local funcname = match(func, "^'(.*)'$")
				if funcname then
					debug_track("parameters/" .. page .. "/" .. mod .. "/" .. funcname)
					return
				end
				-- WHen a function is unnamed, line numbers are given after the
				-- module name in angle brackets, directly after a separating
				-- colon.
				local funcline = match(func, "^<.-:(%d+)>$")
				if funcline then
					debug_track("parameters/" .. page .. "/" .. mod .. ":" .. funcline)
				end
				return
			end
		end
	end
end