Modulo:Bio/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
ciaffo |
ok sono soddisfatto e aggiorno |
||
Riga 139:
-- è ammessa l'iniziale maiuscola per i parametri per attività e nazionalità
-- (complicazione inutile. basta eliminare dalle voci le maiuscole esistenti)
end
end
for _, param in ipairs(nazionalitaParams) do
retArgs[param] = retArgs[param] and lang:lcfirst(retArgs[param])
end
Riga 190 ⟶ 189:
if args.ForzaOrdinamento then
sortkey = args.ForzaOrdinamento:gsub("(.-)%s*,%s*(.*)", "%1 ,%2")
elseif args.Soprannome and args.Cognome and currentTitleEquals(args.Soprannome .. " " .. args.Cognome) then
sortkey = mString.collate( { args = { args.Cognome .. " ," .. args.Soprannome } } )
elseif args.Pseudonimo and currentTitleEquals(args.Pseudonimo) then
local pseudonimo = mString.collate( { args = { args.Pseudonimo } } )
Riga 211 ⟶ 212:
end
end
self:_addAttivita(self.plurals)
self:_addNatiMorti()
self:_addCategory(cfg.categorie["bot"])
Riga 359 ⟶ 357:
function CategoryManager:_getPluralsAttivitaNazionalita()
local plurals = {}
local attnaznecessarie = not (args.Categorie == "no" and args.FineIncipit)
-- Nazionalità può essere vuota solo quando c'è Categorie=no e FineIncipit
if not args["Nazionalità"] and
addAvviso(cfg.warningN.testo .. cfg.warningN.testo2b .. cfg.warningN.testo3, "warning")
end
for _, nazionalita in ipairs(nazionalitaParams) do
if args[nazionalita] then
end
end
-- Attività può essere vuota solo quando c'è Categorie=no e FineIncipit
if not args["Attività"] and
addAvviso(cfg.warningA.testo .. cfg.warningA.testo2b .. cfg.warningA.testo3, "warning")
end
for _, attivita in ipairs(attivitaParams) do
if args[attivita] then
end
end
Riga 397 ⟶ 390:
annoNascita = annoNascita and tonumber(annoNascita) * -1
end
if
return "2000"
end
if not annoMorte and args.AnnoMorte then
annoMorte = args.AnnoMorte:match('^(%d+) a%.C%.$')
annoMorte = annoMorte and tonumber(annoMorte) * -1
Riga 417 ⟶ 413:
return ret
end
-- Aggiunge Categoria:X dei secoli, se esistono
function CategoryManager:_addCatSecolo(catname, epoca1, epoca2)
local ok = false
for _, epoca in ipairs({ epoca1, epoca2 }) do
if epoca and titleExists("Categoria:" .. catname .. " " .. epoca) then
self:_addCategory(catname .. " " .. epoca)
ok = true
end
end
return ok
end
-- Aggiunge le categorie: Attività nazionalità [del XYZ secolo]
function CategoryManager:_addAttivita(plurals)
local catname, epoca1, epoca2, added, addatt, addnaz, add1
addatt = {}
addnaz = {}
-- se Epoca e Epoca2 non sono stati inseriti dall'utente
-- e AnnoNascita e AnnoMorte cadono nello stesso secolo
-- calcola epoca1 automaticamente
if not args.Epoca and not args.Epoca2 and args.AnnoNascita
epoca1 = self:_getEpoca()
epoca1 = epoca1 and cfg.epoche[epoca1]
Riga 432 ⟶ 442:
epoca1 = args.Epoca and cfg.epoche[args.Epoca]
epoca2 = args.Epoca2 and cfg.epoche[args.Epoca2]
end
if not epoca1 and not epoca2 then
self:_addCategory(cfg.categorie["no-epoca"])
end
if args.Categorie ~= "no" then
if plurals[attivita] then
if plurals[nazionalita] then
catname = plurals[attivita] .. " " .. plurals[nazionalita]
-- se non è stata aggiunta la categoria per epoca1 e epoca2
-- aggiunge la cat. semplice, es. "Scrittori italiani"
add1 = true
addatt[attivita] = true
addnaz[nazionalita] = true
else
self:_addCategory(catname)
end
end
end
Riga 455 ⟶ 468:
end
end
-- in mancanza di "A N del S" prova "A del S" e "N del S"
for _, attivita in ipairs(attivitaParams) do
if plurals[attivita] and not addatt[attivita] then
add1 = self:_addCatSecolo(plurals[attivita], epoca1, epoca2) or add1
end
end
for _, nazionalita in ipairs(nazionalitaParams) do
if plurals[nazionalita] and not addnaz[nazionalita] then
add1 = self:_addCatSecolo(plurals[nazionalita], epoca1, epoca2) or add1
end
end
if not add1 then
self:_addCatSecolo("Persone", epoca1, epoca2)
end
end
Riga 583 ⟶ 612:
self:_addNomeCognome()
self:_addNascitaMorte()
if args.Soprannome or args.Pseudonimo or args.PostCognomeVirgola then
self:_addText(",")
end
Riga 649 ⟶ 678:
-- Restituisce true se text necessita di uno spazio iniziale (PostCognome, PostSoprannome, PostPseudonimo, LuogoNascitaAlt, NoteNascita, LuogoMorteAlt, NoteMorte, AttivitàAltre, PostNazionalità, FineIncipit)
function Incipit:_needSpace(text)
return mw.ustring.match(mw.ustring.sub(text, 1, 1), "%w") ~= nil or
Riga 691 ⟶ 720:
elseif args.Pseudonimo and currentTitleEquals(args.Pseudonimo) then
caption = args.Pseudonimo
elseif args.Soprannome and args.Cognome and currentTitleEquals(args.Soprannome .. " " .. args.Cognome) then
caption = args.Soprannome .. " " .. args.Cognome
elseif args.Soprannome and currentTitleEquals(args.Soprannome) then
caption = args.Soprannome
else
if args.CognomePrima and args.Nome and args.Cognome then
Riga 710 ⟶ 743:
-- parentesi () extra per non restituire anche il gsub.count
self:_addText( (cfg.didascalia2:gsub("$1", args.Didascalia2)) )
end
end
Riga 863 ⟶ 836:
-- si apre la parentesi
self:_addText(" (")
if args.PreData then
Riga 901 ⟶ 868:
end
else
self:_addText("...")
end
Riga 913 ⟶ 878:
end
if args.AnnoMorte
self:_addText(" – ")
if args.LuogoMorte then
Riga 936 ⟶ 901:
if args.AnnoMorte then
if args.AnnoMorte == "?"
self:_addText("...")
else
Riga 950 ⟶ 915:
-- se date ignote, usa Floruit o lo ricava da Epoca
if not args.AnnoNascita and args.AnnoMorte == "?" then
if not fl and cfg.epoche[args.Epoca] then
fl = mw.ustring.gsub(cfg.epoche[args.Epoca], "^del ?l?'?", "")
Riga 965 ⟶ 930:
fl = "[[" .. fl .. "]]"
end
self:_addText("; [[floruit|fl.]] ", fl)
end
end
|