Modulo:Citazione: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
correggo funzione get_format |
correggo resa grafica degli archivi; aggiungo decodifica della data archivio + categorie per parametri deprecati; gestisco codici lingua con virgola |
||
Riga 3:
--[[ ===============================================================================
Variabile in cui vengono memorizzate le condizioni di errore registrate durante l'
delle funzioni del modulo.
===============================================================================]]
Riga 642:
--[[ ===============================================================================
che 01 e 1 siano resi come 1º qualora indichino il giorno.
===============================================================================]]
local function get_date(str)
if is_set(str) then
local
if try_day then
local Month = cfg.months[tonumber(try_month)]
if Month then
return string.format("%s %s %s", try_day, Month, try_year
end
end▼
try_day, try_month, try_year = string.match(str, '^(%d%d?) (%a+) (%d%d%d%d)$')
if try_day then
try_day = (try_day == '1' or try_day == '01') and '1º' or tonumber(try_day)
return string.format("%s %s %s", try_day, try_month, try_year)
end
end
Line 672 ⟶ 677:
date = month .. " " .. year
if is_set(day) then
if day == "01" or day=="1" then day="1
date = day .. " " .. date
end
Line 689 ⟶ 694:
local start = mw.ustring.sub(str, 1, 2)
if in_array( start, {'08', '8 ', '8-', '8/', '11'} ) then
return " l'"
elseif mw.ustring.find(str, '^pre ') then -- per i valori "pre x/x/x" inseriti da ArchiveBot
return ' in data '
end
return str ~= '' and " il " or ''
end
Line 954 ⟶ 961:
Position = PPPrefix .. Position
elseif PositionOrigin ~= "posizione" then
if config.CitationClass == "libro" then
Position = PPrefix .. Position▼
Position =
end▼
elseif (config.CitationClass=="conferenza" or config.CitationClass== "pubblicazione") and PositionOrigin=="pagine" then▼
end
▲ if tonumber(Position) then
▲ elseif
Position = (tonumber(Position) and PPrefix or PPPrefix) .. Position
▲ else
end
elseif PositionOrigin == "pagina" then
Line 1 156 ⟶ 1 162:
-- If the coauthor field is also used, prevent adding ''et al.''
if is_set(Coauthors) then
table.insert( z.error_categories, 'Voci con modulo citazione e parametro ' .. A:ORIGIN('Coauthors') )
control.coauthors = true
elseif is_set(Etal) then
Line 1 384 ⟶ 1 391:
Language_code = Language
else
local frame_lingue = {return_error='true
local iterator = comma and
frame_lingue[#frame_lingue+1] = lingua▼
mw.text.gsplit(Language, ',', true) or
mw.ustring.gmatch(Language, "%S+")
for lingua in iterator do
lingua = mw.text.trim(lingua)
if lingua ~= '' then
▲ frame_lingue[#frame_lingue+1] = lingua
▲ end
end
if not comma and #frame_lingue > 1 then
table.insert( z.error_categories, 'Voci con modulo citazione e valori lingua da separare con virgola' )
end
if #frame_lingue > 1 or (#frame_lingue==1 and frame_lingue[1]:lower()~="it") then
Line 1 435 ⟶ 1 452:
local Archived
if is_set(ArchiveURL) then
local decodeArchiveDate = require('Modulo:Webarchive').decodeArchiveDate
local ArchiveURLDate = decodeArchiveDate(ArchiveURL)
local ArchiveError, ArchiveOutput = ''
if not is_set(ArchiveDate) then
ArchiveDate =
if not ArchiveURLDate then
ArchiveError = set_error('archive_missing_date', {}, false, ' ')
end
elseif ArchiveURLDate and ArchiveURLDate ~= ArchiveDate then
ArchiveError = set_error('date_mismatch', {ArchiveURLDate}, false, ' ')
end
ArchiveOutput = ArchiveDate .. ArchiveError
local ArchiveURL2 = A['ArchiveURL2']
if is_set(ArchiveURL2) then
local ArchiveURLDate2 = decodeArchiveDate(ArchiveURL2)
▲ ArchiveDate2 = A['ArchiveDate2']
local ArchiveError2, ArchiveOutput2 = ''
if not is_set(ArchiveDate2) then
ArchiveDate2 =
if not ArchiveURLDate2 then
ArchiveError2 = set_error('archive_missing_date2', {}, false, ' ')
end
elseif ArchiveURLDate2 and ArchiveURLDate2 ~= ArchiveDate2 then
ArchiveError2 = set_error('date2_mismatch', {ArchiveURLDate2}, false, ' ')
end
ArchiveOutput2 = ArchiveDate2 .. ArchiveError2
{ external_link( ArchiveURL2, cfg.messages['archived2']),
end
if not DeadURL then
Archived = substitute( cfg.messages['archived-not-dead'],
{ external_link( ArchiveURL, cfg.messages['archived'] ),
if not is_set(OriginalURL) then
Archived = Archived
end
elseif is_set(OriginalURL) then
Archived = substitute( cfg.messages['archived-dead'],
{ OriginalURL,
else
Archived = substitute( cfg.messages['archived-missing'],
{ set_error('archive_missing_url'),
▲ end
▲ Archived = Archived .. ". " .. substitute(cfg.messages['archived-second-copy'],
▲ { external_link( ArchiveURL2, cfg.messages['archived2']), ArchiveDate2, article_date(ArchiveDate2) } );
end
else
Line 1 555 ⟶ 1 587:
local fragment_ID_list = Fragment.new(ID_list, sepc):append(ID):start(",")
local fragment_URL = Fragment.new(URL):start(",")
local
local fragment_Archived = Fragment.new(Archived):start(' ')
local fragment_Via = Fragment.new(Via):start(".")
local fragment_Quote = Fragment.new({Quote}):start(".")
fragment_citation:appends({fragment_ID_list, fragment_URL,
if PostScript == 'nessuno' then
fragment_citation:last("nothing")
|