« Module:Biblio/Lien web » : différence entre les versions
Contenu supprimé Contenu ajouté
nitpicks code lien |
constaté des problèmes de performances avec le modèle {{Lien web}}, pour essayer d'améliorer cela, je retire l'utilisation de Module:TableBuilder sur lequel j'ai des soupçons à ce sujet ; bien faire attention à ne pas insérer "false", et à ne pas concaténer "nil" ou "false" |
||
Ligne 3 : | Ligne 3 : | ||
local Commun = require( 'Module:Biblio/Commun' ) |
local Commun = require( 'Module:Biblio/Commun' ) |
||
local References = require( 'Module:Biblio/Références' ) |
local References = require( 'Module:Biblio/Références' ) |
||
local TableBuilder = require( 'Module:TableBuilder' ) |
|||
local function formatLien( args, dead ) |
local function formatLien( args, dead ) |
||
-- La table wiki va recevoir tous les petits morceaux de texte, et sera concaténée à la fin. |
-- La table wiki va recevoir tous les petits morceaux de texte, et sera concaténée à la fin. |
||
local wiki = {} |
|||
-- Elle utilise la meta-table de TableBuilder, permettant d'utiliser les fonctions de la |
|||
-- library table comme des méthodes. minsert permet d'insérer plusieurs éléments en une |
|||
-- cache local pour performances |
|||
-- seule fois en, ignorant les valeurs nil. |
|||
local |
local _tableInsert = table.insert |
||
-- permet d'écrire "insert( value )" au lieu de "table.insert( wiki, value )" |
|||
local function insert( value ) |
|||
_tableInsert( wiki, value ) |
|||
end |
|||
local modele = '[[Modèle:Lien web|{{Lien web}}]]' |
local modele = '[[Modèle:Lien web|{{Lien web}}]]' |
||
if dead then |
if dead then |
||
Ligne 28 : | Ligne 32 : | ||
-- Span initial, id |
-- Span initial, id |
||
local spanInitial, spanFinal = Commun.spanInitial( args, validArg ) |
local spanInitial, spanFinal = Commun.spanInitial( args, validArg ) |
||
insert( spanInitial ) |
|||
-- libellé |
-- libellé |
||
insert( Commun.libelle( args ) or nil ) |
|||
-- indication de langue |
-- indication de langue |
||
local indicLangue, codeLangue = Commun.indicationDeLangue( args, validArg ) |
local indicLangue, codeLangue = Commun.indicationDeLangue( args, validArg ) |
||
if indicLangue and indicLangue ~= '' then |
if indicLangue and indicLangue ~= '' then |
||
insert( indicLangue .. ' ' ) |
|||
end |
end |
||
Ligne 43 : | Ligne 47 : | ||
if auteur then |
if auteur then |
||
if validArg( 'auteurs' ) then |
if validArg( 'auteurs' ) then |
||
insert( args.auteurs ) |
|||
else |
else |
||
insert( Commun.responsabilitePrincipale( args, validArg ) or nil ) |
|||
end |
end |
||
local coauteur = validArg( 'co-auteur', 'coauteurs', 'coauteur', 'coauthors' ) |
local coauteur = validArg( 'co-auteur', 'coauteurs', 'coauteur', 'coauthors' ) |
||
if coauteur then |
if coauteur then |
||
insert( ', ' .. coauteur ) |
|||
end |
end |
||
insert( Commun.responsabiliteSecondaire( args, validArg ) or nil ) |
|||
insert( ', ' ) |
|||
end |
end |
||
Ligne 68 : | Ligne 72 : | ||
end |
end |
||
if dead or archiveUrl then |
if dead or archiveUrl then |
||
insert( '<span class="noarchive">' ) |
|||
end |
end |
||
if codeLangue and titre then |
if codeLangue and titre then |
||
insert( '<span lang="' .. codeLangue .. '">' ) |
|||
end |
end |
||
insert( '[' .. url .. ' ' ) |
|||
elseif not validArg( 'pmid', 'pmcid', 'doi', 'jstor', 'bibcod', 'math reviews', 'zbl', 'zbmath', 'arxiv' ) then |
elseif not validArg( 'pmid', 'pmcid', 'doi', 'jstor', 'bibcod', 'math reviews', 'zbl', 'zbmath', 'arxiv' ) then |
||
args.categ.url = true |
args.categ.url = true |
||
Ligne 86 : | Ligne 90 : | ||
-- on teste d'abord si titre contient déjà des guillemets |
-- on teste d'abord si titre contient déjà des guillemets |
||
if titre:match( '^«.+»$' ) then |
if titre:match( '^«.+»$' ) then |
||
insert( titre ) |
|||
else |
else |
||
local sousTitre = validArg( 'sous-titre' ) |
local sousTitre = validArg( 'sous-titre' ) |
||
-- par précaution, ne pas modifier la valeur de la variable locale "titre" |
|||
if sousTitre then |
if sousTitre then |
||
sousTitre = ' : ' .. sousTitre |
sousTitre = ' : ' .. sousTitre |
||
else |
|||
sousTitre = '' |
|||
end |
|||
local color = '' |
|||
⚫ | |||
color = ' color:red;' |
|||
end |
end |
||
⚫ | |||
⚫ | |||
⚫ | |||
end |
end |
||
if url then |
if url then |
||
insert( ']' ) |
|||
end |
end |
||
if codeLangue and url then |
if codeLangue and url then |
||
insert( '</span>' ) |
|||
end |
end |
||
Ligne 105 : | Ligne 115 : | ||
local traductionTitre = validArg( 'traduction titre' ) |
local traductionTitre = validArg( 'traduction titre' ) |
||
if traductionTitre and traductionTitre ~= args.titre then |
if traductionTitre and traductionTitre ~= args.titre then |
||
insert( ' [« ' .. traductionTitre .. ' »]' ) |
|||
end |
end |
||
if description then |
if description then |
||
insert( ', ' .. description ) |
|||
end |
end |
||
elseif description then |
elseif description then |
||
if dead and not archiveUrl then |
if dead and not archiveUrl then |
||
insert( '<span style="color:red;">' .. description .. '</span>' ) |
|||
else |
else |
||
insert( description ) |
|||
end |
end |
||
if url then |
if url then |
||
insert( ']' ) |
|||
end |
end |
||
else |
else |
||
args.categ.titre = true |
args.categ.titre = true |
||
if url then |
if url then |
||
insert( url .. ']' ) |
|||
end |
end |
||
end |
end |
||
Ligne 135 : | Ligne 145 : | ||
table.insert( absent, '« <code>titre</code> »' ) |
table.insert( absent, '« <code>titre</code> »' ) |
||
end |
end |
||
table.insert( wiki, 1, '<span class="error">Modèle ' |
|||
.. modele .. ' : paramètre' .. ( #absent > 1 and 's ' or ' ' ) |
.. modele .. ' : paramètre' .. ( #absent > 1 and 's ' or ' ' ) |
||
.. mw.text.listToText( absent ) .. ' manquant' .. ( #absent > 1 and 's' or '' ) |
.. mw.text.listToText( absent ) .. ' manquant' .. ( #absent > 1 and 's' or '' ) |
||
Ligne 144 : | Ligne 154 : | ||
-- liens archives pour les liens brisés |
-- liens archives pour les liens brisés |
||
if url and dead and not archiveUrl then |
if url and dead and not archiveUrl then |
||
insert( '<sup class="plainlinks">(' |
|||
'[http://web.archive.org/web/*/' |
.. '[http://web.archive.org/web/*/' .. url .. ' Archive] • ' |
||
'[http://archive.wikiwix.com/cache/?url=' |
.. '[http://archive.wikiwix.com/cache/?url=' .. url .. ' Wikiwix] • ' |
||
'[http://archive.is/' |
.. '[http://archive.is/' .. url .. ' Archive.is] • ' |
||
'[https://www.google.fr/search?q=cache:' |
.. '[https://www.google.fr/search?q=cache:' .. url .. ' Google] • ' |
||
'[[Projet:Correction des liens externes#J\'ai trouvé un lien mort, que faire ?|Que faire ?]]' |
.. '[[Projet:Correction des liens externes#J\'ai trouvé un lien mort, que faire ?|Que faire ?]]' |
||
')</sup>' |
.. ')</sup>' |
||
) |
) |
||
elseif archiveUrl then |
elseif archiveUrl then |
||
Ligne 164 : | Ligne 174 : | ||
end |
end |
||
end |
end |
||
insert( ' <small class="plainlinks cachelinks">[[' .. archiveUrl .. ' ' .. textArchive .. ']]</small>' ) |
|||
end |
end |
||
if url and ( dead or archiveUrl ) then |
if url and ( dead or archiveUrl ) then |
||
insert( '</span>' ) |
|||
end |
end |
||
Ligne 173 : | Ligne 183 : | ||
local indicationDeFormat = References.indicationDeFormat( validArg( 'format électronique', 'format' ) ) |
local indicationDeFormat = References.indicationDeFormat( validArg( 'format électronique', 'format' ) ) |
||
if indicationDeFormat and indicationDeFormat ~= '' then |
if indicationDeFormat and indicationDeFormat ~= '' then |
||
insert( indicationDeFormat ) |
|||
end |
end |
||
Ligne 179 : | Ligne 189 : | ||
local nature = validArg( 'nature document' ) |
local nature = validArg( 'nature document' ) |
||
if nature then |
if nature then |
||
insert( ' (' .. nature .. ')' ) |
|||
end |
end |
||
Ligne 185 : | Ligne 195 : | ||
local serie = validArg( 'série', 'work' ) |
local serie = validArg( 'série', 'work' ) |
||
if serie then |
if serie then |
||
insert( ', <span class="italique">' .. serie .. '</span>' ) |
|||
args.categ.work = validArg( 'work' ) -- il y a ambiguïté sur l'utilisation de ce paramètre |
args.categ.work = validArg( 'work' ) -- il y a ambiguïté sur l'utilisation de ce paramètre |
||
end |
end |
||
local site = validArg( 'site', 'website' ) |
local site = validArg( 'site', 'website' ) |
||
if site then |
if site then |
||
insert( ', sur <span class="italique">' .. site .. '</span>' ) |
|||
end |
end |
||
local periodique = validArg( 'périodique' ) |
local periodique = validArg( 'périodique' ) |
||
if periodique then |
if periodique then |
||
insert( ', <i>' .. periodique .. '</i>' ) |
|||
end |
end |
||
local lieu = validArg( 'lieu', 'lieu édition', 'location' ) |
local lieu = validArg( 'lieu', 'lieu édition', 'location' ) |
||
if lieu then |
if lieu then |
||
insert( ', ' .. lieu ) |
|||
end |
end |
||
local editeur = validArg( 'éditeur', 'publisher', 'editeur' ) |
local editeur = validArg( 'éditeur', 'publisher', 'editeur' ) |
||
Ligne 204 : | Ligne 214 : | ||
local lienEditeur = validArg( 'lien éditeur' ) |
local lienEditeur = validArg( 'lien éditeur' ) |
||
if lienEditeur then |
if lienEditeur then |
||
insert( ', [[' .. lienEditeur .. '|' .. editeur .. ']]' ) |
|||
else |
else |
||
insert( ', ' .. editeur ) |
|||
end |
end |
||
end |
end |
||
Ligne 217 : | Ligne 227 : | ||
if dateFormatee and dateFormatee ~= '' then |
if dateFormatee and dateFormatee ~= '' then |
||
local Langue = require( 'Module:Langue' ) |
local Langue = require( 'Module:Langue' ) |
||
local lrm |
local lrm = '' |
||
if Langue.nonLatin( |
if Langue.nonLatin( table.concat( wiki ) ) then |
||
lrm = '‎' |
lrm = '‎' |
||
end |
end |
||
insert( ',' .. lrm .. ' ' .. dateFormatee ) |
|||
end |
end |
||
end |
end |
||
Ligne 228 : | Ligne 238 : | ||
local affichageLiensExternes = References.affichageLiensExternes( args, validArg, false, true ) |
local affichageLiensExternes = References.affichageLiensExternes( args, validArg, false, true ) |
||
if affichageLiensExternes and affichageLiensExternes ~= '' then |
if affichageLiensExternes and affichageLiensExternes ~= '' then |
||
insert( affichageLiensExternes ) |
|||
end |
end |
||
-- fin du span |
-- fin du span |
||
insert( spanFinal ) |
|||
-- citation et passage |
-- citation et passage |
||
Ligne 241 : | Ligne 251 : | ||
citation = Langue.lang{ codeLangue, citation } |
citation = Langue.lang{ codeLangue, citation } |
||
end |
end |
||
insert( '\194\160: <span class="citation">« ' .. citation .. ' »</span>' ) |
|||
end |
end |
||
local passage = validArg( 'page', 'pages', 'passage' ) |
local passage = validArg( 'page', 'pages', 'passage' ) |
||
if passage then |
if passage then |
||
if passage:match( '^[%dIVXLCM]' ) then |
if passage:match( '^[%dIVXLCM]' ) then |
||
insert( ', ' .. Commun.page .. passage ) |
|||
else |
else |
||
insert( ', ' .. passage ) |
|||
end |
end |
||
end |
end |
||
Ligne 255 : | Ligne 265 : | ||
if validArg( 'plume' ) then |
if validArg( 'plume' ) then |
||
local patternPonct = '[,.;:!?] ?»?$' |
local patternPonct = '[,.;:!?] ?»?$' |
||
local ponctuation = |
local ponctuation = table.concat( wiki ):gsub( '%b<>', '' ):match( patternPonct ) |
||
if not ponctuation then |
if not ponctuation then |
||
insert( '.' ) |
|||
end |
end |
||
insert( Commun.plume ) |
|||
end |
end |
||
if mw.title.getCurrentTitle().namespace == 0 then |
if mw.title.getCurrentTitle().namespace == 0 then |
||
insert( |
|||
wiki.minsert( |
|||
args.categ.langue and '[[Catégorie:Page du modèle Lien web comportant une erreur|langue]]' |
args.categ.langue and '[[Catégorie:Page du modèle Lien web comportant une erreur|langue]]' or '' |
||
args.categ.url and '[[Catégorie:Page du modèle Lien web comportant une erreur|Url]]' |
.. args.categ.url and '[[Catégorie:Page du modèle Lien web comportant une erreur|Url]]' or '' |
||
args.categ.titre and '[[Catégorie:Page du modèle Lien web comportant une erreur|titre]]' |
.. args.categ.titre and '[[Catégorie:Page du modèle Lien web comportant une erreur|titre]]' or '' |
||
args.categ.enLigneLe and '[[Catégorie:Page du modèle Lien web comportant une erreur|enLigneLe]]' |
.. args.categ.enLigneLe and '[[Catégorie:Page du modèle Lien web comportant une erreur|enLigneLe]]' or '' |
||
args.categ.isbnInvalid and '[[Catégorie:Page avec ISBN invalide]]' |
.. args.categ.isbnInvalid and '[[Catégorie:Page avec ISBN invalide]]' or '' |
||
args.categ.issnInvalid and '[[Catégorie:Page avec ISSN invalide]]' |
.. args.categ.issnInvalid and '[[Catégorie:Page avec ISSN invalide]]' or '' |
||
) |
) |
||
end |
end |
||
if dead and not validArg( 'nocat' ) then |
if dead and not validArg( 'nocat' ) then |
||
insert( '[[Catégorie:Page contenant un lien mort]]' ) |
|||
end |
end |
||
return |
return table.concat( wiki ) |
||
end |
end |
||
Version du 14 juin 2020 à 09:44
[voir] [modifier] [historique] [purger]
Utilisation
Fonctions exportables :
lienWeb(args)
– affiche un lien vers un site web ; voir {{Lien web}} ; il faut fournir une table de paramètres simplelienBrise(args)
– affiche un lien brisé, auquel sont ajoutés des liens vers des sites d'archivage ; voir {{Lien brisé}} ; il faut fournir une table de paramètres simple
Modules externes et autres éléments dont ce module a besoin pour fonctionner :
Module:Biblio/Commun
Module:Biblio/Références
Module:Langue
– indirectement ( chargé par Module:Biblio/Commun ) si le paramètre langue est renseigné
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 (modifier).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
local Lien = { }
local Commun = require( 'Module:Biblio/Commun' )
local References = require( 'Module:Biblio/Références' )
local function formatLien( args, dead )
-- La table wiki va recevoir tous les petits morceaux de texte, et sera concaténée à la fin.
local wiki = {}
-- cache local pour performances
local _tableInsert = table.insert
-- permet d'écrire "insert( value )" au lieu de "table.insert( wiki, value )"
local function insert( value )
_tableInsert( wiki, value )
end
local modele = '[[Modèle:Lien web|{{Lien web}}]]'
if dead then
modele = '[[Modèle:Lien brisé|{{Lien brisé}}]]'
end
-- validArg renvoie le premier paramètre non vide, ou nil s'ils sont tous vides.
-- Seuls les noms des paramètres doivent être transmis à la fonction.
local validArg = function ( ... ) return Commun.validTextArg( args, ... ) end
-- Variables servant à la catégorisation
args.categ = {}
if validArg( 'dead-url', 'deadurl', 'brisé le', 'lien brisé' ) then
dead = true
end
-- Span initial, id
local spanInitial, spanFinal = Commun.spanInitial( args, validArg )
insert( spanInitial )
-- libellé
insert( Commun.libelle( args ) or nil )
-- indication de langue
local indicLangue, codeLangue = Commun.indicationDeLangue( args, validArg )
if indicLangue and indicLangue ~= '' then
insert( indicLangue .. ' ' )
end
-- Liste des auteurs et de leurs responsabilités (principales et secondaires)
local auteur = validArg( 'nom1', 'nom', 'auteur1', 'auteur', 'auteurs', 'auteur institutionnel', 'last1', 'last', 'author1', 'author' )
if auteur then
if validArg( 'auteurs' ) then
insert( args.auteurs )
else
insert( Commun.responsabilitePrincipale( args, validArg ) or nil )
end
local coauteur = validArg( 'co-auteur', 'coauteurs', 'coauteur', 'coauthors' )
if coauteur then
insert( ', ' .. coauteur )
end
insert( Commun.responsabiliteSecondaire( args, validArg ) or nil )
insert( ', ' )
end
local url = validArg( 'url', 'lire en ligne', 'url texte', 'lien' )
local archiveUrl = validArg( 'archive-url', 'archiveurl' )
local titre = validArg( 'titre', 'title' )
local description = validArg( 'description' )
-- url
if url then
-- remplacement des crochets et espaces par leur équivalent HTML
url = url:gsub( '%[', '%%5B' ):gsub( '%]', '%%5D' ):gsub( ' ', '%%20' )
-- ajout http:// si nécessaire :
if not ( url:match( '^https?://' ) or url:match( '^ftp://' ) or url:match( '^//' ) ) then
url = 'http://' .. url
end
if dead or archiveUrl then
insert( '<span class="noarchive">' )
end
if codeLangue and titre then
insert( '<span lang="' .. codeLangue .. '">' )
end
insert( '[' .. url .. ' ' )
elseif not validArg( 'pmid', 'pmcid', 'doi', 'jstor', 'bibcod', 'math reviews', 'zbl', 'zbmath', 'arxiv' ) then
args.categ.url = true
end
-- titre
if titre then
-- suppression des retours ligne éventuels, sinon MediaWiki ne reconnaît pas le lien externe
-- et remplacement des crochets par leur équivalent HTML (uniquement le crochet de fermeture)
titre = titre:gsub( '\n', ' ' ):gsub( '%]', ']' )
-- on teste d'abord si titre contient déjà des guillemets
if titre:match( '^«.+»$' ) then
insert( titre )
else
local sousTitre = validArg( 'sous-titre' )
-- par précaution, ne pas modifier la valeur de la variable locale "titre"
if sousTitre then
sousTitre = ' : ' .. sousTitre
else
sousTitre = ''
end
local color = ''
if dead and not archiveUrl then
color = ' color:red;'
end
insert( '« <cite style="font-style: normal;' .. color .. '">' .. titre .. sousTitre .. '</cite> »' )
end
if url then
insert( ']' )
end
if codeLangue and url then
insert( '</span>' )
end
-- traduction titre
local traductionTitre = validArg( 'traduction titre' )
if traductionTitre and traductionTitre ~= args.titre then
insert( ' [« ' .. traductionTitre .. ' »]' )
end
if description then
insert( ', ' .. description )
end
elseif description then
if dead and not archiveUrl then
insert( '<span style="color:red;">' .. description .. '</span>' )
else
insert( description )
end
if url then
insert( ']' )
end
else
args.categ.titre = true
if url then
insert( url .. ']' )
end
end
-- message d'erreur
if args.categ.url or args.categ.titre then
local absent = { }
if args.categ.url then
table.insert( absent, '« <code>url</code> »' )
end
if args.categ.titre then
table.insert( absent, '« <code>titre</code> »' )
end
table.insert( wiki, 1, '<span class="error">Modèle '
.. modele .. ' : paramètre' .. ( #absent > 1 and 's ' or ' ' )
.. mw.text.listToText( absent ) .. ' manquant' .. ( #absent > 1 and 's' or '' )
.. '. </span>'
)
end
-- liens archives pour les liens brisés
if url and dead and not archiveUrl then
insert( '<sup class="plainlinks">('
.. '[http://web.archive.org/web/*/' .. url .. ' Archive] • '
.. '[http://archive.wikiwix.com/cache/?url=' .. url .. ' Wikiwix] • '
.. '[http://archive.is/' .. url .. ' Archive.is] • '
.. '[https://www.google.fr/search?q=cache:' .. url .. ' Google] • '
.. '[[Projet:Correction des liens externes#J\'ai trouvé un lien mort, que faire ?|Que faire ?]]'
.. ')</sup>'
)
elseif archiveUrl then
if not ( archiveUrl:match( '^http' ) or archiveUrl:match( '^//' ) ) then
archiveUrl = 'http://' .. archiveUrl
end
local textArchive = 'archive'
local dateArchive = validArg( 'archive-date', 'archivedate' )
if dateArchive then
dateArchive = Commun.inscriptionDate{ date = dateArchive }
if dateArchive and dateArchive ~= '' then
textArchive = textArchive .. ' du ' .. dateArchive
end
end
insert( ' <small class="plainlinks cachelinks">[[' .. archiveUrl .. ' ' .. textArchive .. ']]</small>' )
end
if url and ( dead or archiveUrl ) then
insert( '</span>' )
end
-- format
local indicationDeFormat = References.indicationDeFormat( validArg( 'format électronique', 'format' ) )
if indicationDeFormat and indicationDeFormat ~= '' then
insert( indicationDeFormat )
end
-- Nature du document
local nature = validArg( 'nature document' )
if nature then
insert( ' (' .. nature .. ')' )
end
-- série, site, éditeur
local serie = validArg( 'série', 'work' )
if serie then
insert( ', <span class="italique">' .. serie .. '</span>' )
args.categ.work = validArg( 'work' ) -- il y a ambiguïté sur l'utilisation de ce paramètre
end
local site = validArg( 'site', 'website' )
if site then
insert( ', sur <span class="italique">' .. site .. '</span>' )
end
local periodique = validArg( 'périodique' )
if periodique then
insert( ', <i>' .. periodique .. '</i>' )
end
local lieu = validArg( 'lieu', 'lieu édition', 'location' )
if lieu then
insert( ', ' .. lieu )
end
local editeur = validArg( 'éditeur', 'publisher', 'editeur' )
if editeur then
local lienEditeur = validArg( 'lien éditeur' )
if lienEditeur then
insert( ', [[' .. lienEditeur .. '|' .. editeur .. ']]' )
else
insert( ', ' .. editeur )
end
end
-- date
if validArg( 'année', 'date', 'year', 'en ligne le', 'en ligne' ) then
args.categ.enLigneLe = validArg( 'date' ) and validArg( 'en ligne le' ) and args.date ~= args['en ligne le']
args.date = validArg( 'date', 'en ligne le', 'en ligne' )
local dateFormatee = Commun.inscriptionDate( args )
if dateFormatee and dateFormatee ~= '' then
local Langue = require( 'Module:Langue' )
local lrm = ''
if Langue.nonLatin( table.concat( wiki ) ) then
lrm = '‎'
end
insert( ',' .. lrm .. ' ' .. dateFormatee )
end
end
-- liens externes (isbn, doi...) et "consulté le" entre parenthèses, et en plus petit, sauf en note
local affichageLiensExternes = References.affichageLiensExternes( args, validArg, false, true )
if affichageLiensExternes and affichageLiensExternes ~= '' then
insert( affichageLiensExternes )
end
-- fin du span
insert( spanFinal )
-- citation et passage
local citation = validArg( 'citation', 'extrait', 'quote' )
if citation then
if codeLangue then
local Langue = require( 'Module:Langue' )
citation = Langue.lang{ codeLangue, citation }
end
insert( '\194\160: <span class="citation">« ' .. citation .. ' »</span>' )
end
local passage = validArg( 'page', 'pages', 'passage' )
if passage then
if passage:match( '^[%dIVXLCM]' ) then
insert( ', ' .. Commun.page .. passage )
else
insert( ', ' .. passage )
end
end
-- Plume "Ouvrage utilisé pour la rédaction de l'article"
if validArg( 'plume' ) then
local patternPonct = '[,.;:!?] ?»?$'
local ponctuation = table.concat( wiki ):gsub( '%b<>', '' ):match( patternPonct )
if not ponctuation then
insert( '.' )
end
insert( Commun.plume )
end
if mw.title.getCurrentTitle().namespace == 0 then
insert(
args.categ.langue and '[[Catégorie:Page du modèle Lien web comportant une erreur|langue]]' or ''
.. args.categ.url and '[[Catégorie:Page du modèle Lien web comportant une erreur|Url]]' or ''
.. args.categ.titre and '[[Catégorie:Page du modèle Lien web comportant une erreur|titre]]' or ''
.. args.categ.enLigneLe and '[[Catégorie:Page du modèle Lien web comportant une erreur|enLigneLe]]' or ''
.. args.categ.isbnInvalid and '[[Catégorie:Page avec ISBN invalide]]' or ''
.. args.categ.issnInvalid and '[[Catégorie:Page avec ISSN invalide]]' or ''
)
end
if dead and not validArg( 'nocat' ) then
insert( '[[Catégorie:Page contenant un lien mort]]' )
end
return table.concat( wiki )
end
function Lien.lienWeb( args )
return formatLien( args, false )
end
function Lien.lienBrise( args )
args.titre = Commun.validTextArg( args, 'titre', 'title', 'url', 'lire en ligne', 'url texte', 'lien' )
return formatLien( args, true )
end
return Lien