Module:List of countries

MyWikiBiz, Author Your Legacy — Tuesday November 12, 2024
Jump to navigationJump to search

Template:Module rating This module reads a list of ISO 3-letter codes from an article page prefixed by Template:Mono. It centralises the base list of countries in articles of the type Template:Mono in the Template:Mono list articles.

Usage

The module is accessed through the template with the same name:

Template:Mono

Template:Sandbox other


local debug = false
--local get = require('Module:Transcluder').get
local p = {}

function p.ISO(frame)
	local source = mw.title.new('List of countries in '..frame.args[1]):getContent()
	if source then
		local codes = ''
		for code in string.gmatch(source, '%u%u%u') do
			codes = codes..'%|'..code
		end
		if debug then
			return 'List of countries in '..frame.args[1]
		else
			return codes
		end
	end
end

return p