local p = {}
-- shallow copy di un oggetto table
local function table_shallow_copy(obj)
local copy = {}
if type(obj) == 'table' then
for key, val in pairs(obj) do
copy[key] = val
end
end
return copy
end
-- parametri posizionali: {{New Grove|edizione|nome|cognome|voce|volume|pagine|cid|wl}}
function p.citation(frame)
local pframepargs = frame:getParent().args
-- wl determina se inserire o meno un wikilink nel titolo dell'opera
local wl = pframe.argspargs[8] or pframe.argspargs['wl'] or Nil
wl = wl and wl ~= ''
-- sceglie edizione (per avere i campi precompilati)
local edition = pframe.argspargs[1] or pframe.argspargs['edizione'] or Nil
-- shallow copy dei parametri
local inner_args = table_shallow_copy(pframe.args)
-- conversione parametri posizionali:
-- il Modulo:Citazione e il Template:New Grove hanno un ordine diverso
-- per i parametri posizionali
inner_argspargs['nome'] = pframe.argspargs[2] or pframe.argspargs['nome']
inner_argspargs['cognome'] = pframe.argspargs[3] or pframe.argspargs['cognome']
inner_argspargs['voce'] = pframe.argspargs[4] or pframe.argspargs['voce']
inner_argspargs['volume'] = pframe.argspargs[5] or pframe.argspargs['volume']
inner_argspargs['pagine'] = pframe.argspargs[6] or pframe.argspargs['pagine']
inner_argspargs['cid'] = pframe.argspargs[7] or pframe.argspargs['cid']
-- New Grove ed. 1
if edition == "1" then
if wl then
inner_argspargs['titolo'] = "The New Grove Dictionary of Music and Musicians"
else
inner_argspargs['titolo'] = "[[Grove Dictionary of Music and Musicians|The New Grove Dictionary of Music and Musicians]]"
end
inner_argspargs['curatore'] = "Stanley Sadie"
inner_argspargs['edizione'] = "1ª ed."
inner_argspargs['editore'] = "MacMillian"
inner_argspargs['città'] = "Londra"
inner_argspargs['anno'] = "1980"
inner_argspargs['ISBN'] = "978-0333231111"
-- New Grove ed. 2
elseif edition == "2" then
if wl then
inner_argspargs['titolo'] = "The New Grove Dictionary of Music and Musicians"
else
inner_argspargs['titolo'] = "[[Grove Dictionary of Music and Musicians|The New Grove Dictionary of Music and Musicians]]"
end
inner_argspargs['curatore'] = "Stanley Sadie"
inner_argspargs['curatore2'] = "John Tyrrell"
inner_argspargs['edizione'] = "2ª ed."
inner_argspargs['editore'] = "Oxford University Press"
inner_argspargs['anno'] = "2001"
inner_argspargs['ISBN'] = "978-0195170672"
-- Grove Dictionary of Musical Instruments
elseif edition == "inst" then
inner_argspargs['titolo'] = "The New Grove Dictionary of Musical Instruments"
inner_argspargs['curatore'] = "Stanley Sadie"
inner_argspargs['editore'] = "MacMillian"
inner_argspargs['città'] = "Londra"
inner_argspargs['anno'] = "1984"
inner_argspargs['ISBN'] = "0943818052"
-- Grove Dictionary of Opera
elseif edition == "opera" then
if wl then
inner_argspargs['titolo'] = "[[New Grove Dictionary of Opera|The New Grove Dictionary of Opera]]"
else
inner_argspargs['titolo'] = "The New Grove Dictionary of Opera"
end
inner_argspargs['curatore'] = "Stanley Sadie"
inner_argspargs['edizione'] = "1ª ed."
inner_argspargs['editore'] = "MacMillian"
inner_argspargs['città'] = "Londra"
inner_argspargs['anno'] = "1992"
inner_argspargs['ISBN'] = "0333485521"
-- Grove Dictionary of American Music
elseif edition == "american" then
inner_argspargs['titolo'] = "The New Grove Dictionary of American Music"
inner_argspargs['curatore'] = "Stanley Sadie"
inner_argspargs['curatore'] = "Hugh Wiley Hitchcock"
inner_argspargs['editore'] = "MacMillian"
inner_argspargs['città'] = "Londra"
inner_argspargs['anno'] = "1986"
inner_argspargs['ISBN'] = "0333378792"
-- Grove Dictionary of Art ed. 1
elseif edition == "art1" then
inner_argspargs['titolo'] = "The Grove Dictionary of Art"
inner_argspargs['curatore'] = "Jane Turner"
inner_argspargs['edizione'] = "1ª ed."
inner_argspargs['editore'] = "Oxford University Press"
inner_argspargs['anno'] = "1996"
inner_argspargs['ISBN'] = "1884446000"
-- Grove Dictionary of Art ed. 2
elseif edition == "art2" then
inner_argspargs['titolo'] = "The Grove Dictionary of Art"
inner_argspargs['curatore'] = "Jane Turner"
inner_argspargs['edizione'] = "2ª ed."
inner_argspargs['editore'] = "Oxford University Press"
inner_argspargs['anno'] = "2003"
inner_argspargs['ISBN'] = "0195170687"
-- Grove Dictionary of Jazz ed. 1
elseif edition == "jazz1" then
inner_argspargs['titolo'] = "The New Grove Dictionary of Jazz"
inner_argspargs['curatore'] = "Barry Kernfeld"
inner_argspargs['edizione'] = "1ª ed."
inner_argspargs['editore'] = "MacMillian"
inner_argspargs['anno'] = "1988"
inner_argspargs['ISBN'] = "0312113579"
-- Grove Dictionary of Jazz ed. 2
elseif edition == "jazz2" then
inner_argspargs['titolo'] = "The New Grove Dictionary of Jazz"
inner_argspargs['curatore'] = "Barry Kernfeld"
inner_argspargs['edizione'] = "2ª ed."
inner_argspargs['editore'] = "Oxford University Press"
inner_argspargs['anno'] = "2003"
inner_argspargs['ISBN'] = "1561592846"
-- parametro edizione assente o invalido
local cite_object = {
cite_module = require("Modulo:Citazione"),
args = inner_argspargs,
frame = {
args = {}
|