Modulo:Citazione: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica |
m una versione importata |
||
(7 versioni intermedie di 2 utenti non mostrate) | |||
Riga 26:
--[[ ===============================================================================
===============================================================================]]
local cfg = mw.loadData('Module:Citazione/Configurazione')
Riga 517:
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' );
Riga 764:
if is_set(first) then
if invertorder then first, last = last, first end
fullname =
else
fullname =
end
if is_set(person.link) then fullname = table.concat({"[[", person.link, "|", fullname, "]]"}) end
Riga 799:
Estrae una lista di nomi (autori o editori) dalla lista argomenti
===============================================================================]]
local function extract_names(args, list_name, parent_name)
local names = {};
local i = 1;
local last;
local parameters = {
first = cfg.aliases[list_name .. '-First'],
last = cfg.aliases[list_name .. '-Last'],
link = cfg.aliases[list_name .. '-Link'],
}
if parent_name then
for k, t in pairs(parameters) do
local new_values = {}
for _, v in ipairs(t) do
table.insert( new_values, substitute(v, parent_name) )
end
parameters[k] = new_values
end
end
while true do
last = select_one( args,
if not is_set(last) then
local first = select_one( args,
if not is_set(first) then
break;
Line 814 ⟶ 829:
last = first,
first = '',
link = select_one( args,
}
end
Line 820 ⟶ 835:
names[i] = {
last = last,
first = select_one( args,
link = select_one( args,
};
end
Line 827 ⟶ 842:
end
return names;
end
Line 950 ⟶ 954:
local Others = A['Others'];
local Editors = A['Editors'];
local e = extract_names( args, 'EditorList' );
Line 1 179 ⟶ 1 182:
------------------------------------------------------------------------------
local auto_Periodical = false
if in_array(config.CitationClass, {'web'}) and not is_set(Periodical
Periodical = mw.ustring.match(URL, "//([^/#%?]*)") or ''
-- tolgo anche eventuale www.
Line 1 186 ⟶ 1 189:
end
-- evito ripetizione se il dominio è stato usato come titolo o editore
if
if mw.ustring.lower(Title) == mw.ustring.lower(Periodical) then
Periodical = ''
end
if mw.ustring.lower(PublisherName) == mw.ustring.lower(Periodical) then
PublisherName = ''
end
end
auto_Periodical = true
Line 1 216 ⟶ 1 224:
---------------------------------------------------------------
-- Compone la stringa
---------------------------------------------------------------
local Language_code = ""
Line 1 234 ⟶ 1 242:
first_language = frame_lingue[1]:lower();
local lg_error;
Language_code, lg_error = require("Modulo:
if lg_error and #lg_error > 0 then
local error_string = mw.text.listToText(lg_error, ", ", " e " )
Line 1 249 ⟶ 1 257:
------------------------------------------------------------------------------
-- Aggiunge
------------------------------------------------------------------------------
if
-- se s=1 usa lo stesso valore di titolo/capitolo
if source == "1" then
source = Title .. (is_set(Chapter) and ("/" .. Chapter) or "")
end
source = "s:" .. (is_set(first_language) and (first_language .. ":") or "") .. source
if is_set(Chapter) then ChapterLink = source
else TitleLink = source end
end
Line 1 296 ⟶ 1 301:
-- Recupero e formatto lista curatori
------------------------------------------------------------------------------
local
local CuratoriEtal = A['Etalcuratori']
control.coauthors = false
if is_set(Editors) then
msg_editors = 'editors'
else
local EditorCount
Editors, EditorCount = list_people(control, e)
if is_set(Editors) then
end
end
------------------------------------------------------------------------------
--
------------------------------------------------------------------------------
local msg_chapter_editors
local Contributors, ChapterEditors = "", ""
if is_set(Chapter) then
local ChapterEditorCount
control.etal = false
Contributors = list_people(control,
extract_names( args, 'ContributorList', A:ORIGIN('Chapter') ))
ChapterEditors, ChapterEditorCount = list_people(control,
extract_names( args, 'ChapterEditorList', A:ORIGIN('Chapter') ))
if is_set(ChapterEditors) then
msg_chapter_editors = ChapterEditorCount <= 1 and 'editor' or 'editors'
end
end
Line 1 634 ⟶ 1 646:
fragment_citation:append(fragment_Title)
else
if is_set(
fragment_citation = Fragment.new({
else
if is_set(
ChapterEditors = wrap(msg_chapter_editors, ChapterEditors)
end
if is_set(Chapter) and not (is_set(Contributors) or is_set(ChapterEditors)) then
if
Contributors, Authors = Authors, ""
elseif is_set(Editors) and args["anteposizione-curatore"] ~= "no" then
ChapterEditors, Editors = wrap(msg_editors, Editors), ""
end
end
fragment_citation
end
if is_set(Chapter) then
-- antepone "su" anzichè "in" per i siti web
if A:ORIGIN('Periodical') == 'sito' or auto_Periodical then
fragment_citation:last("su")
else
fragment_citation:last("in")
end
end
if is_set(Editors) and (is_set(Authors) or args["anteposizione-curatore"] == "no" and not is_set(Chapter)) then
Editors = 'a cura di ' .. Editors
fragment_citation:appends({Authors, fragment_Title, Editors})
else
if is_set(Editors) then
Editors = wrap(msg_editors, Editors)
end
fragment_citation:appends({is_set(Authors) and Authors or Editors, fragment_Title})
end
end
Line 1 665 ⟶ 1 688:
local fragment_Via = Fragment.new(Via):start(".")
local fragment_Quote = Fragment.new({Quote}):start(".")
fragment_citation:appends({fragment_ID_list, fragment_URL, fragment_AccessDate, fragment_Archived, fragment_Via
if PostScript == 'nessuno' then
fragment_citation:last("nothing")
Line 1 671 ⟶ 1 694:
fragment_citation:last("..")
end
fragment_citation:appends({fragment_Quote})
fragment_citation:start(" ")
local text = Language_code .. tostring(fragment_citation)
-- aggiungo l'icona per
if config.CitationClass == "video" then text = cfg.messages['icon_video'] .. ' ' .. text end
if config.CitationClass == "audio" then text = cfg.messages['icon_audio'] .. ' ' .. text end
-- Now enclose the whole thing in a <span/> element
|