Module:Wp/bgn/Further

From Wikimedia Incubator

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

--[[
-- This module produces a "گیشتیرین مالومات: a, b and c" link. It implements
-- the {{further}} template.
--]]

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

local p = {}

function p.further(frame)
	mTableTools = require('Module:Wp/bgn/TableTools')
	mArguments = require('Module:Wp/bgn/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 = 'په گیشتیرین مالوتێ خاتیرا، ایدا گیشتیر بوانیت: ' .. mw.text.listToText(links)
	return mHatnote._hatnote(text, options)
end

return p