Module:Government/list: Difference between revisions

From NPOWiki
Jump to navigation Jump to search
Updating Torn leadership
No edit summary
 
(41 intermediate revisions by 3 users not shown)
Line 8: Line 8:
--      Therefore, names cannot contain square brackets.
--      Therefore, names cannot contain square brackets.
--  *Do not pluralize position names, and don't use abbreviations. These are added in Module:Government.
--  *Do not pluralize position names, and don't use abbreviations. These are added in Module:Government.
--  *For a position that is defined but currently vacant, leave the line blank after the separator ( - ).
--  *Empty lines can be used for readability and will be ignored.
--  *Empty lines can be used for readability and will be ignored.
--The intention is that the list can be maintained elsewhere and copy-pasted here when an update is needed, or vice versa.
--The intention is that the list can be maintained elsewhere and copy-pasted here when an update is needed, or vice versa.
Line 18: Line 19:
Community
Community


Administrator - Lord of Darkness, Frawley, Jesse End
Executive - Lord of Darkness, Frawley, Jesse End, Gandroff
Moderator - Edward I, Imperial Emperor, Tebeat, Malabyte, Marina, Qazzian, Xoriet
Director - Marina [NationStates], Ender [Events], Xoriet [Moderation]
Senior Moderator - Dan100, Marina, saxasm, Xoriet
Moderator - Callisto, Greatkitteh, Nijil1
Trainee Moderator - Brutus5149


----
----
NationStates
NationStates


Emperor - Lord of Darkness
Empress - Marina
Consul - Elegarth
Successor - Syberis
Legatus - Xoriet
Regent - Dio
Praetor - Marina
Senator of Military Affairs - Greatkitteh
Censor - Shnailand
Senator of Internal Affairs - Greyghost, Pathonia
Tribune - Jar Wattinree
Senator of Diplomatic Affairs - Callisto
Vox Populi - Dimitri
Senate Advisor - Ivan Moldavi, Lord of Darkness
 
Praefectus -  


----
----
Line 37: Line 43:
Emperor - Lord of Darkness
Emperor - Lord of Darkness
Regent - Jesse End
Regent - Jesse End
Imperial Officer - DeathAdder [military/diplomacy], Emperor Ice [military/economy], SynysterGates, Tebeat [internal]
Imperial Officer - SeasonsofLove
Counselor - Emperor Ice


Exarch - jgolla, Llednar Twem, Eric the Red, Edward I, Amyameretta
Exarch - jgolla, Llednar Twem, Edward I, Amyameretta


General - Antiega
General - Eclipse
Colonel - Eclipse
Colonel -  


Prefect - Eric the Red
Prefect - Madd
Tribune - Necrosin, Biowulf
Tribune - Knight


----
----
Torn
Torn


Emperor - Imperial Emperor
Emperor - Jesse End
Regent - Pansy
Regent - Selina
Imperial Officer - Keshav [military], Jgolla [economy], Elegarth[mentoring]
Imperial Officer of Economic Affairs - OsRavan
Counselor - Lord of Darkness, Red, Dan100
Imperial Officer of Internal Affairs - DeathlySmokey
Imperial Officer of Military Affairs - Callisto, Lord of Darkness
Governor (Strength) - Pep_9090
Governor (Prosperity) - Nijil1
Governor (Endurance) - Elegarth
Governor (Valour) - Terekhov
Leader (Serenity) - Tiberius
Leader (Peace) - Cuatela
Councilor (Strength) - Severisen
Councilor (Prosperity) - Grease_Monkey, ortibeX
Senior Councilor (Endurance) - Calirin, PANDA-
Councilor (Endurance) - LLKnot
Senior Councilor (Valour) - Brutus5149, DeathlySmokey
Councilor (Valour) - Canixe, chattateo
Councilor (Serenity) - looneylew
Advisor - jgolla


General - SableCanary
General - Pixxiec
Colonel - Gandroff, sngg, TowerQueen, hessian01
Captain - Garlanator, MagnoliaTree


Provost - Looneylew
Provost - Selina
Deputy Provost - Selina, Malabyte
Manager (Admissions) - Ryonn
Deputy Provost (Instructors) - Vesperi
Deputy Provost (Recruitment) - Fearax


Executive - OsRavan
Pacific Financial Executive - Grease_Monkey
Deputy Executive - Iceknave


]=]--only edit above this line
]=]--only edit above this line
Line 66: Line 93:
--the separator between position names and occupants
--the separator between position names and occupants
local sep = ' - '
local sep = ' - '
local err = require('Module:Error').call


local function strip(s)
local function strip(s)
Line 73: Line 102:


local struct = {}
local struct = {}
local title, positions
local subStart, subEnd
for game in mw.text.gsplit(list, '\n%-+\n') do
for game in mw.text.gsplit(list, '\n%-+\n') do
title = nil
local title = nil
positions = {}
local positions = {}
for line in mw.text.gsplit(game, '\n') do
for line in mw.text.gsplit(game, '\n') do
line = mw.text.trim(line)
line = mw.text.trim(line)
Line 84: Line 111:
title = line
title = line
else
else
subStart, subEnd = mw.ustring.find(line, sep, 1, true)
local incumbent
local subStart, subEnd = mw.ustring.find(line, sep, 1, true)
if not subStart or not subEnd then
if not subStart or not subEnd then
return '<span class="error">Parse error in [[Module:Government/list]]: ' .. line .. '</span>'
--Check if separator is the last thing on the line (means vacant position)
line = line .. ' '
subStart, subEnd = mw.ustring.find(line .. ' ', sep, 1, true)
if not subStart or not subEnd then
return err('Parse error in [[Module:Government/list]]: ' .. line)
else
--Expected format in parent module for vacant position
incumbent = ''
end
else
else
positions[strip(mw.ustring.sub(line, 1, subStart - 1))] =
incumbent = mw.text.trim(mw.ustring.sub(line, subEnd + 1))
mw.text.trim(mw.ustring.sub(line, subEnd + 1))
end
end
positions[strip(mw.ustring.sub(line, 1, subStart - 1))] = incumbent
end
end
end
end

