Technopedia Center
PMB University Brochure
Faculty of Engineering and Computer Science
S1 Informatics S1 Information Systems S1 Information Technology S1 Computer Engineering S1 Electrical Engineering S1 Civil Engineering

faculty of Economics and Business
S1 Management S1 Accountancy

Faculty of Letters and Educational Sciences
S1 English literature S1 English language education S1 Mathematics education S1 Sports Education
teknopedia

teknopedia

teknopedia

teknopedia

teknopedia

teknopedia
teknopedia
teknopedia
teknopedia
teknopedia
teknopedia
  • Registerasi
  • Brosur UTI
  • Kip Scholarship Information
  • Performance
  1. Weltenzyklopädie
  2. Modulo:Tassobox - Teknopedia
Modulo:Tassobox - Teknopedia
Info Istruzioni per l'uso
Questo è un modulo scritto in Lua. Le istruzioni che seguono sono contenute nella sottopagina Modulo:Tassobox/man (modifica · cronologia)
Sandbox: Modulo:Tassobox/sandbox (modifica · cronologia) · Sottopagine: lista · Test: Modulo:Tassobox/test (modifica · cronologia · esegui)

Modulo a supporto del template {{Tassobox}}.

Ha una sottopagina di configurazione: Modulo:Tassobox/Configurazione.



--[[  
Questo modulo è in appoggio al template Tassobox 
]]

local p = {}
local cfg = mw.loadData("Modulo:Tassobox/Configurazione")
local getArgs = require('Module:Arguments').getArgs

local function check_value(valore)
	return valore and cfg.missing_table[mw.ustring.lower(valore)]
end

--===================================================================
-- Richiamo di un'immagine di file mancante appropriata al 
-- regno/phylum/classe/ordine/ecc della voce in cui è inserito
-- il tassobox
--===================================================================
function p.missing_image(frame)
	local args = getArgs(frame, {wrapper = 'Template:Tassobox'})
	local missing_link
	-- testa in ordine dal più specifico al più generico la classificazione di un essere vivente
	for _,test in ipairs(cfg.param_to_check) do
		missing_link = args[test] and check_value(args[test])
		if missing_link then break end
	end 
	-- se ha non trovato il valore nella tabella ricade nell'immagine di default
	missing_link = missing_link or "File:Unknown missing 1.png"
	return mw.ustring.format('[[%s|220px|Immagine di %s mancante|class=skin-invert itwiki-preserve-color]]', missing_link,  mw.title.getCurrentTitle().text)
end

----------------------------------------------------------------------------------
-- Ritorna la configurazione della tabella per le ere geologiche
----------------------------------------------------------------------------------
function p.ere_geologiche_table(frame)
-- Restituisce una tabella delle ere geologiche presenti in configurazione
 
	local root = mw.html.create('table')
	root
		:addClass('wikitable sortable')
		:tag('tr')
			:tag('th'):wikitext('Era'):done()
			:tag('th'):wikitext('Inizio'):done()
			:tag('th'):wikitext('Successiva'):done()
			:tag('th'):wikitext('Colore'):done()
	for name, values in pairs(cfg.ere_geologiche) do
		local start = values['start'] or "?"
		local next_era = values['next_era'] or "?"
		local color 
		if values['color'] then 
			color = mw.html.create('span')
				:cssText("display:inline-block;border:solid grey 1px;width:1em;height:1em")
				:css('background', values['color'])
				:wikitext(' ')
		else
			color = mw.html.create('span'):done()
		end
		root:tag('tr')
			:tag('td'):wikitext(name):done()
			:tag('td'):css('text-align', 'right'):wikitext(start):done()
			:tag('td'):wikitext(next_era):done()
			:tag('td'):css('text-align', 'center'):node(color)
	end
	return tostring(root)
end

--===================================================================
-- Genera lo stato di conservazione di uno specie
--===================================================================
function p.stato_conservazione(frame)

	local args = getArgs(frame, {wrapper = 'template:Tassobox'})
	local statocons = args.statocons
	if statocons == nil then return end
	local iucn =  { ['iucn2.3'] = true, ['iucn3.1'] = true}
	statocons = mw.ustring.lower(statocons)
	statocons = cfg.stato_alias[statocons] or statocons
	local row_stato = cfg.stato[statocons]
	if row_stato == nil then 
		local cat_error = ''
		if mw.title.getCurrentTitle().namespace == 0 then
			cat_error = '[[Categoria:Errori di compilazione del template Tassobox]]'
		end
		return '<strong class=\"error\">Parametro statocons non valido</div>' .. cat_error 
	end
	local immagine = ''
	if row_stato.image then
		if row_stato.versione then 
			local versione = args.statocons_versione or ''
			versione = (iucn[versione] and versione) or (statocons == 'ex' and 'none') or 'iucn3.1'
			if versione == 'none' then 
				immagine = 'Status_none_EX.svg'
			else
				immagine = mw.ustring.format(row_stato.image, versione)
			end
		else
			immagine = row_stato.image
		end
		immagine = '<div>\[\[Image:' .. immagine .. '|200px\]\]</div>'
	end
	local ref = args.statocons_ref
	ref = (ref and  '<span style=font-size:80%>' .. ref .. '</span>') or '' 
	local dataestinzione = ''
	if row_stato.data then
		dataestinzione = (row_stato.pre_data and ' ' .. row_stato.pre_data) or dataestinzione
		dataestinzione = (args.dataestinzione and mw.ustring.format(row_stato.data, args.dataestinzione)) or dataestinzione
		dataestinzione = mw.ustring.format('<span style="color:%s;">%s</span>', row_stato.color_data or row_stato.color, dataestinzione)
	end
	local base_msg = 
'<div style="margin:0 auto; text-align:center;%s" class="skin-invert itwiki-preserve-color">'..
	'%s<div style="color:%s;font-weight:bold;">%s%s%s</div>' ..
'</div>'
	return mw.ustring.format(base_msg, ((immagine and 'background:white;') or ''), immagine, row_stato.color, row_stato.text, dataestinzione, ref)
end

return p
Estratto da "https://it.wikipedia.org/w/index.php?title=Modulo:Tassobox&oldid=142059509"

  • Indonesia
  • English
  • Français
  • 日本語
  • Deutsch
  • Italiano
  • Español
  • Русский
  • فارسی
  • Polski
  • 中文
  • Nederlands
  • Português
  • العربية
Pusat Layanan

UNIVERSITAS TEKNOKRAT INDONESIA | ASEAN's Best Private University
Jl. ZA. Pagar Alam No.9 -11, Labuhan Ratu, Kec. Kedaton, Kota Bandar Lampung, Lampung 35132
Phone: (0721) 702022