Modifica di Modulo:Citation/CS1/Date validation

Attenzione: non hai effettuato l'accesso. Se effettuerai delle modifiche il tuo indirizzo IP sarà visibile pubblicamente. Se accedi o crei un'utenza, le tue modifiche saranno attribuite al tuo nome utente, insieme ad altri benefici.

Questa modifica può essere annullata. Controlla le differenze mostrate sotto fra le due versioni per essere certo che il contenuto corrisponda a quanto desiderato, e quindi pubblicare le modifiche per completare la procedura di annullamento.

Versione attuale Il tuo testo
Riga 627: Riga 627:


if 13 > tonumber(year2) then return false; end -- don't allow 2003-05 which might be May 2003
if 13 > tonumber(year2) then return false; end -- don't allow 2003-05 which might be May 2003
year2 = century .. year2; -- add the century to year2 for comparisons
year2 = century .. year2; -- add the century to year2 for comparisons
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
Riga 639: Riga 639:
else
else
return false; -- date format not one of the MOS:DATE approved formats
return false; -- date format not one of the MOS:DATE approved formats
end
if param ~= 'date' then -- CITEREF disambiguation only allowed in |date=; |year= & |publication-date= promote to date
if anchor_year:match ('%l$') then
return false;
end
end
end


Riga 1 108: Riga 1 102:
xlate = is_xlateable (month); -- get translate <month>; returns translation or nil
xlate = is_xlateable (month); -- get translate <month>; returns translation or nil
-- if cfg.date_names.en.long[month] then -- long month dates
-- if cfg.date_names.inv_local_long[cfg.date_names.en.long[month]] then
-- xlate = cfg.date_names.inv_local_long[cfg.date_names.en.long[month]];
-- end
---- mode = 'F'; -- English name is long so use long local name
-- elseif cfg.date_names.en.short[month] then -- short month dates
-- if cfg.date_names.inv_local_short[cfg.date_names.en.short[month]] then
-- xlate = cfg.date_names.inv_local_short[cfg.date_names.en.short[month]];
-- end
---- mode = 'M'; -- English name is short so use short local name
-- elseif cfg.date_names.en.quarter[month] then -- quarter dates
-- if cfg.date_names.inv_local_quarter[cfg.date_names.en.quarter[month]] then
-- xlate = cfg.date_names.inv_local_quarter[cfg.date_names.en.quarter[month]];
-- end
-- elseif cfg.date_names.en.season[month] then -- season dates
-- if cfg.date_names.inv_local_season[cfg.date_names.en.season[month]] then
-- xlate = cfg.date_names.inv_local_season[cfg.date_names.en.season[month]];
-- end
-- elseif cfg.date_names.en.named[month] then -- named dates
-- if cfg.date_names.inv_local_named[cfg.date_names.en.named[month]] then
-- xlate = cfg.date_names.inv_local_named[cfg.date_names.en.named[month]];
-- end
-- else
-- xlate=nil; -- not an English month name; could be local language month name
---- mode = nil; -- not an English month name; could be local language month name or an English season name
-- end
if xlate then
if xlate then
-- if mode then -- might be a season
-- xlate = lang_object:formatDate(mode, '1' .. month); -- translate the month name to this local language
date = mw.ustring.gsub (date, month, xlate); -- replace the English with the translation
date = mw.ustring.gsub (date, month, xlate); -- replace the English with the translation
date_parameters_list[param_name].val = date; -- save the translated date
date_parameters_list[param_name].val = date; -- save the translated date
Per favore tieni presente che tutti i contributi a Tematiche di genere si considerano pubblicati nei termini d'uso della licenza Creative Commons Attribuzione-Condividi allo stesso modo (vedi Tematiche di genere:Copyright per maggiori dettagli). Se non desideri che i tuoi testi possano essere modificati e ridistribuiti da chiunque senza alcuna limitazione, non inviarli qui.
Inviando il testo dichiari inoltre, sotto tua responsabilità, che è stato scritto da te personalmente oppure è stato copiato da una fonte di pubblico dominio o similarmente libera. Non inviare materiale protetto da copyright senza autorizzazione!
Annulla Guida (si apre in una nuova finestra)

Template utilizzato in questa pagina: