Moduł:Stopka: Różnice pomiędzy wersjami

Z Nonsensopedii, polskiej encyklopedii humoru
M (ech)
M (Wycofano ostatnie edycje użytkownika Stim, powód: nagroda za najdebilniejszą edycję roku idzie do)
Znacznik: rewert
 
(Nie pokazano 2 wersji utworzonych przez 2 użytkowników)
Linia 1: Linia 1:
local tools = require('Moduł:Narzędzia')
local tools = require('Moduł:Narzędzia')
local stopkaPortal = require('Moduł:Stopka portal')
local p = {}
local p = {}


Linia 49: Linia 50:
function p.stopka(frame)
function p.stopka(frame)
local args = tools.getArgs(frame)
local args = tools.getArgs(frame)
local text = ''
if args['lokalizacja'] then
if args['lokalizacja'] then
return doLocation(frame, args)
text = text .. doLocation(frame, args)
end
end
text = text .. stopkaPortal.getText()
-- TODO: stopka portalowa
return text
end
end



Aktualna wersja na dzień 06:01, 21 wrz 2022

Moduł szablonu {{Stopka}}. Zobacz też: Moduł:Stopka portal.


local tools = require('Moduł:Narzędzia')
local stopkaPortal = require('Moduł:Stopka portal')
local p = {}

local function doLocation(frame, args)
	local props = {}
	local name = mw.title.getCurrentTitle().fullText
	local ltype = 'landmark'
	props['Ma lokalizację'] = args['lokalizacja']
	
	if args['terc'] then
		local terc = args['terc']
		
		if #terc > 4 then
			ltype = 'adm3rd'	-- gmina jakowaś
		elseif #terc > 2 then
			ltype = 'adm2nd'	-- powiat
		else
			ltype = 'adm1st'	-- województwo
		end
	end
	
	if args['simc'] then
		props['SIMC'] = args['simc']
		ltype = 'city'
	end
	
	if args['wikidata'] then
		props['Ma identyfikator Wikidanych'] = args['wikidata']
	end
	
	if args['niepewne'] ~= nil then
		props['Ma niepewną lokalizację'] = true
	end
	
	mw.smw.set(props)
	local coords = mw.text.split(args['lokalizacja'], ',%s*')
	return frame:callParserFunction{ 
		name = '#coordinates', 
		args = {
    		coords[1],
    		coords[2],
    		'primary',
    		name = name,
    		type = ltype
		}
	}
end

function p.stopka(frame)
	local args = tools.getArgs(frame)
	local text = ''
	
	if args['lokalizacja'] then 
		text = text .. doLocation(frame, args)
	end
	
	text = text .. stopkaPortal.getText()
	return text
end

return p