Modulo:Vedi anche: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
lettera iniziale maiuscola o minuscola automatica, vedi richiesta
uniformo i template hatnote col template:Avviso permanente
 
(4 versioni intermedie di uno stesso utente non sono mostrate)
Riga 3:
]]
 
require('Modulo:No globalsstrict')
 
-- Parsifica un argomento del template (rappresenta il titolo di una pagina) e ne restituisce il wikilink.
Riga 10:
-- @return {string}
local function parseArg(arg)
local dest, count, obj, content
 
-- restituisce errore con wikilink a categorie
Riga 18:
 
-- rimuove eventuali pipe inserite tramite {{!}}
arg = arg:match('(.*-)|') or arg
-- sostituisce le HTML entity (per esempio ' generato da {{PAGENAME}} quando il titolo contiene l'apostrofo)
arg = mw.text.decode(arg)
-- crea oggetto per il titolo
obj = mw.title.new(mw.uri.decode(arg, 'PATH'))
-- sostituisce # con §, se trovato crea un piped wikilink
dest = arg
Riga 29:
 
-- converte la prima lettera in maiuscola o minuscola a seconda che la voce contenga il template Titolo minuscolo
ifcontent = obj and obj:getContent()
if content and content:match('{{%s*[Tt]itolo minuscolo%s*[|}]') then
arg = mw.getContentLanguage():lcfirst(arg)
else
Line 43 ⟶ 44:
-- @return {string}
local function buildHTML(wikitext)
return framemw.getCurrentFrame():extensionTag{
local tableNode = mw.html.create('table')
name = 'templatestyles',
tableNode
args = {src = styles}
:addClass('vedi-anche noprint')
local styles src = 'Modulo:Vedi anche/styles.css'
:tag('tr')
:tag('td')}
} .. mw.getCurrentFrame():expandTemplate{
:wikitext('[[File:Magnifying glass icon mgx2.svg|20px|class=noviewer|link=]]')
title = 'Avviso permanente',
:done()
:tag('td')args = {
:wikitext(immagine = '[[File:Magnifying glass icon mgx2.svg|20px|class=noviewer|link=]]'),
:wikitext(string.format("''Lo stesso argomento in dettaglio: %s''.", wikitext))
classe = 'noprint vedi-anche',
:done()
:wikitext(testo = string.format("''Lo stesso argomento in dettaglio: %s.''.", wikitext))
 
}
return tostring(tableNode)
}
end
 
Line 66 ⟶ 68:
function p.main(frame)
local lastArg, conjunction
local styles = 'Modulo:Vedi anche/styles.css'
local args = {}
 
Line 80 ⟶ 81:
end
 
} .. return buildHTML(mw.text.listToText(args, ', ', conjunction))
return frame:extensionTag{
name = 'templatestyles',
args = {src = styles}
} .. buildHTML(mw.text.listToText(args, ', ', conjunction))
end