Latest revision as of 22:31, 13 November 2025

Documentation [edit]

This is a data module to be used with mw.loadData. It parses the regular text list and returns the formatted data structure. This is meant to be an easy way to keep external lists in sync with the wiki.

See the comments at the top for how to modify the list. Only edit between the marked lines. Please check for errors before saving.

If changes to functionality are needed, please contact an administrator.

The above documentation is transcluded from Module:Government/list/doc.

--The list must follow this format:
--  *Game/category blocks separated by a series of at least one hyphen on its own line
--  *Game/category name on its own line at the beginning of the block
--  *Each position on its own line as follows:
--     position name - position holder(s) separated by a comma and space
--     Optionally, each position holder can have a specialization specified in square brackets preceded by a space, e.g.
--       Position - Person [duties], Some Guy, Other Person [other duties]
--       Therefore, names cannot contain square brackets.
--  *Do not pluralize position names, and don't use abbreviations. These are added in Module:Government.
--  *For a position that is defined but currently vacant, leave the line blank after the separator ( - ).
--  *Empty lines can be used for readability and will be ignored.
--The intention is that the list can be maintained elsewhere and copy-pasted here when an update is needed, or vice versa.
--To smoke-test changes, type =p in the console below and press Enter. It should return "table".

--only edit below the following line
local list = [=[

----
Community

Executive - Lord of Darkness, Frawley, Jesse End, Gandroff
Director - Marina [NationStates], Ender [Events], Xoriet [Moderation]
Senior Moderator - Dan100, Marina, saxasm, Xoriet
Moderator - Callisto, Greatkitteh, Nijil1
Trainee Moderator - Brutus5149

----
NationStates

Empress - Marina
Successor - Syberis
Regent - Dio
Senator of Military Affairs - Greatkitteh
Senator of Internal Affairs - Greyghost, Pathonia
Senator of Diplomatic Affairs - Callisto
Senate Advisor - Ivan Moldavi, Lord of Darkness

Praefectus - 

----
Cyber Nations

Emperor - Lord of Darkness
Regent - Jesse End
Imperial Officer - SeasonsofLove
Counselor - Emperor Ice

Exarch - jgolla, Llednar Twem, Edward I, Amyameretta

General - Eclipse
Colonel - 

Prefect - Madd
Tribune - Knight

----
Torn

Emperor - Jesse End
Regent - Selina
Imperial Officer of Economic Affairs - OsRavan
Imperial Officer of Internal Affairs - DeathlySmokey
Imperial Officer of Military Affairs - Callisto, Lord of Darkness
Governor (Strength) - Pep_9090
Governor (Prosperity) - Nijil1
Governor (Endurance) - Elegarth
Governor (Valour) - Terekhov
Leader (Serenity) - Tiberius
Leader (Peace) - Cuatela
Councilor (Strength) - Severisen
Councilor (Prosperity) - Grease_Monkey, ortibeX
Senior Councilor (Endurance) - Calirin, PANDA-
Councilor (Endurance) - LLKnot
Senior Councilor (Valour) - Brutus5149, DeathlySmokey
Councilor (Valour) - Canixe, chattateo
Councilor (Serenity) - looneylew
Advisor - jgolla

General - Pixxiec
Colonel - Gandroff, sngg, TowerQueen, hessian01
Captain - Garlanator, MagnoliaTree

Provost - Selina
Manager (Admissions) - Ryonn
Deputy Provost (Instructors) - Vesperi
Deputy Provost (Recruitment) - Fearax

Pacific Financial Executive - Grease_Monkey
Deputy Executive - Iceknave

]=]--only edit above this line

--the separator between position names and occupants
local sep = ' - '

local err = require('Module:Error').call

local function strip(s)
	--trim, lowercase, and remove non-alphanumeric characters. Also used in base module
	return mw.text.trim(mw.ustring.gsub(mw.ustring.lower(s or ''), '%W', ''))
end

local struct = {}
for game in mw.text.gsplit(list, '\n%-+\n') do
	local title = nil
	local positions = {}
	for line in mw.text.gsplit(game, '\n') do
		line = mw.text.trim(line)
		if line ~= '' then
			if not title then
				title = line
			else
				local incumbent
				local subStart, subEnd = mw.ustring.find(line, sep, 1, true)
				if not subStart or not subEnd then
					--Check if separator is the last thing on the line (means vacant position)
					line = line .. ' '
					subStart, subEnd = mw.ustring.find(line .. ' ', sep, 1, true)
					if not subStart or not subEnd then
						return err('Parse error in [[Module:Government/list]]: ' .. line)
					else
						--Expected format in parent module for vacant position
						incumbent = ''
					end
				else
					incumbent = mw.text.trim(mw.ustring.sub(line, subEnd + 1))
				end
				positions[strip(mw.ustring.sub(line, 1, subStart - 1))] = incumbent
			end
		end
	end
	if title then
		struct[strip(title)] = positions
	end
end

return struct