July 25, 2020

👭 Knight Challenge #11 👬

Want to try your hand at these challenges? There's a couple of things you can do!
From writing, to research, to images, find your preferred way to contribute with our eleventh theme: Couples!

Latest Announcements

Module:List Pages

From Zelda Wiki, the Zelda encyclopedia
Jump to: navigation, search

Purpose

This module exists so that templates can list an arbitrary number of pages. It is used by notice templates such as Template:Merge.

Usage

{{#invoke:Page List|Main|default= <default>}}

  • default — Default value to display if no pages are specified to the template.

Examples

InputOutputCategories added
{{Merge|Link|Zelda|Ganon}}
Pair Kinstones.png
It has been suggested that this article or section be merged with Link, Zelda and Ganon.

Discuss this on the article's talk page.

{{Merge|Link|Zelda|}}
Pair Kinstones.png
It has been suggested that this article or section be merged with Link and Zelda.

Discuss this on the article's talk page.

{{Merge|Link}}
Pair Kinstones.png
It has been suggested that this article or section be merged with Link.

Discuss this on the article's talk page.

{{Merge}}
Pair Kinstones.png
It has been suggested that this article or section be merged with .

Discuss this on the article's talk page.


local p = {}

local utilsMarkup = require("Module:UtilsMarkup")
local utilsString = require("Module:UtilsString")
local utilsTable = require("Module:UtilsTable")

function p.Main(frame)
	local args = utilsTable.merge({}, frame.args, frame:getParent().args)
	return p.main(args)
end

function p.main(args)
	local default = args.default
	local pages = utilsTable.filter(args, utilsString.notEmpty)
	if #pages == 0 then
		return default
	end
	pages = utilsTable.map(pages, utilsString.trim)
	pages = utilsTable.map(pages, utilsMarkup.link)
	local pageList = mw.text.listToText(pages)
	return pageList
end

return p