Module:Scriptor/CivitatemQuaero

E Wikisource

Documentation for this module may be created at Module:Scriptor/CivitatemQuaero/doc

p = {}

function p.civitas(x, y, z, s)
	if string.find(x, "anglia") or string.find(x, "anglicus") then
		natio_adj = "Anglicus"; natio_gen = "Angliae"
	elseif string.find(x, "arabicus") or string.find(x, "arabus") or string.find(x, "arabia") then
		natio_adj = "Arabicus"; natio_gen = "Arabicorum"
	elseif string.find(x, "austria") or string.find(x, "austriacus") then
		natio_adj = "Austriacus"; natio_gen = "Austriae"
	elseif string.find(x, "belgica") or string.find(x, "belgicus") then
		natio_adj = "Belgicus"; natio_gen = "Belgicae"
	elseif string.find(x, "brasilia") or string.find(x, "brasilianus") then
		natio_adj = "Brasilianus"; natio_gen = "Brasiliae"
	elseif string.find(x, "cambria") or string.find(x, "cambricus") then
		natio_adj = "Cambricus"; natio_gen = "Cambriae"
	elseif string.find(x, "canada") or string.find(x, "canadensis") then
		natio_adj = "Canadensis"; natio_gen = "Canadae"
	elseif string.find(x, "cechia") or string.find(x, "cechus") or string.find(x, "bohemia") or string.find(x, "bohemus") then
		natio_adj = "Bohemus"; natio_gen = "Cechiae"
	elseif string.find(x, "america") or string.find(x, "civitates foederatae") or string.find(x, "americanus") or string.find(x, "civitatum foederatarum") then
		natio_adj = "Americanus"; natio_gen = "Civitatum Foederatarum"
	elseif string.find(x, "croatia") or string.find(x, "croatus") or string.find(x, "dalmatia") or string.find(x, "dalmata") then
		natio_adj = "Croatus"; natio_gen = "Croatiae"
	elseif string.find(x, "dania") or string.find(x, "danicus") then
		natio_adj = "Danicus"; natio_gen = "Daniae"
	elseif string.find(x, "francia") or string.find(x, "francicus") or string.find(x, "francogallicus") or string.find(x, "gallicus") then
		natio_adj = "Francicus"; natio_gen = "Franciae"
	elseif string.find(x, "francus") or string.find(x, "francorum") or string.find(x, "frank") then
		natio_adj = "Francus"; natio_gen = "Francorum"
	elseif string.find(x, "germania") or string.find(x, "germanicus") or string.find(x, "german") then
		natio_adj = "Germanicus"; natio_gen = "Germaniae"
	elseif string.find(x, "ostrogothus") then
		natio_adj = "Ostrogothus"; natio_gen = "Gothorum"
	elseif string.find(x, "visigothus") then
		natio_adj = "Visigothus"; natio_gen = "Gothorum"
	elseif string.find(x, "gothus") or string.find(x, "gothicus") or string.find(x, "gothorum") then
		natio_adj = "Gothus"; natio_gen = "Gothorum"
	elseif string.find(x, "graecia") or string.find(x, "graecus") then
		natio_adj = "Graecus"; natio_gen = "Graeciae"
	elseif string.find(x, "constantinopolis") or string.find(x, "constantinopolitanus") or string.find(x, "byzantinus") then
		natio_adj = "Byzantinus"; natio_gen = "Graeciae"
	elseif string.find(x, "helvetia") or string.find(x, "helveticus") then
		natio_adj = "Helveticus"; natio_gen = "Helvetiae"
	elseif string.find(x, "hispania") or string.find(x, "hispanicus") then
		natio_adj = "Hispanicus"; natio_gen = "Hispaniae"
	elseif string.find(x, "hibernia") or string.find(x, "hibernicus") or string.find(x, "eriugena") or string.find(x, "eriugenus") then
		natio_adj = "Hibernicus"; natio_gen = "Hiberniae"
	elseif string.find(x, "hungaria") or string.find(x, "ungaria") or string.find(x, "hungaricus") or string.find(x, "ungaricus") then
		natio_adj = "Hungaricus"; natio_gen = "Hungariae"
	elseif string.find(x, "irania") or string.find(x, "persia")  or string.find(x, "persicus") or string.find(x, "persa") or string.find(x, "persianus") or string.find(x, "iranianus") then
		natio_adj = "Persicus"; natio_gen = "Iraniae"
	elseif string.find(x, "israel") or string.find(x, "israhel") or string.find(x, "israelis") or string.find(x, "israelianus") or string.find(x, "iudaea") or string.find(x, "iudaeus") then
		natio_adj = "Israëlis"; natio_gen = "Israelis"
	elseif string.find(x, "italia") or string.find(x, "italicus") or string.find(x, "genuensis") or string.find(x, "dicio pontificia") then
		natio_adj = "Italicus"; natio_gen = "Italiae"
	elseif string.find(x, "lituania") or string.find(x, "lithuania") or string.find(x, "lithuanicus") or string.find(x, "lituanicus") then
		natio_adj = "Lituanicus"; natio_gen = "Lituaniae"
	elseif string.find(x, "moldavia") or string.find(x, "moldova") or string.find(x, "moldavicus") or string.find(x, "moldavus") then
		natio_adj = "Moldavicus"; natio_gen = "Moldaviae"
	elseif string.find(x, "nederlandia") or string.find(x, "batavia") or string.find(x, "nederlandicus") or string.find(x, "batavus") then
		natio_adj = "Nederlandicus"; natio_gen = "Nederlandiae"
	elseif string.find(x, "polonia") or string.find(x, "polonicus") or string.find(x, "polonus") then
		natio_adj = "Polonicus"; natio_gen = "Poloniae"
	elseif string.find(x, "portugallia") or string.find(x, "portugalia") or string.find(x, "lusitania") or string.find(x, "lusitanicus") or string.find(x, "lusitanus") or string.find(x, "portugalicus") or string.find(x, "portugallicus") then
		natio_adj = "Lusitanus"; natio_gen = "Portugalliae"
	elseif string.find(x, "roma") or string.find(x, "romanus") or string.find(x, "latinus") then 
		natio_adj = "Romanus"; natio_gen = "Romae antiquae"
	elseif string.find(x, "russia") or string.find(x, "rossia") or string.find(x, "ruthenia") or string.find(x, "russicus") or string.find(x, "rossicus") or string.find(x, "ruthenicus") then
		natio_adj = "Russicus"; natio_gen = "Russiae"
	elseif string.find(x, "scotia") or string.find(x, "scotus") then
		natio_adj = "Scotus"; natio_gen = "Scotiae"
	elseif string.find(x, "suecia") or string.find(x, "suetia") or string.find(x, "suecicus") or string.find(x, "suecicus") then
		natio_adj = "Suecicus"; natio_gen = "Sueciae"
	elseif string.find(x, "syrus") or string.find(x, "syria") or string.find(x, "syriacus") then
		natio_adj = "Syriacus"; natio_gen = "Syriae"
	
	else
		natio_adj = ""; natio_gen = "civitatis incognitae"
	end
	if s == "femininus" then --fix the adjective in the feminine form, for female authors ('s' is the value of P21 on wikidata)
		if string.sub(natio_adj, -2) == "us" then
				natio_adj = mw.ustring.gsub(natio_adj, "us$", "a")
		end
	end
	
	natio_cat = "[[Categoria:Scriptores ".. natio_gen.. "|".. y.. "]]"
	
	if z == "adj" then 
		return natio_adj end
	
	if z == "cat" then 
		return natio_cat end

	end
return p