Difference between revisions of "Module:Further"

From Princed Wiki
Jump to: navigation, search
m (Protected Module:Further: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite)))
 
m (1 revision: Adding the "Reflist" template.)
 
(No difference)

Latest revision as of 20:17, 8 July 2014

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

Script error: Lua error: Internal error: The interpreter exited with status 127.

--[[
-- This module produces a "Further information: a, b and c" link. It implements
-- the {{further}} template.
--]]

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

local p = {}

function p.further(frame)
	mTableTools = require('Module:TableTools')
	mArguments = require('Module:Arguments')
	local args = mArguments.getArgs(frame, {parentOnly = true})
	local pages = mTableTools.compressSparseArray(args)
	if #pages < 1 then
		return mHatnote.makeWikitextError(
			'no page names specified',
			'Template:Further#Errors',
			args.category
		)
	end
	local options = {
		selfref = args.selfref
	}
	return p._further(options, unpack(pages))
end

function p._further(options, ...)
	local links = mHatnote.formatPages(...)
	local text = 'Further information: ' .. mw.text.listToText(links)
	return mHatnote._hatnote(text, options)
end

return p