« Module:ZoteroItem » : différence entre les versions

Aucun résumé des modifications
Aucun résumé des modifications
Ligne 30 : Ligne 30 :
         return "Erreur : champ 'data' manquant dans le JSON"
         return "Erreur : champ 'data' manquant dans le JSON"
     end
     end
    local escape = mw.text.nowiki  -- alias utile


     local out = {}
     local out = {}
     table.insert(out, "<strong>Titre :</strong> " .. mw.text.escape(d.title or d.caseName or "(sans titre)"))
     table.insert(out, "<strong>Titre :</strong> " .. escape(d.title or d.caseName or "(sans titre)"))


     if d.creators then
     if d.creators then
         local authors = {}
         local authors = {}
         for _, c in ipairs(d.creators) do
         for _, c in ipairs(d.creators) do
             table.insert(authors, mw.text.escape((c.firstName or "") .. " " .. (c.lastName or "")))
             table.insert(authors, escape((c.firstName or "") .. " " .. (c.lastName or "")))
         end
         end
         table.insert(out, "<br><strong>Auteurs :</strong> " .. table.concat(authors, ", "))
         table.insert(out, "<br><strong>Auteurs :</strong> " .. table.concat(authors, ", "))
Ligne 43 : Ligne 45 :


     if d.dateDecided then
     if d.dateDecided then
         table.insert(out, "<br><strong>Date :</strong> " .. mw.text.escape(d.dateDecided))
         table.insert(out, "<br><strong>Date :</strong> " .. escape(d.dateDecided))
     end
     end


     if d.abstractNote then
     if d.abstractNote then
         table.insert(out, "<br><strong>Résumé :</strong> " .. mw.text.escape(d.abstractNote))
         table.insert(out, "<br><strong>Résumé :</strong> " .. escape(d.abstractNote))
     end
     end


     if d.url then
     if d.url then
         table.insert(out, '<br><strong>Lien :</strong> <a href="' .. mw.text.escape(d.url) .. '" target="_blank">Voir</a>')
         table.insert(out, '<br><strong>Lien :</strong> <a href="' .. escape(d.url) .. '" target="_blank">Voir</a>')
     end
     end