Module:List of countries

MyWikiBiz, Author Your Legacy — Saturday November 30, 2024
Revision as of 23:32, 15 July 2021 by Zoran (talk | contribs) (Pywikibot 6.4.0)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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