Modulo:Citazione: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m una versione importata |
visto che le pagine da modificare sono più di quanto pensassi, almeno per ora evito la migrazione e lascio per comodità che i parametri autore e curatore siano ancora intercambiabili con autore-sezione e curatore-sezione nelle combinazioni 2.2, 2.3, 2.4; aggiungo parametro anteposizione-curatore come da discussione |
||
Riga 26: | Riga 26: | ||
--[[ =============================================================================== |
--[[ =============================================================================== |
||
Caricamento delle tabelle di configurazione del modulo. |
|||
===============================================================================]] |
===============================================================================]] |
||
local cfg = mw.loadData('Module:Citazione/Configurazione') |
local cfg = mw.loadData('Module:Citazione/Configurazione') |
||
Riga 413: | Riga 413: | ||
options.pattern = mw.ustring.gsub( options.pattern, '([^%[]%[[^%[]%S+)$1(.-%])', '%1$2%2' ); |
options.pattern = mw.ustring.gsub( options.pattern, '([^%[]%[[^%[]%S+)$1(.-%])', '%1$2%2' ); |
||
end |
end |
||
return mw.ustring.format( '[[ |
return mw.ustring.format( '[[%s|%s]]%s%s', |
||
options.link, options.label, options.separator or " ", |
options.link, options.label, options.separator or " ", |
||
substitute( options.pattern, {mw.text.nowiki(options.id), url_string} ) |
substitute( options.pattern, {mw.text.nowiki(options.id), url_string} ) |
||
Riga 1 182: | Riga 1 182: | ||
------------------------------------------------------------------------------ |
------------------------------------------------------------------------------ |
||
local auto_Periodical = false |
local auto_Periodical = false |
||
if in_array(config.CitationClass, {'web'}) and not is_set(Periodical |
if in_array(config.CitationClass, {'web'}) and not is_set(Periodical) and is_set(URL) then |
||
Periodical = mw.ustring.match(URL, "//([^/#%?]*)") or '' |
Periodical = mw.ustring.match(URL, "//([^/#%?]*)") or '' |
||
-- tolgo anche eventuale www. |
-- tolgo anche eventuale www. |
||
Riga 1 189: | Riga 1 189: | ||
end |
end |
||
-- evito ripetizione se il dominio è stato usato come titolo o editore |
-- evito ripetizione se il dominio è stato usato come titolo o editore |
||
if |
if is_set(Periodical) then |
||
if mw.ustring.lower(Title) == mw.ustring.lower(Periodical) then |
|||
Periodical = |
Periodical = '' |
||
⚫ | |||
if mw.ustring.lower(PublisherName) == mw.ustring.lower(Periodical) then |
|||
PublisherName = '' |
|||
⚫ | |||
end |
end |
||
auto_Periodical = true |
auto_Periodical = true |
||
Riga 1 219: | Riga 1 224: | ||
--------------------------------------------------------------- |
--------------------------------------------------------------- |
||
-- Compone la stringa |
-- Compone la stringa della lingua |
||
--------------------------------------------------------------- |
--------------------------------------------------------------- |
||
local Language_code = "" |
local Language_code = "" |
||
Riga 1 237: | Riga 1 242: | ||
first_language = frame_lingue[1]:lower(); |
first_language = frame_lingue[1]:lower(); |
||
local lg_error; |
local lg_error; |
||
Language_code, lg_error = require("Modulo: |
Language_code, lg_error = require("Modulo:Lingue").lingue(frame_lingue) |
||
if lg_error and #lg_error > 0 then |
if lg_error and #lg_error > 0 then |
||
local error_string = mw.text.listToText(lg_error, ", ", " e " ) |
local error_string = mw.text.listToText(lg_error, ", ", " e " ) |
||
Riga 1 296: | Riga 1 301: | ||
-- Recupero e formatto lista curatori |
-- Recupero e formatto lista curatori |
||
------------------------------------------------------------------------------ |
------------------------------------------------------------------------------ |
||
local |
local msg_editors |
||
local CuratoriEtal = A['Etalcuratori'] |
local CuratoriEtal = A['Etalcuratori'] |
||
control.coauthors = false |
control.coauthors = false |
||
control.etal = is_set(CuratoriEtal) |
|||
control.etal = true |
|||
⚫ | |||
control.etal = false |
|||
⚫ | |||
if is_set(Editors) then |
if is_set(Editors) then |
||
msg_editors = 'editors' |
msg_editors = 'editors' |
||
else |
else |
||
local EditorCount |
|||
Editors, EditorCount = list_people(control, e) |
Editors, EditorCount = list_people(control, e) |
||
if is_set(Editors) then |
if is_set(Editors) then |
||
msg_editors = EditorCount <= 1 and 'editor' or 'editors' |
|||
end |
end |
||
⚫ | |||
------------------------------------------------------------------------------ |
|||
-- Se non sono definiti autori sostituisco con curatori |
|||
------------------------------------------------------------------------------ |
|||
⚫ | |||
Authors = Editors |
|||
Editors = "" |
|||
end |
end |
||
------------------------------------------------------------------------------ |
------------------------------------------------------------------------------ |
||
-- Recupero e formatto lista autori di un singolo capitolo dell'opera citata |
-- Recupero e formatto lista autori e curatori di un singolo capitolo dell'opera citata |
||
------------------------------------------------------------------------------ |
------------------------------------------------------------------------------ |
||
local |
local msg_chapter_editors |
||
local Contributors, ChapterEditors = "", "" |
|||
if is_set(Chapter) then |
if is_set(Chapter) then |
||
local ChapterEditorCount |
|||
⚫ | |||
control.etal = false |
control.etal = false |
||
Contributors = list_people(control, |
Contributors = list_people(control, |
||
⚫ | |||
ChapterEditors, ChapterEditorCount = list_people(control, |
|||
extract_names( args, 'ChapterEditorList', A:ORIGIN('Chapter') )) |
|||
⚫ | |||
msg_chapter_editors = ChapterEditorCount <= 1 and 'editor' or 'editors' |
|||
⚫ | |||
end |
end |
||
Riga 1 600: | Riga 1 602: | ||
elseif is_set(PublisherName) then |
elseif is_set(PublisherName) then |
||
PublisherName = PublisherName .. " " .. OrigDate |
PublisherName = PublisherName .. " " .. OrigDate |
||
elseif is_set( |
elseif is_set(Place) then |
||
Place = Place .. " " .. OrigDate |
Place = Place .. " " .. OrigDate |
||
else |
else |
||
Riga 1 644: | Riga 1 646: | ||
fragment_citation:append(fragment_Title) |
fragment_citation:append(fragment_Title) |
||
else |
else |
||
if is_set( |
if is_set(ChapterEditors) and (is_set(Contributors) or args["anteposizione-curatore"] == "no") then |
||
ChapterEditors = 'a cura di ' .. ChapterEditors |
|||
fragment_citation = Fragment.new({ |
fragment_citation = Fragment.new({Contributors, Chapter, ChapterEditors}, sepc) |
||
⚫ | |||
else |
else |
||
if is_set( |
if is_set(ChapterEditors) then |
||
ChapterEditors = wrap(msg_chapter_editors, ChapterEditors) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
elseif is_set(Contributors) and is_set(Title) then |
|||
Authors, Editors = Contributors, Authors |
|||
end |
end |
||
if is_set(Chapter) and not (is_set(Contributors) or is_set(ChapterEditors)) then |
|||
fragment_citation = Fragment.new({Authors, Chapter}, sepc) |
|||
if |
if is_set(Authors) then |
||
Contributors, Authors = Authors, "" |
|||
⚫ | |||
elseif is_set(Editors) and args["anteposizione-curatore"] ~= "no" then |
|||
⚫ | |||
⚫ | |||
else |
|||
⚫ | |||
end |
end |
||
end |
end |
||
fragment_citation |
fragment_citation = Fragment.new({is_set(Contributors) and Contributors or ChapterEditors, Chapter}, sepc) |
||
end |
|||
if is_set(Chapter) then |
|||
-- antepone "su" anzichè "in" per i siti web |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
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 |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end |
|||
fragment_citation:appends({is_set(Authors) and Authors or Editors, fragment_Title}) |
|||
end |
end |
||
end |
end |
||
Riga 1 677: | Riga 1 688: | ||
local fragment_Via = Fragment.new(Via):start(".") |
local fragment_Via = Fragment.new(Via):start(".") |
||
local fragment_Quote = Fragment.new({Quote}):start(".") |
local fragment_Quote = Fragment.new({Quote}):start(".") |
||
fragment_citation:appends({fragment_ID_list, fragment_URL, fragment_AccessDate, fragment_Archived, fragment_Via |
fragment_citation:appends({fragment_ID_list, fragment_URL, fragment_AccessDate, fragment_Archived, fragment_Via}) |
||
if PostScript == 'nessuno' then |
if PostScript == 'nessuno' then |
||
fragment_citation:last("nothing") |
fragment_citation:last("nothing") |
||
Riga 1 683: | Riga 1 694: | ||
fragment_citation:last("..") |
fragment_citation:last("..") |
||
end |
end |
||
fragment_citation:appends({fragment_Quote}) |
|||
fragment_citation:start(" ") |
fragment_citation:start(" ") |
||
local text = Language_code .. tostring(fragment_citation) |
local text = Language_code .. tostring(fragment_citation) |