Modulo:Interprogetto: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Moroboshi (discussione | contributi)
Nessun oggetto della modifica
Moroboshi (discussione | contributi)
Nessun oggetto della modifica
Riga 10:
--Tabella di corrispondenza tra valore e file da richiamare
local prefix_links ={
wiksource = {1, 's:', 'Wikisource' },
s = {2, 's:', 'Wikisource'},
testo = {3, 's:', 'Wikisource'},
oldwikisource = {4, 'oldwikisource:', 'Wikisource'},
wikiquote = {5, 'q:', 'Wikiquote'},
q = {6, 'q:', 'Wikiquote'},
wikibooks = {7, 'wikibooks:', 'Wikibooks'},
b = {8, 'b:', 'Wikibooks'},
ricetta = {9, 'b:Libro di cucina/Ricette/', 'Ricetta<br />(Wikibooks)'},
wiktionary = {10, 'wiktionary:', 'Wikizionario'},
wikt = {11, 'wikt:', 'Wikizionario'},
v = {12, 'v:', 'Wikiversità'},
wikinews = {13, 'wikinews:', 'Wikinotizie'},
n = {14, 'n:', 'Wikinotizie'},
voy = {15, 'voy:', 'Wikivoyage'}
}
--TODO collegamenti che usano Interprogetto/CollegamentoUseLang
 
local function sort_by_priority(t1, t2)
if t1[1] < t2[1] then
return endtrue
end
end
 
local function RenderLeftBar()
Riga 38 ⟶ 44:
.tag('div')
.attr('title', 'Collegamenti verso gli altri progetti Wikimedia')
-- costruisce le righe per la barra di sinistra
local first_linkleft_rows = true{ }
for k,v in pairs(args) do
if prefix_links[k] then
priority, prefix, label = unpack(prefix_links[k])
leftbartable.wikitextinsert(left_rows, {priority, '* [[' .. prefix .. v .. '|' .. label .. ']]'})
if first_link then
leftbar.newline().done()
else
first_link = true
end
leftbar.wikitext('* [[' .. prefix .. v .. '|' .. label .. ']]')
end
end
table.sort(left_rows, sort_by_priority)
for priority, row in #leftbar do
leftbar.newline().donewikitext(row)
end
end
Riga 73 ⟶ 79:
current_page = mw.title.getCurrentTitle().text
for k, v in pairs(origArgs) do
-- controlla se è un parametro posizionale e sein siquesto salvacaso illa suo valorememorizza come chiave
-- chiave con valore pari al nome della pagina corrente
 
local kn = tonumber(k)
if kn then