Jump to content

Module:Details

From Simple English Wikipedia, the free encyclopedia
Revision as of 06:30, 24 April 2014 by Mr. Stradivarius (talk | changes) (split function out from Module:Hatnote)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Details/doc

--------------------------------------------------------------------------------
-- Details
--
-- Produces a "For more details on this topic" link. the first parameter is the
-- page linked to, and if the second parameter is present it is used instead
-- of the "this topic" text.
--------------------------------------------------------------------------------

local mHatnote = require('Module:Hatnote')
local mArguments -- lazily initialise

local p = {}

function p.details(frame)
	mArguments = require('Module:Arguments')
	local args = mArguments.getArgs(frame, {parentOnly = true})
	local page = args[1]
	local topic = args[2]
	if not page then
		return mHatnote._makeWikitextError('no page specified')
	end
	return p._details(page, topic)
end

function p._details(page, topic)
	page = mHatnote._formatLink(page)
	topic = topic or 'this topic'
	local text = string.format('For more details on %s, see %s.', topic, page)
	local extraclasses = 'boilerplate seealso'
	return mHatnote._rellink(text, extraclasses)
end

return p