Modulo:Citazione: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica
aggiungo parametro per indicare l'autore di una parte dell'opera citata e rimuovo parametro no_curatore, vedi discussione
Riga 413:
options.pattern = mw.ustring.gsub( options.pattern, '([^%[]%[[^%[]%S+)$1(.-%])', '%1$2%2' );
end
return mw.ustring.format( '[[w:it:%s|%s]]%s%s',
options.link, options.label, options.separator or " ",
substitute( options.pattern, {mw.text.nowiki(options.id), url_string} )
Riga 517:
if ( code == "A" ) then
return link_id({link=handler.link, label=handler.label,
pattern="[http[openlibrary://openlibrary.org/authors/OL$1 |$1]]",id=id, separator=handler.separator,
encode = handler.encode})
elseif ( code == "M" ) then
return link_id({link=handler.link, label=handler.label,
pattern="[http[openlibrary://openlibrary.org/books/OL$1 |$1]]",id=id, separator=handler.separator,
encode = handler.encode})
elseif ( code == "W" ) then
return link_id({link=handler.link, label=handler.label,
pattern= "[http[openlibrary://openlibrary.org/works/OL$1 |$1]]",id=id, separator=handler.separator,
encode = handler.encode})
else
return link_id({link=handler.link, label=handler.label,
pattern= "[http://[openlibrary.org/:OL$1 |$1]]",id=id, separator=handler.separator,
encode = handler.encode}) ..
' ' .. set_error( 'bad_ol' );
Riga 764:
if is_set(first) then
if invertorder then first, last = last, first end
fullname = '<span class="autore">' .. table.concat({first, person.last, first}, ' ') .. '</span>'
else
fullname = '<span class="autore">' .. person.last .. '</span>'
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 is_set(title)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, cfgparameters.aliases[list_name .. '-Last']last, 'redundant_parameters', i );
if not is_set(last) then
local first = select_one( args, cfgparameters.aliases[list_name .. '-First']first, 'redundant_parameters', i )
if not is_set(first) then
break;
Line 814 ⟶ 829:
last = first,
first = '',
link = select_one( args, cfgparameters.aliases[list_name .. '-Link']link, 'redundant_parameters', i ),
}
end
Line 820 ⟶ 835:
names[i] = {
last = last,
first = select_one( args, cfgparameters.aliases[list_name .. '-First']first, 'redundant_parameters', i ),
link = select_one( args, cfgparameters.aliases[list_name .. '-Link']link, 'redundant_parameters', i ),
};
end
Line 827 ⟶ 842:
end
return names;
end
 
--[[ ===============================================================================
Genera link a wikisource
===============================================================================]]
local function build_wikisource_link(language, title, chapter, anchor)
if is_set(title) then
return mw.ustring.format("s:%s%s%s%s", is_set(language) and (language .. ":") or "" ,
title, is_set(chapter) and ("/" .. chapter) or "" ,
is_set(anchor) and ("#" .. anchor) or "")
end
end
 
Line 950 ⟶ 954:
local Others = A['Others'];
local Editors = A['Editors'];
local No_editor = A['No_editor'];
local e = extract_names( args, 'EditorList' );
 
Line 1 249 ⟶ 1 252:
 
------------------------------------------------------------------------------
-- Aggiunge automaticamente il wikilink se chiamato da citaa wikisourceWikisource
------------------------------------------------------------------------------
if is_set(A['Source']) and not in_array(config.CitationClass, =={ "wikisourceweb", "video", "tv", "audio" } ) then
Anchorlocal source = A['AnchorSource'];
-- se s=1 usa lo stesso valore di titolo/capitolo
if is_set(TitleLink) then
if source == "1" then
TitleLink = build_wikisource_link(first_language, TitleLink, "", Anchor)
title,source = Title .. (is_set(chapterChapter) and ("/" .. chapterChapter) or "" ,)
elseif is_set(Title) then
TitleLink = build_wikisource_link(first_language, Title, "", (is_set(Chapter) and "") or Anchor)
end
if is_set(ChapterLink) then
ChapterLink = build_wikisource_link(first_language, ChapterLink, "", Anchor)
elseif is_set(Chapter) and is_set(Title) then
ChapterLink = build_wikisource_link(first_language, Title, Chapter, Anchor)
end
source = "s:" .. (is_set(first_language) and (first_language .. ":") or "") .. source
if is_set(Chapter) then ChapterLink = source
else TitleLink = source end
end
 
Riga 1 318:
Authors = Editors
Editors = ""
end
 
------------------------------------------------------------------------------
-- Recupero e formatto lista autori di un singolo capitolo dell'opera citata
------------------------------------------------------------------------------
local Contributors
if is_set(TitleLinkChapter) then
local c = extract_names( args, 'ContributorList', A:ORIGIN('Chapter') );
control.etal = false
Contributors = list_people(control, c)
end
 
Line 1 590 ⟶ 1 600:
elseif is_set(PublisherName) then
PublisherName = PublisherName .. " " .. OrigDate
elseif is_set(PlacePlase) then
Place = Place .. " " .. OrigDate
else
Line 1 639 ⟶ 1 649:
fragment_citation:appends({fragment_Title, Editors})
else
if is_set(msg_editors) and not is_set(No_editor) then
if is_set(Editors) then
Editors = wrap(msg_editors, Editors)
Line 1 645 ⟶ 1 655:
Authors = wrap(msg_editors, Authors)
end
elseif is_set(Contributors) and is_set(Title) then
Authors, Editors = Contributors, Authors
end
fragment_citation = Fragment.new({Authors, Chapter}, sepc)
Line 1 673 ⟶ 1 685:
fragment_citation:start(" ")
local text = Language_code .. tostring(fragment_citation)
-- aggiungo l'icona per cita video/audio
if config.CitationClass == "video" then text = cfg.messages['icon_video'] .. ' ' .. text end
if config.CitationClass == "audio" then text = cfg.messages['icon_audio'] .. ' ' .. text end
if config.CitationClass == "wikisource" then text = cfg.messages['Wikisource icon'] .. ' ' .. text end
 
-- Now enclose the whole thing in a <span/> element