Modulo:Citazione: Differenze 'mbrà revisiune
Contenuto cancellato Contenuto aggiunto
Provo ad aggiornare per vedere se il "cita_da_modulo" funzionasse sul Collegamenti esterni Tag: Annullate |
Repristine 'a revisione 138788 da S4b1nuz E.656 ('Ngazzaminde) Tag: Annulle |
||
Linea 3:
--[[ ===============================================================================
Variabile in cui vengono memorizzate le condizioni di errore registrate durante l'
delle funzioni del modulo.
===============================================================================]]
Linea 11:
message_tail = {}; -- messaggi di errore da visualizzare in coda alla citazione
}
--[[ ===============================================================================
Caricamente delle tabelle di configurazione del modulo.
===============================================================================]]
local cfg = mw.loadData( '
--[[ ===============================================================================
Lista di tutti i parametri riconosciuti.
===============================================================================]]
local whitelist = mw.loadData( '
--[[ ===============================================================================
Linée 468 ⟶ 453:
end
return table.concat({ "[", URL, " ", safe_for_url( label ), "]", error_str });
end
Linée 517 ⟶ 489:
if ( code == "A" ) then
return link_id({link=handler.link, label=handler.label,
pattern="[
encode = handler.encode})
elseif ( code == "M" ) then
return link_id({link=handler.link, label=handler.label,
pattern="[
encode = handler.encode})
elseif ( code == "W" ) then
return link_id({link=handler.link, label=handler.label,
pattern= "[
encode = handler.encode})
else
return link_id({link=handler.link, label=handler.label,
pattern= "[
encode = handler.encode}) ..
' ' .. set_error( 'bad_ol' );
Linée 670 ⟶ 642:
--[[ ===============================================================================
riformatta come dd mmmm yyyy
===============================================================================]]
local function get_date(str)
if is_set(str) then
local _, _, try_year, try_month, try_day = string.
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
end
Linée 705 ⟶ 672:
date = month .. " " .. year
if is_set(day) then
if day == "01" or day=="1" then day="1
date = day .. " " .. date
end
Linée 722 ⟶ 689:
local start = mw.ustring.sub(str, 1, 2)
if in_array( start, {'08', '8 ', '8-', '8/', '11'} ) then
return "
end
return
end
Linée 898 ⟶ 863:
===============================================================================]]
local function get_format(format, url)
local try_format = format
if not cfg.external_link_type[
if not cfg.external_link_type[
return ''
end
Linée 911 ⟶ 876:
-- Se il formato esterno è tra quelli previsti imita lo stile dei template {{PDF}} o {{doc}}
local f = cfg.external_link_type[
if f then
return mw.ustring.format(' (<span style="font-weight: bolder; font-size:80%%"><abbr title="%s">%s</abbr></span>)', f.text, f.label)
else
table.insert( z.message_tail, { set_error('unknown_format',
return mw.ustring.format(' (%s)',
end
end
Linée 968 ⟶ 933:
local Illustrator = A['Illustrator'];
local Translator = A['Translator'];
if is_set(OriginalTitle) and not is_set(TransTitle) then
TransTitle = Title
Title = OriginalTitle end
Linée 989 ⟶ 954:
Position = PPPrefix .. Position
elseif PositionOrigin ~= "posizione" then
if
Position = PPrefix .. Position
end
elseif (config.CitationClass=="conferenza" or config.CitationClass== "pubblicazione") and PositionOrigin=="pagine" then
if tonumber(Position) then
Position = PPrefix .. Position
else
Position = PPPrefix .. Position
end
elseif PositionOrigin == "pagina" then
Linée 1 072 ⟶ 1 038:
end
else
if is_set(Volume) then
if tonumber(Volume
Volume = "vol. " .. Volume
end
end
if is_set(Issue) then
if tonumber(Issue
Issue = "n
end
end
Linée 1 091 ⟶ 1 056:
local Via = A['Via'];
-- local Agency = A['Agency'];
local DeadURL = A['DeadURL']
local Language = A['Language'];
local Format = A['Format'];
Linée 1 102 ⟶ 1 067:
local sepc = Style.sep
local sepcspace = sepc .. " "
local PostScript = first_set(A['PostScript'], Style['postscript'])
local no_tracking_cats = A['NoTracking'];
local use_lowercase = ( sepc ~= '.' );
Linée 1 109 ⟶ 1 074:
local ID_list = extract_ids( args );
if ( isPubblicazione ) then
if not is_set(URL) and
local Embargo = A['Embargo'];
local lang = mw.getContentLanguage();
URLorigin = cfg.id_handlers['PMC'].parameters[1];
end
else
URL = "
URLorigin = cfg.id_handlers['
end
end
Linée 1 149 ⟶ 1 109:
TransTitle = '';
Series = '';
end
Linée 1 168 ⟶ 1 115:
------------------------------------------------------------------------------
local auto_Periodical = false
if
Periodical = mw.ustring.match(URL, "//([^/#%?]*)") or ''
-- tolgo anche eventuale www.
Linée 1 180 ⟶ 1 127:
auto_Periodical = true
end
------------------------------------------------------------------------------
Linée 1 202 ⟶ 1 139:
TitleLink = '';
TransTitle = '';
end
Linée 1 266 ⟶ 1 156:
-- If the coauthor field is also used, prevent adding ''et al.''
if is_set(Coauthors) then
control.coauthors = true
elseif is_set(Etal) then
Linée 1 347 ⟶ 1 236:
not is_set(ArchiveURL) and
not is_set(ConferenceURL) then
--
if
table.insert( z.message_tail, { set_error( 'cite_web_url', {}, true ) } );
end
Linée 1 439 ⟶ 1 328:
end
elseif is_set(URL) then
Chapter = external_link( URL, Chapter ) .. TransError .. Format;
URL = "";
Format = "";
Linée 1 470 ⟶ 1 357:
Title = "[[" .. TitleLink .. "|" .. Title .. "]]"
elseif is_set(URL) then
Title = external_link( URL, Title ) .. TransError .. Format
URL = "";
Format = "";
Linée 1 489 ⟶ 1 374:
elseif is_set(ConferenceURL) then
Conference = external_link( ConferenceURL, nil, ConferenceURLorigin );
end
---------------------------------------------------------------
-- Compone la stringa del linguaggio
---------------------------------------------------------------
local Language_code = ""
if is_set(Language) then
if Language:sub(1,1) == "(" then
Language_code = Language
else
local frame_lingue = {return_error='true', usacodice='sì'}
for lingua in mw.ustring.gmatch(Language, "%S+") do
frame_lingue[#frame_lingue+1] = lingua
end
if #frame_lingue > 1 or (#frame_lingue==1 and frame_lingue[1]:lower()~="it") then
local lg_error
Language_code, lg_error = require("Modulo:Linguaggi").lingue(frame_lingue)
if lg_error and #lg_error > 0 then
local error_string = mw.text.listToText(lg_error, ", ", " e " )
table.insert( z.message_tail, { set_error('unknown_language', {error_string}, true) } );
end
end
end
end
if is_set(Edition) then
if A:ORIGIN('Edition') == "ed" or tonumber(Edition) then
Edition = Edition .. "ª ed."
end
end
Linée 1 521 ⟶ 1 435:
local Archived
if is_set(ArchiveURL) then
if not is_set(ArchiveDate) then
ArchiveDate =
end
ArchiveURL2 = A['ArchiveURL2']
if is_set(ArchiveURL2) then
ArchiveDate2 = A['ArchiveDate2']
if not is_set(ArchiveDate2) then
ArchiveDate2 =
end
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 .. " " .. set_error('archive_missing_url
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
if is_set(ArchiveURL2) then
Archived = Archived .. ". " .. substitute(cfg.messages['archived-second-copy'],
{ external_link( ArchiveURL2, cfg.messages['archived2']), ArchiveDate2, article_date(ArchiveDate2) } );
end
else
Linée 1 585 ⟶ 1 484:
-- Several of the above rely upon detecting this as nil, so do it last.
if is_set(Periodical) then Periodical = wrap( 'italic-title', Periodical ) end
if config.CitationClass=="news" and is_set(Place) then
if is_set(Periodical) then
Periodical = table.concat({Periodical, ' (', Place, ')'})
Place = ""
elseif is_set(Title) then
Title = table.concat({Title, ' (', Place, ')'})
Place = ""
end
end
-- set translator / illustrator
Linée 1 643 ⟶ 1 551:
end
end
fragment_citation:appends( { Conference, Periodical, Translator, Illustrator, Others, Series,
Volume, Issue, Edition
local fragment_ID_list = Fragment.new(ID_list, sepc):append(ID):start(",")
local fragment_URL = Fragment.new(URL):start(",")
local
local fragment_Quote = Fragment.new({Quote}):start(".")
fragment_citation:appends({fragment_ID_list, fragment_URL,
if PostScript == 'nessuno' then
fragment_citation:last("nothing")
Linée 1 659 ⟶ 1 565:
fragment_citation:start(" ")
local text = Language_code .. tostring(fragment_citation)
--
if config.CitationClass == "video" then text = cfg.messages['icon_video']
if config.CitationClass == "audio" then text = cfg.messages['icon_audio']
-- Now enclose the whole thing in a <span/> element
Linée 1 767 ⟶ 1 673:
else
if #suggestions == 0 then
suggestions = mw.loadData( 'Modulo:Citazione/Suggerimenti' );
end
if suggestions[ k:lower() ] ~= nil then
Linée 1 795 ⟶ 1 700:
end
-- Funzione per generare direttamente una citazione web da un altro modulo
function z.
return citation0( {CitationClass = 'web'}, args )
end
|