Module:Government/list: Difference between revisions

From NPOWiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(12 intermediate revisions by 2 users not shown)
Line 21: Line 21:
Executive - Lord of Darkness, Frawley, Jesse End, Gandroff
Executive - Lord of Darkness, Frawley, Jesse End, Gandroff
Director - Marina [NationStates], Ender [Events], Xoriet [Moderation]
Director - Marina [NationStates], Ender [Events], Xoriet [Moderation]
Senior Moderator - Marina, saxasm, Xoriet
Senior Moderator - Marina, saxasm, Xoriet, Tebeat
Moderator - Callisto, Dan100, Nijil1
Moderator - Callisto, Nijil1
Trainee Moderator - Brutus5149
Trainee Moderator - Brutus5149, Terekhov


----
----
Line 30: Line 30:
Empress - Syberis
Empress - Syberis
Regent - Dio
Regent - Dio
Senator of Military Affairs -  
Senator of Community and Military Affairs - Mouse490
Senator of Internal Affairs - Greyghost, Pathonia, Callisto
Senator of Internal Affairs - Greyghost, Pathonia
Senator of Diplomatic Affairs - SeasonsofLove
Senator of Diplomatic Affairs - SeasonsofLove
Senate Advisor - Ivan Moldavi, Lord of Darkness, Marina
Senator of Gameplay Affairs - Dushina
Senator of Roleplay Affairs - Arthropyria
Senate Advisor - Ivan Moldavi, Lord of Darkness


Praefectus -  
Praefectus -  
Line 42: Line 44:
Emperor - Lord of Darkness
Emperor - Lord of Darkness
Regent - Jesse End
Regent - Jesse End
Imperial Officer - SeasonsofLove
Imperial Officer - Eclipse, Madd, SeasonsofLove
Counselor - Emperor Ice
Counselor - Emperor Ice


Exarch - jgolla, Llednar Twem, Edward I, Amyameretta
Exarch - jgolla, Llednar Twem, Edward I, Amyameretta


General - Eclipse
General -  
Colonel -  
Colonel -  


Prefect - Madd
Prefect -  
Tribune - Knight
Tribune - Knight


Line 57: Line 59:


Emperor - Jesse End
Emperor - Jesse End
Regent - Selina
Regent - Selina, Terekhov
Imperial Officer of Economic Affairs - OsRavan
Imperial Officer of Economic Affairs - OsRavan
Imperial Officer of Internal Affairs - DeathlySmokey
Imperial Officer of Internal Affairs - DeathlySmokey
Imperial Officer of Military Affairs - Callisto, Lord of Darkness
Imperial Officer of Military Affairs - Callisto, Lord of Darkness, hessian01
Governor (Strength) - Pep_9090
Governor (Strength) - Pep_9090, Elegarth
Governor (Prosperity) - Nijil1
Governor (Prosperity) - ortibeX
Governor (Endurance) - Elegarth
Governor (Endurance) - PANDA-
Governor (Valour) - Terekhov
Governor (Valour) - Calirin
Leader (Serenity) - Tiberius
Leader (Serenity) - looneylew
Leader (Peace) - Cuatela
Leader (Peace) - Cuatela
Councilor (Strength) - Severisen
Councilor (Strength) - Severisen
Senior Councilor (Prosperity) - Grease_Monkey, ortibeX
Junior Councilor (Strength) - Jordi_Chin, Kitestaaa
Senior Councilor (Prosperity) - Grease_Monkey
Councilor (Prosperity) -  
Councilor (Prosperity) -  
Senior Councilor (Endurance) - Calirin, PANDA-
Junior Councilor (Prosperity) - Studious, XxLightsoutxX, QIcelet
Councilor (Endurance) - LLKnot
Senior Councilor (Endurance) - LLKnot
Senior Councilor (Valour) - Brutus5149, DeathlySmokey
Councilor (Endurance) - DarkDefiance, Dangerous_Dan
Councilor (Valour) - Canixe, chattateo
Junior Councilor (Endurance) - Madd
Senior Councilor (Valour) - Brutus5149, Ryann
Councilor (Valour) - Canixe, g3jedi, Thelemite
Junior Councilor (Valour) - medevac
Councilor (Serenity) - looneylew
Councilor (Serenity) - looneylew
Advisor - jgolla
Advisor - jgolla, Xoriet, Nijil1


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


Provost - Selina
Provost - Selina

Latest revision as of 21:12, 27 April 2026

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 - Marina, saxasm, Xoriet, Tebeat
Moderator - Callisto, Nijil1
Trainee Moderator - Brutus5149, Terekhov

----
NationStates

Empress - Syberis
Regent - Dio
Senator of Community and Military Affairs - Mouse490
Senator of Internal Affairs - Greyghost, Pathonia
Senator of Diplomatic Affairs - SeasonsofLove
Senator of Gameplay Affairs - Dushina
Senator of Roleplay Affairs - Arthropyria
Senate Advisor - Ivan Moldavi, Lord of Darkness

Praefectus - 

----
Cyber Nations

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

Exarch - jgolla, Llednar Twem, Edward I, Amyameretta

General - 
Colonel - 

Prefect - 
Tribune - Knight

----
Torn

Emperor - Jesse End
Regent - Selina, Terekhov
Imperial Officer of Economic Affairs - OsRavan
Imperial Officer of Internal Affairs - DeathlySmokey
Imperial Officer of Military Affairs - Callisto, Lord of Darkness, hessian01
Governor (Strength) - Pep_9090, Elegarth
Governor (Prosperity) - ortibeX
Governor (Endurance) - PANDA-
Governor (Valour) - Calirin
Leader (Serenity) - looneylew
Leader (Peace) - Cuatela
Councilor (Strength) - Severisen
Junior Councilor (Strength) - Jordi_Chin, Kitestaaa
Senior Councilor (Prosperity) - Grease_Monkey
Councilor (Prosperity) - 
Junior Councilor (Prosperity) - Studious, XxLightsoutxX, QIcelet
Senior Councilor (Endurance) - LLKnot
Councilor (Endurance) - DarkDefiance, Dangerous_Dan
Junior Councilor (Endurance) - Madd
Senior Councilor (Valour) - Brutus5149, Ryann
Councilor (Valour) - Canixe, g3jedi, Thelemite
Junior Councilor (Valour) - medevac
Councilor (Serenity) - looneylew
Advisor - jgolla, Xoriet, Nijil1

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

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