Module:Cite archive
Apparence
[voir] [modifier] [historique] [purger]
Utilisation
Fonctions exportables :
cite_archive(args)
– affiche les références d'une source se trouvant dans un fonds d’archives. Voir {{Modèle:Cite archive}}.
Modules externes et autres éléments dont ce module a besoin pour fonctionner :
Module:Outils
– Utilise Outils.extractArgs.Module:Biblio/Commun
Module:Biblio/Références
Module:TableBuilder
Module:Langue
– chargé si le paramètre langue est renseigné.
Exemples
Pour des exemples, voir {{Modèle:Cite archive}}.
La documentation de ce module est générée par le modèle {{Documentation module}}.
Elle est incluse depuis sa sous-page de documentation. Veuillez placer les catégories sur cette page-là.
Les éditeurs peuvent travailler dans le bac à sable (créer).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
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 = require( 'Module:Langue' )
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' , 'série' , 'fonds', 'collection' , 'section' )
args.est_item = validArg( 'pièce', 'item' , 'dossier' , 'file' )
local institution = validArg( 'institution' )
if institution and args.principal and validArg( 'fonds', 'collection' ) then
local section = validArg( 'section' )
local collection = validArg( 'collection' )
local fonds = validArg( 'fonds' )
local serie = validArg( 'série' , 'series' )
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' )
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 serie then intitule_plan_level = 7 end
if dossier then intitule_plan_level = 9 end
if piece then intitule_plan_level = 12 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 Outils.notEmpty( indicLangue ) then
wiki.minsert( indicLangue, ' ' )
end
-- intitulé principal
-- clarification objet d'archives de type dossier ou pièce (le principal n'est pas fonds ou collection)
if args.est_item then
-- 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
local dir = Langue.directionLangue( codeLangue )
if dir == 'rtl' then dir = '" dir="rtl'
else dir = nil
end
wiki.minsert( '<span lang="', codeLangue, dir, '">')
end
wiki.minsert( '« <cite style="font-style:normal;">', args.principal , '</cite> »', codeLangue and '</span>' )
elseif validArg( 'collection' , 'section' , 'fonds' ) then
if fonds then
wiki.minsert( 'Fonds : ', args.principal )
elseif collection then
local position_col = string.find(collection,"Collection")
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 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 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
wiki.minsert( '; Collection : ', collection )
else
wiki.minsert( 'Collection : ', collection )
end
intitule_plan_start = 3
end
if fonds then
if intitule_plan_start then
wiki.minsert( '; Fonds : ', fonds )
else
fonds = Commun.fusionTexteLien( fonds, args['collection-url'], args.categ )
wiki.minsert( 'Fonds : ', fonds )
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
wiki.minsert( '; Collection : ', collection )
else
wiki.minsert( 'Collection : ', collection )
end
intitule_plan_start = 3
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 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
wiki.minsert( 'Cote : <small>[[ISO 15511|', isil , ']]</small> ' , 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 serie or dossier or box 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
wiki.minsert( '.' )
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 plus affiché, voir [[Discussion_modèle:Ouvrage/Archive_5#.C3.89volution_documentation]]
--[[----- A VOIR, PARAMETRE 'page' NON IMPLEMENTE
-- pages
local page = validArg( 'passage', 'pages', 'page', 'p.', 'pp.' )
if page then
if string.match ( page, '^[%dIVXL]' ) then
wiki.minsert( ', ', Commun.page, page )
else
wiki.minsert( ', ', page )
end
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 ) )
if mw.title.getCurrentTitle().namespace == 0 then
wiki.minsert(
args.categ.coauteur and '[[Catégorie:Recension temporaire pour le modèle Cite archive|coauteur]]',
args.categ.langue and '[[Catégorie:Page du modèle Cite archive comportant une erreur|langue]]',
args.categ.date and '[[Catégorie:Page du modèle Cite archive comportant une erreur|date]]',
args.categ.lienExterne and '[[Catégorie:Page du modèle Cite archive comportant une erreur|externe]]'
)
if codeLangue then
if Langue.directionLangue( codeLangue ) == 'rtl' then
wiki.minsert( '[[Catégorie:Recension temporaire pour le modèle Cite archive|rtl]]' )
end
end
end
else
if not args.principal then
wiki.minsert( Outils.erreur( '[[Modèle:Cite archive|{{Cite archive}}]] : paramètre « <code>fonds</code> » ou « <code>collection</code> » manquant' ) )
end
if not institution then
wiki.minsert( Outils.erreur( '[[Modèle:Cite archive|{{Cite archive}}]] : paramètre « <code>institution</code> » 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
EN COURS !!!
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
--]]