Jump to content

Module:Faahfaahin

Ka Wikipedia

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

--[[
-- This module produces a "For more faahfaahin on this topic" link. It implements
-- tusmada {{faahfaahin}}.
--]]

local mHatnote = require('Module:Hatnote')
local mHatlist = require('Module:Hatnote list')
local mArguments -- lazily initialise
local mTableTools -- lazily initialise
local p = {}

function p.faahfaahin (frame)
	mArguments = require('Module:Arguments')
	mTableTools = require('Module:TableTools')
	local args = mArguments.getArgs(frame, {parentOnly = true})
	local topic, category = args.topic, args.category
	local options = {selfref = args.selfref}
	args = mTableTools.compressSparseArray(args)
	if #args == 0 then
		return mHatnote.makeWikitextError(
			'no page name specified',
			'Template:Faahfaahin#Qaladaad',
			category
		)
	end
	return p._faahfaahin(args, topic, options)
end

function p._faahfaahin (list, topic, options)
	list = mHatlist.andList(list, true)
	topic = topic or 'qodobkaan'
	local text = string.format('Faahfaahin dheeraad ah oo ku saabsan %s, eeg %s.', topic, list)
	return mHatnote._hatnote(text, options)
end

return p