Module:Cite archive
Wikimedia module / De Wikipedia, l'encyclopédie encyclopedia
local Cite_archive = { }
local Commun = require( 'Module:Biblio/Commun' ) local References = require( 'Module:Biblio/Références' ) local Outils = require( 'Module:Outils' ) local TableBuilder = require( 'Module:TableBuilder' ) local Langue -- on chargera Module:Langue si une langue est spécifiée
Cite_archive.cite_archive = function ( frame ) local args = Outils.extractArgs( frame )
-- La table wiki va recevoir tout les petits bouts de texte, et sera concaténtée à la fin. -- Elle utilise la meta-table de TableBuilder, permettant d'utiliser les fonctions de la -- librairy table comme des méthodes. minsert permet d'insérer plusieurs élément en une -- seule fois en, ignorant les paramètre nil. local wiki = TableBuilder.new()
-- validArg renvoie le premier paramètre non vide, ou nil s'ils sont tous vides. -- Seul les noms des paramètres doivent être transmis à la fonction. local validArg = function ( ... ) return Commun.validTextArg( args, ... ) or false end
-- table servant à la catégorisation args.categ = {}
-- paramètres valides, avec au minimum institution et fonds ou collection args.principal = validArg( 'pièce' , 'item', 'dossier' , 'file' , 'sous-série' , 'série' , 'sous-fonds' , 'fonds' , 'collection' , 'section' ) args.est_item = validArg( 'pièce', 'item' , 'dossier' , 'file' ) local institution = validArg( 'institution' ) -- test existence des parametres obligatoires if institution and args.principal and validArg( 'fonds', 'collection' ) then -- initialisation de tous les libellés local section = validArg( 'section' ) local collection = validArg( 'collection' ) local fonds = validArg( 'fonds' ) local sous_fonds = validArg( 'sous-fonds' ) local serie = validArg( 'série' , 'series' ) local sous_serie = validArg( 'sous-série' ) local dossier = validArg( 'dossier' , 'file' ) local box = validArg( 'boîte' , 'box' ) local piece = validArg( 'pièce' , 'item' ) local date = validArg( 'date', 'dates' ) local type = validArg( 'support' , 'type' ) local importance = validArg( 'importance' ) local cote = validArg( 'cote' , 'item-id' ) local isil = validArg( 'isil' ) local lieu = validArg( 'ville', 'situation', 'location' ) local repository = validArg( 'dépôt', 'repository' ) local presentation_en_ligne = validArg( 'présentation en ligne', 'repository' ) local lire_en_ligne = validArg( 'lire en ligne', 'repository' ) local url_texte = validArg( 'url-texte', 'repository' ) if args.est_item then args['format électronique'] = args.format end args.format = false
-- niveau soit level local intitule_plan_level = nul if section then intitule_plan_level = 1 end if collection then intitule_plan_level = 3 end if fonds then intitule_plan_level = 5 end if sous_fonds then intitule_plan_level = 6 end if serie then intitule_plan_level = 7 end if sous_serie then intitule_plan_level = 8 end if dossier then intitule_plan_level = 9 end if piece then intitule_plan_level = 12 end
-- teste intitulé contenant son propre label local position_col = nul if collection then position_col = string.find(collection,"Collection") end local position_fds = nul if fonds then position_fds = string.find(fonds,"Fonds") end if not position_fds and fonds then position_fds = string.find(fonds,"Fund") end
-- span initial (id) et libellé local spanInitial, spanFinal = Commun.spanInitial ( args, validArg ) wiki.minsert( spanInitial, Commun.libelle( args ) )
-- indication de langue local indicLangue, codeLangue = Commun.indicationDeLangue ( args, validArg ) if indicLangue and indicLangue ~= then wiki.minsert( indicLangue, ' ' ) end
-- intitulé principal if args.est_item then -- objet d'archives de type dossier ou pièce -- liste des auteurs et de leur responsabilités (principale et secondaire) local auteur = validArg( 'nom1', 'nom', 'auteur1', 'auteur', 'auteurs', 'auteur institutionnel', 'last1', 'last', 'author1', 'author' ) if auteur then if validArg( 'auteurs' ) then wiki.minsert( args.auteurs ) else wiki.minsert( Commun.responsabilitePrincipale( args, validArg ) ) end wiki.minsert( Commun.responsabiliteSecondaire( args, validArg ), ', ' ) args.categ.auteur = validArg( 'auteur', 'auteurs', 'author1', 'author', 1, 2, 3, 4 ) args.categ.coauteur = validArg( 'coauteurs', 'coauteur', 'coauthors' ) end -- langue if codeLangue then Langue = Langue or require( 'Module:Langue' ) local dir = Langue.directionLangue( codeLangue ) if dir == 'rtl' then dir = '" dir="rtl' else dir = nil end wiki.minsert( '') end -- intitulé dossier ou pièce wiki.minsert( '« ', args.principal , ' »', codeLangue and '' ) elseif validArg( 'collection' , 'section' , 'fonds' , 'sous-fonds' , 'série' , 'sous-série' ) then -- intitulé collection ou section ou fonds, sous-fonds, série ou sous-série if sous_serie then wiki.minsert( 'Sous-série : ', args.principal ) elseif serie then wiki.minsert( 'Série : ', args.principal ) elseif sous_fonds then wiki.minsert( 'Sous-fonds : ', args.principal ) elseif fonds then if position_fds then wiki.minsert( args.principal ) else wiki.minsert( 'Fonds : ', args.principal ) end elseif collection then if position_col then wiki.minsert( args.principal ) else wiki.minsert( 'Collection : ', args.principal ) end elseif section then wiki.minsert( 'Section : ', args.principal ) end end
-- dates=date de l'objet d'archives if date then wiki.minsert( ' (', date , ')') end -- support=type et importance de l'objet d'archives if type or importance then if type and not importance then wiki.minsert( ' [', type , ']' ) elseif not type and importance then wiki.minsert( ' [', importance , ']' ) else wiki.minsert( ' [', type , ' ; ' , importance , ']' ) end end -- fin de l'intitulé principal wiki.minsert( '. ')
-- contexte de plan d'archivage local intitule_plan_start = nul if args.est_item or sous_fonds or fonds or collection then if section then wiki.minsert( 'Section : ', section ) intitule_plan_start = 1 end end if args.est_item then if section and not intitule_plan_start then wiki.minsert( 'Section : ', section ) intitule_plan_start = 1 end if collection then -- collection = Commun.fusionTexteLien( collection, args['collection-url'], args.categ ) if intitule_plan_start then if position_col then wiki.minsert( '; ', collection ) else wiki.minsert( '; Collection : ', collection ) end else if position_col then wiki.minsert( collection ) else wiki.minsert( 'Collection : ', collection ) end end intitule_plan_start = 3 end if fonds then if intitule_plan_start then if position_fds then wiki.minsert( '; ' , fonds ) else wiki.minsert( '; Fonds : ', fonds ) end else -- fonds = Commun.fusionTexteLien( fonds, args['collection-url'], args.categ ) if position_fds then wiki.minsert( fonds ) else wiki.minsert( 'Fonds : ', fonds ) end end intitule_plan_start = 5 end elseif collection and fonds then -- 'fonds' déjà mentionné comme intitulé principal collection = Commun.fusionTexteLien( collection, args['collection-url'], args.categ ) if intitule_plan_start then if position_col then wiki.minsert( '; ', collection ) else wiki.minsert( '; Collection : ', collection ) end else if position_col then wiki.minsert( collection ) else wiki.minsert( 'Collection : ', collection ) end end intitule_plan_start = 3 elseif fonds and intitule_plan_level >= 6 and not args.est_item then -- présence d'un sous-fonds -- fonds = Commun.fusionTexteLien( fonds, args['collection-url'], args.categ ) if intitule_plan_start then if position_fds then wiki.minsert( '; ' , fonds ) else wiki.minsert( '; Fonds : ', fonds ) end else if position_fds then wiki.minsert( fonds ) else wiki.minsert( 'Fonds : ', fonds ) end end intitule_plan_start = 5 end if sous_fonds and intitule_plan_level > 6 then if intitule_plan_start then wiki.minsert( '; Sous-fonds : ', sous_fonds ) else wiki.minsert( 'Sous-fonds : ', sous_fonds ) end intitule_plan_start = 6 end if serie and intitule_plan_level > 7 then if intitule_plan_start then wiki.minsert( '; Série : ', serie ) else wiki.minsert( 'Série : ', serie ) end intitule_plan_start = 7 end if sous_serie and intitule_plan_level > 8 then if intitule_plan_start then wiki.minsert( '; Sous-série : ', sous_serie ) else wiki.minsert( 'Sous-série : ', sous_serie ) end intitule_plan_start = 8 end if dossier and intitule_plan_level > 9 then if intitule_plan_start then wiki.minsert( '; Dossier : ', dossier ) else wiki.minsert( 'Dossier : ', dossier ) end intitule_plan_start = 9 end if box then if intitule_plan_start then wiki.minsert( '; Boîte : ', box ) end intitule_plan_start = 11 end -- Cote, identifiant unique if cote then if intitule_plan_start then wiki.minsert( '; ' ) else wiki.minsert( ' ' ) end if isil then -- cote universelle = identifiant ISIL de l'institution + cote interne wiki.minsert( 'Cote : ', isil , ' ' , cote ) else wiki.minsert( 'Cote : ', cote ) end end
-- ville : dépôt, institution if lieu or repository or institution then if intitule_plan_start or cote then wiki.minsert( '. ' ) end if lieu then wiki.minsert( , lieu ) if repository or institution then wiki.minsert( ' : ' ) end end if repository then wiki.minsert( , repository ) if institution then wiki.minsert( ', ' ) end end if institution then wiki.minsert( , institution ) end -- fin institution (point final, déplacé si lien externe) if not (presentation_en_ligne or lire_en_ligne or url_texte) then wiki.minsert( '.' ) end end
-- lien vers l'article en ligne (isbn, issn, pmid, doi, lire en ligne, résumé...) wiki.minsert( References.affichageLiensExternes( args, validArg, true, false ) ) -- "consulté le" n'est pas affiché, voir Discussion_modèle:Ouvrage/Archive_5#.C3.89volution_documentation -- fin lien externe (point final) if presentation_en_ligne or lire_en_ligne or url_texte then wiki.minsert( '.' ) end
--[[----- A VOIR, PARAMETRE 'page' NON IMPLEMENTE -- pages local page = validArg( 'passage', 'pages', 'page', 'p.', 'pp.' ) if page then wiki.minsert( ', ', Commun.formatePassage( page ) ) end ]] --[[-------- A VOIR, LIGNES COPIEES DE Module:Biblio/Article local patternPonct = '[,.;:!?]$' local ponctuation = wiki.concat():gsub( '%b<>', ):match( patternPonct )
-- ajout des méthadonnées COinS (ContextObjects in Spans) wiki.minsert( Commun.COinS( args, validArg, 'article' ) ) ]] -- fin du span (id) et de la description de l'ouvrage wiki.minsert( spanFinal )
-- commentaire wiki.minsert( Commun.commentaire( args ) )
-- ajout de catégories cachées if mw.title.getCurrentTitle().namespace == 0 then wiki.minsert( args.categ.coauteur and '', args.categ.langue and '', args.categ.date and '', args.categ.lienExterne and '' ) if codeLangue then Langue = Langue or require( 'Module:Langue' ) if Langue.directionLangue( codeLangue ) == 'rtl' then wiki.minsert( '' ) end end end
else
-- ERREURS
if not args.principal then
wiki.minsert( '[[Modèle:Cite archive|{{Cite archive}} : paramètre « fonds
» ou « collection
» manquant{{Cite archive}} : paramètre « institution
» manquant]] : paramètre « fonds
» ou « collection
» manquant' )
end
if not institution then
wiki.minsert( '[[Modèle:Cite archive|{{Cite archive}} : paramètre « fonds
» ou « collection
» manquant{{Cite archive}} : paramètre « institution
» manquant]] : paramètre « institution
» manquant' )
end
end
return wiki.concat()
end
return Cite_archive
--[[ HISTORY OF CHANGES = HISTORIQUE DES MODIFICATIONS
18 mai 2017 sur la base de w:en:Module:Cite archive, ajouts des paramètres en français, p.e. args.series = pframe.args.series or pframe.args['série'] modification des séparateurs ',' remplacé par ';' entre les niveaux de description 19 mai 2017 ajout du nouveau paramètre 'language'='langue' et traitement comme pour le modèle Ouvrage (inclusion de Module:Biblio/Commun et Module:Outils) - OK
choix concernant les url : * 'item-url'='url'='présentation en ligne', à afficher en fin de ligne (comme pour Ouvrage) - 21.5.2017 OK * NEW 'lire en ligne'='url texte'='texte', à afficher en fin de ligne (comme pour Ouvrage) - 21.5.2017 OK * 'collection-url' est conservé, concerne la notice descriptive du fonds soit collection (ajout ='fonds-url'), le lien est placé sur le texte de la collection si elle existe, sinon du fonds - 21.5.2017 NON OK
choix concernant le paramètre 'collection' : - 21.5.2017 OK * remplacé en français par 'fonds' * mais comme les deux peuvent exister et être distincts : * si 'intitulé' est non vide, alors : "« intitulé » (dates). Collection, Fonds, ISIL-Cote. Lieu : Institution" * si 'intitulé' est vide, alors : "Collection (dates). Fonds, ISIL-Cote. Lieu : Institution" * si 'collection' est vide : * si 'intitulé' est vide : "Fonds (dates). ISIL-Cote. Lieu : Institution" (CAS STANDARD REFERENCE FONDS) * si 'intitulé' est non vide , alors : "« intitulé » (dates). Fonds, ISIL-Cote. Lieu : Institution" (CAS STANDARD REFERENCE DOSSIER/PIECE) * si 'fonds' est vide (référence traduite de l'anglais), alors : "Collection (dates). ISIL-Cote. Lieu : Institution" choix concernant la 'cote' : - 21.5.2017 OK * elle est mentionnée sous la forme "Cote : [cote]" * si ISIL (NEW paramètre 'isil') est renseigné: "ISIL Cote : [isil] [cote]" 20 mai 2017 TOUT REPRIS sur une autre base : plus tôt que de copier le contenu du module en anglais, copie d'un exemple en français (Module:Biblio/Article) et adaptation 21 mai 2017 ajout progressif des divers paramètres 1 juin 2017 renonce à 'intitulé' (remplace par 'dossier' ou 'pièce') 2 juin 2017 présentation, révision, nettoyages 8 juin 2017 non affichage du titre "Collection" si le paramètre contient ce même mot, idem avec "Fonds"
traitement du nouveau paramètre "sous-série" traitement du nouveau paramètre "sous-fonds"
29 mai 2021 déplacement du point final quand un lien externe existe ("présentation" ou "lire" en ligne) --]]