Jump to content

Module:Other uses of/sandbox

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Nihiltres (talk | contribs) at 03:55, 26 April 2020 (Create sandbox version of Module:Other uses of to test addition of tracking logic). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local mOtheruses = require('Module:Other uses')
local p = {}
p.otherusesof = function (frame)
	function getArg (num)
		local x = frame:getParent().args[num]
		return x ~= '' and x or nil
	end
	local currentTitle = mw.title.getCurrentTitle().prefixedText
	local ofWhat = getArg(1) or currentTitle
	local page = getArg(2)
	local options = {
		title = ofWhat,
		otherText = string.format('uses of "%s"', ofWhat)
	}
	local oddCat = "[[Category:Hatnote templates using unusual parameters]]"
	if getArg(1) == currentTitle then
		options.otherText = options.otherText .. oddCat
	end
	arg = page and {page} or {}
	return mOtheruses._otheruses(arg, options)
end
return p