Module:Auteur
Aller à la navigation
Aller à la recherche
La documentation de ce module Scribunto écrit en Lua est incluse depuis sa sous-page de documentation.
Ce module EN TEST génère un cadre d'en-tête pour les pages d'auteurs du WikiSource français (en remplacement de l'actuel Modèle:Auteur).
- Ce module Module:Auteur utilise Module:ControlArgs et Module:MathRoman.
Module:Auteur oldargs AVEC paramètres obsolètes c=:[modifier]
Erreur Lua dans package.lua à la ligne 80 : module 'Module:ControlArgs' not found.
Module:Auteur oldargs AVEC paramètres obsolètes debug=:[modifier]
Erreur Lua dans package.lua à la ligne 80 : module 'Module:ControlArgs' not found.
Module:Auteur oldargs SANS paramètres obsolètes[modifier]
Erreur Lua dans package.lua à la ligne 80 : module 'Module:ControlArgs' not found.
Module:Auteur normal[modifier]
Erreur Lua dans package.lua à la ligne 80 : module 'Module:ControlArgs' not found.
Livres (avec notices ?)[modifier]
- Sous les toits de Paris. Erreur Lua dans package.lua à la ligne 80 : module 'Module:ControlArgs' not found.
- Recueil de poèmes. Erreur Lua dans package.lua à la ligne 80 : module 'Module:ControlArgs' not found.
Fonctions et conception[modifier]
- http://fr.wikisource.org/wiki/Module:Auteur
- Ce module dessine un cadre d'entête de page d'auteur dans wikisource français.
- Il est appelé par le Modèle:Auteur
- Il utilise le Module:ControlArgs pour vérifier les paramètres (arguments en anglais), et pour alerter ou conseiller l'utilisateur.
- This module draws a header of Author page in french wikisource
- It is called by templates Template:Auteur
- It uses the Module:ControlArgs to verify arguments (les paramètres en français), and to warm or advise the user.
- Le Module:Auteur utilise le Module:ControlArgs ainsi :
- L'assistance à l'utilisateur génère des messages sur les paramètres à problèmes.
- Une table des arguments permet de repérer les arguments nécessaires, manquants, synonymes, numérotés ...
- Des tables de traductions permettent de recevoir les arguments ou de générer les messages en plusieurs langues.
- Example of complex template with many arguments
- Exemple de modèle complexe avec de nombreux paramètres
- { {Auteur |c=:|options=fr test params
- |nom=Hugo|prénom=Victor|prénomGall= Arthur
- |cle=Hugo Victor|initiale=H
- |image=Victor Hugo.jpg |description=écrivain français
- |texte=vie |categorie=Auteurs |lien=du |liaison=de l'
- |texteNaissance=a |categorieNaissance=Auteurs
- |incertitudeNaissance= vers |lienNaissance=du |liaisonNaissance=en
- |anneeNaissance= 1802 |siecleNaissance= 19
- |texteDeces=a |categorieDeces=Auteurs
- |incertitudeDeces= après |lienDeces= du |liaisonDeces=en
- |anneeDeces= 1885 |siecleDeces= 19
- |droits=non |pseudo=Monsieur Legrand
- |genre=Romanciers/Poètes/Auteurs de théatre
- |langue=français |pays=France/Italie/Grèce
- |metier=Académiciens/Personnalités politiques
- |prix=Prix Nobel de littérature
- |VIAF=34452139|NLA=35096649|BNF=cb11888266r|SELIBR=34648|PND=11850133X|LCCN=n/50/23101
- |border=0
- } }
GESTION DES PARAMETRES DU MODELE, MANAGING PARAMETERS OF THE TEMPLATE[modifier]
- La gestion des paramètres permet de :
- Lire et mémoriser tous des paramètres fournis par le modèle (voir arg_input arg_memorize)
- S'adapter à la langue du wiki pour les paramètres, et à la langue de l'utilisateur pour les messages.
- Lire ou modifier simplement la valeur mémorisée chaque fois que nécessaire, indépendamment de la langue (voir argv arg_memorize)
- Lister les paramètres, tous(docmax), ou ceux définis(docdef), ou selon la spécialisation (docmin, doc1 à doc3)
- Aider à documenter le modèle selon divers aspects, types, usages ...
- Lire d'abord tous les paramètres définis, puis calculer les interactions des noms, prénoms, et autres.
- Développer la vérification des paramètres, de leurs valeurs, de leurs interdépendances.
- Une table args_known décrit les paramètres, leurs types, leurs valeurs et leurs appelations dans diverses langues.
- Les types sont ctr = controle, dat = donnée, ntc = notice, opt = options, syn = synonyme, prg = géré uniquement par le programme
- Les langues sont : en = anglais, es = espagnol, fr = français et il est facile d'en ajouter.
- L'objet MArgms, tables et fonctions, est développé ici pour être déplacée dans un module indépendant et partagé.
- Le 2013-01-27, l'objet MArgms est prévu pour fonctionner comme une classe, avec héritage et fonction New, mais n'est pas encore validé.
--[[ -- relire ControlArgs/Auteur : module code in english -- * Questions de migration vers Module:Auter -- Adapter les erreurs et catégories de maintenance aux besoins. -- Adapter la liste des notices à ws:fr. -- Vérifier tous les tests unitaires pour oublier moins de cas. -- initiales automatiques trop difficiles. -- répondre à tous les "A faire ?" ci_dessous -- a faire ? demander a wikidata un champ "type de droit d'auteur" -- a faire ? demander a wikidata un champ "date d'une oeuvre" -- a faire ? migrer la table args_known dans le sous module I18N, pour adapter la liste des notices à chaque wiki. -- A faire : generer une erreur sur les valeurs de nombres romains. -- A faire : Ajouter la "Catégorie:Droits d’auteur 50 ans". Et la valeur par défaut 70 ans. -- Quand on crée un nouvel auteur avec le formulaire automatique, la valeur par défaut pour les droits est : 50 ans (canadien) - serait-il possible de mettre par défaut 70 ans, sinon on risque des problèmes en n'ayant pas pris le temps de vérifier la nationalité de l'auteur (qui est français 99/100). -- https://fr.wikisource.org/wiki/Discussion_utilisateur:Tpt#Param.C3.A9trage_en_cr.C3.A9ation_Auteur -- J’ai ajouté la catégorisation dans Catégorie:Droits d’auteur 50 ans. Il faut attendre avant que tous les auteurs y apparaissent. (Ça m'a permis de voir deux erreurs que j’ai faites…) Aristoi (d) 19 mars 2014 à 18:28 (UTC) -- a faire ? "Catégorie:Domaine public en 2014" -- a faire ? notices non coupees par un retour a la ligne. Le style est en place mais les navigateurs ne l'interprètent pas encore. -- A faire : dans le bug "edit state" demander aussi "creation state" pour adapter ou remplacer l'automate. -- voir https://fr.wikisource.org/wiki/Discussion_utilisateur:Tpt#Param.C3.A9trage_en_cr.C3.A9ation_Auteur -- Quand on crée un nouvel auteur avec le formulaire automatique, la valeur par défaut pour les droits est : 50 ans (canadien) - serait-il possible de mettre par défaut 70 ans -- A faire : debug interprojet stable avec Tpt -- A faire : finaliser l'intégration de microformat avec Tpt -- A faire : "Catégorie:Module manquant de traduction i18n function" <-- le mot function est en trop. voir err_module_miss_i18n_cat, dans ControlArgs ou Auteur ? -- A faire : Dans le calcul des époques et siècles, il y a une ambiguité depuis longtemps : le libelé des siècles est "Naissance en 1876" alors que les époques sont basées sur l'âge de publication à partir de 20 ans. A la transition entre siècles et époques il y a un flou. -- A faire : droits d'auteur, dans les box renvoyer vers l'aide. -- A faire : droits d'auteur, ajouter l'aide DP 1923 + DP-EU + DP-US -- A faire : HTMLscans et HTMLnotice avec fr.wikipedia international i18n -- A faire : Modules should be in English (while docs are not) Guerrit : https://gerrit.wikimedia.org/r/95407 -- En attente : Detect the edit state to adapt help messages to user errors https://bugzilla.wikimedia.org/show_bug.cgi?id=51660 -- A faire : mieux séparer la préparation des tests dans des fonctions pour simplifier la fonction interface.base() -- a faire ? mode et/ou option "notice" pour les notices choisies par les arguments ? -- a faire ? mode et/ou option "notices" pour les notices venant de wikidata ? -- a faire ? Selection de notices : limiter le nombre par un maxi. trier les notices dans l'ordre prefere pour un wiki. Ne demander a wikidata que les notices necessaires ? -- a faire ? limiter le nombre de notices avec une liste de priorités entre elles, par le paramètre args_known { priority = 2... } -- a faire ? notices multiples : traiter toutes les notices multiples. Voir Johnny Hallyday wikidata ISNI. -- a faire ? Il serait bon d'inscrire dans l'espace de noms "Auteur:" la mention de la date estimée de fin des droits d'auteur exclusifs de ces auteurs connus (avec le pays où ces droits sont issus), afin de repérer leurs oeuvres publiées illégalement — Verdy_p (d) 18 février 2014 à 02:23 ? -- a faire ? Signaler pour chaque oeuvre le debut probable du domaine public (et les elements sur lesquels il est basé) -- a faire ? Calculer pour chaque oeuvre le debut probable du domaine public, dans les cas les plus courants. Et signaler sinon les limites du calcul. -- a faire ? Utiliser les notices dans le Modèle:Document. -- Traces de discussions pour debug ou évolutions : -- Pour les années de naissance avant 1901, le mettre en catégories de siècles. Le Modèle:Epoque ne génère pas de catégories d’années avant 1901, voir la documentation. De mémoire, parce qu'elles sont trop dispersées et que ces catégories servent surtout à repérer chaque année les auteurs nouvellement publiables. --Rical (d) 9 novembre 2012 à 21:04 (UTC) -- Certaines catégories sont étranges. « Auteurs par pays : », « Auteurs par pseudo », etc. Est-ce que ce serait possible de mettre à jour ce modèle pour le faire correspondre aux catégories qui existent déjà ? Marc (d) 3 avril 2013 à 10:49 (UTC) -- Catégorie:Femmes auteurs -- Catégorie:Auteurs par nationalité [×] Auteurs anglais (142 P) Catégorie:Auteurs anglais -- [+] Auteurs par pseudo (1 C) à modifier -> Catégorie:Pseudonymes -- Auteurs par pays : n'existe pas -- [×] Auteurs morts pour la France (15 P) Catégorie:Auteurs morts pour la France -- [+] Auteurs par période (12 C, 1 P) Catégorie:Auteurs par période -- fait : notices multiples : traiter les notices multiples en prenant la pemiere seulement. Voir Johnny Hallyday wikidata ISNI. -- fait : source d'argument à modifier dans interact_args = "inter" -- fait : 4 fonctions d'interfaces : normal, notice, doc, tests -- fait : Catégories automatiques d’années depuis les derniers 100 ans -- doc : Ce module peut porter d'autres noms dans d'autres langues, le code etant identique. -- doc : couleurs des origines des arguments en doc -- doc : <code>module</code> -- doc : Lors de la création d'une page d'auteur, établir le lien wikisource avec wikidata. -- doc : Le modèle definissait les années incertaines par plusieurs paramètres. -- doc : Le module reconnait l'année dans le texte libre du paramètre. -- doc : http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual -- doc perso : aller a une ligne de code en edit https://test2.wikipedia.org/w/index.php?title=Module:Auteur&action=edit#mw-ce-l3399 -- doc : Assistance internationale : un administrateur peut assister un wiki inconnu en selectionner une langue qu'il connait pour lire les messages et noms d'arguments. Demander une evolution pour connaitre la langue de l'utilisateur ( bug NNNN ). -- doc : valeurs autorisées pour un argument, exemple pour la région : china/india/century/other -- voir : arg_values = "region_values", key_values = "other/china/india/century" -- pour region et droits d'auteur, dans p.args_known p.args_source et i18n.erreur_de_valeur et module avec erreur ]] -- Module dependencies. Dependencias del módulo. Dépendances du module. local MathRoman = require "Module:MathRoman" local CA = require "Module:ControlArgs" local Interprojet = require "Module:Interprojet" ------------------------------------------------------------ -- Interface from the module to the template -- Interface du module pour le modèle ------------------------------------------------------------ local p = {} p.nowyear = tonumber(os.date("%Y") ) -- local now_date = os.date("%Y-%m-%d %H:%M:%S") p.constantes = { -- Categorize the year of death for 100 years -- Clasificar el año que murió hace 100 años -- Catégoriser l'année de décès depuis 100 ans categorise_death_for_n_years = 100, -- normal = 100 -- Start writing an author after birth -- Comience a escribir un autor después de su nacimiento -- Début d'écriture d'un auteur après la naissance author_birth_to_writing = 20, -- Finished writing a writer before his death -- Terminó escribiendo un escritor antes de su muerte -- Fin d'écriture d'un auteur avant son décès author_writing_before_death = 5, -- Limit of normal life -- Límite de la vida normal -- Limite de durée de vie normale lifetime_limit = 120, } -- Limit of normal time writing of an author -- Límite de tiempo normal de escribir de un autor -- Limite normale de durée d'écriture d'un auteur p.constantes.author_writing_time_limit = p.constantes.lifetime_limit - p.constantes.author_birth_to_writing - p.constantes.author_writing_before_death local annotations = {} annotations["lastname"] = "fn" annotations["firstname"] = "n" annotations["description"] = "label" annotations["birthyear"] = "bday" annotations["deathyear"] = "dday" local microformat = function(data) if data ~= " cette instruction desactive microformat pour debug. " then return "" end local text = {} local style = "display:none; speak:none;" for n,v in pairs(data) do local class = annotations[n] local datum = mw.text.tag({name="span", contents=v, params={id=n,class=class}}) table.insert(text, datum) end return mw.text.tag({name="div", contents=table.concat(text), params={id="ws-data", class="vcard ws-noexport", style=style}}) end -- Translation in i18n tables. Tables de traductions i18n. p.i18n_Auteur = { } p.i18n_Auteur.en = { -- English translations of arguments, categories and messages : mode = 'mode', lastname = 'lastname', initiale = 'initiale', familyname = 'familyname', firstname = 'firstname', pseudonym = 'pseudonym', title = 'title', galliname = 'galliname', sex = 'sex', sortkey = 'sortkey', image = 'image', birthyear = 'birthyear', birth = 'birth', birthcentury = 'birthcentury', birthuncertain = 'birthuncertain', region = 'region', -- argument with verified multiple values region_values = 'other/china/india/century', args_values_err = "Abnormal value of the argument '''%1 = %2''' (%3)", deathyear = 'deathyear', death = 'death', deathcentury = 'deathcentury', deathuncertain = 'deathuncertain', description = 'description', occupation = 'occupation', genre = 'genre', language = 'language', country = 'country', prize = 'prize', rights = 'rights', -- argument with verified multiple values rights_values = '70/50/mpf/none', rights_values_cat_70 = "Author in public domain in USA", rights_values_box_70 = "DP-EU-Auteur", rights_values_cat_50 = "Author in public domain in Canada", rights_values_box_50 = "-", rights_values_cat_mpf = "Author death for France", rights_values_box_mpf = "-", rights_values_cat_none = "-", rights_values_box_none = "-", wikipedia = 'wikipedia', wikiquote = 'wikiquote', commons = 'commons', commonscat = 'commonscat', namespace = 'space', category = 'Category', catspace = 'catspace', -- oldargs selon wikisource Modèle:Auteur/Documentation le 05/01/2014 birth_text = 'birthText', death_text = 'deathText', birth_type = 'birthType', death_type = 'deathType', birth_link = 'birthLink', death_link = 'deathLink', birth_link2 = 'birthLink2', death_link2 = 'deathLink2', -- Scans and Notices author_scans_text = 'Scans and authorities', author_Notices = 'Notices', ARC = 'ARC', ARCgeo = 'ARCgeo', ARCid = 'ARCid', ARCitem = 'ARCitem', ARCorg = 'ARCorg', ARCsub = 'ARCsub', ARCHIVE = 'ARCHIVE', BNF = 'BNF', BNFbook = 'BNFbook', DNB = 'DNB', GKD = 'GKD', GKD_V1 = 'GKD_V1', GND = 'GND', IA = 'IA', IBL = 'IBL', IBLid = 'IBLid', IBLbook = 'IBLbook', IMDb = 'IMDb', ISBN = 'ISBN', ISFDB = 'ISFDB', ISFDBid = 'ISFDBid', ISFDBpub = 'ISFDBpub', ISNI = 'ISNI', LCCN = 'LCCN', LCCNid = 'LCCNid', LT = 'LT', NDL = 'NDL', NKC = 'NKC', NLA = 'NLA', OCLC = 'OCLC', OL = 'OL', OLbook = 'OLbook', PND = 'PND', SELIBR = 'SELIBR', SUDOC = 'SUDOC', SWD = 'SWD', ULAN = 'ULAN', VIAF = 'VIAF', WORLDCAT = 'WORLDCAT', WORLDCATbook = 'WORLDCATbook', WORLDCATch = 'WORLDCATch', WORLDCATid = 'WORLDCATid', -- Categories and Various messages -- wanted_error = "EN wanted error", authors_authors = "Authors", authors_initiale = "Authors-%1", authors_birthyear = 'Born in %1', authors_deathyear = 'Death in %1', authors_birth_century = "Born in %1..", authors_death_century = "Death in %1..", list_limit_levelmaxi = "Structure limit levelmaxi=%1", list_limit_maxn = "Structure limit maxn=%1", limit_cat_birth_death = 'Limit the years of categories "Births in" and "Death in".', cat_epoch_china_antiquity = "Author of Chinese antiquity", cat_epoch_china_springs = "Author of Springs and Autumns", cat_epoch_china_empires = "Author of Chinese empires", cat_epoch_indian_indus = "Author of Indus civilisation", cat_epoch_indian_antiquity = "Author of Indian antiquity", cat_epoch_indian_muslim = "Author of Indo-Muslim period", cat_epoch_antiquity = "Author of antiquity", cat_epoch_middle_age = "Author of Middle Ages", cat_epoch_century_EC = "Born in the %1th century", cat_epoch_century_BEC = "Born in the %1th century BEC", century_EC = "%1 th century", century_BEC = "%1 th century BEC", -- Error messages and categories -- These messages should also include those of module(s) called. err_one_number_argument = "Error: In parameter '''%1''', enter a single number between -5000 and now.", err_assist_user_param = "User support for checking the settings:", err_module_error = "Module error", -- err_vague_year = "Uncertain year.", err_death_before_birth = "Error: death '''%1''' is before birth '''%2'''.", err_death_before_birth_cat = "Author death is before birth.", err_life_too_long = "Life is too long from %1 to %2.", err_life_too_long_cat = "Life of author is too long", err_no_known_arguments = "Module without known arguments table.", err_vague_epoch = "Uncertain times.", err_unknown_epoch_cat = "Unknown epoch", err_year_in_roman_number = "Ambiguity: the year '''%1''' is in roman numerals. Do you want define a century ?", err_notices_properties = "Internal Error: An authority record is undefined : %1.", err_notices_properties_cat = "Internal Error: One or more authority record is undefined.", -- These messages are used to Cargs = ControlAgrs module and are copied here. c = 'c', debug = "debug", options = 'options', err_error_list_header = "User support about parameters:", err_unknown_argument = "Error: parameter '''%1''' is unknown in this template. Check the name or flag this gap.", err_nearest_argument = "Error: the known argument '''%1''' is it the one you need ?", err_value_re_defined = "Error: the value of the argument '''%1''' is already defined. Choose only one argument and value.", err_need_value = "Error: This argument is required but absent : '''%1'''. Should define it.", err_none_value = "Error: No argument has been defined.", err_too_unnamed_arguments = "Error: Too many unnamed arguments ( '''%1''' ).", err_internal_notice_wsid = "Internal Error: Notify the developer that the internal argument '''%1''' is unknown in the records.", err_without_translation = "<br/>Known argument, but not translated: '''%1'''.", err_without_translation_N = "<br/>There are %1 arguments untranslated.", err_is_defined = "<br/>The argument %1:'''%2''' is defined.", err_is_undefined = "<br/>The argument %1:'''%2''' is not defined.", err_module_with_error = "Module with error", err_wikidata_wikibase = "Error: Wikibase is not available.", err_wikidata_getEntity = "Error: getEntity Wikidata is not available.", err_wikidata_getElement = "Error: Element Wikidata '''%1''' is not found.", err_wikidata_property = "Error: Wikidata property '''%1''' is not found.", err_wikidata_error = "Error Wikidata: %1", err_wikidata_cat = "Error Wikidata", err_notice_link = "Error: bad notice for '''%1'''.", err_notice_link_cat = "Module with bad notice", list_limit_levelmaxi = "List limit levelmaxi=%1", list_limit_max_n = "List limit max_n=%1", err_module_miss_i18n_arg = "Internal Error: argument '''%1''' misses in i18n translation.", err_module_miss_i18n_res = "Internal Error: There are '''%1''' missings in '''%2''' translations.", err_module_miss_i18n_cat = "Module missing i18n translation", err_module_i18n_miss_trans = "Error: I18n table has only '''1%''' translations.", err_no_args_known = "Error: Module without known arguments table.", err_no_args_source = "Error: Module without source arguments table.", err_no_args_lang = "Error: Module without translated arguments table.", err_lang_table = "Error: The '''%1''' language or its table is incorrect.", err_lang_table_cat = "Error: Erroneous language arguments", err_lang_not_exist = "Error: The language '''%1''' is not one of wikipedias.", } -- p.i18n_Auteur.en p.i18n_Auteur.es = { -- Traducciones al español de los argumentos, categorías y mensajes: mode = 'modo', lastname = 'nombre', initiale = 'initiale', familyname = 'primernombre', firstname = 'apellido', pseudonym = 'apodo', title = 'título', galliname = 'apellidoGalli', sex = 'sexo', sortkey = 'especie clave', image = 'imagen', birthyear = 'año de nacimiento', birth = 'nacimiento', birthcentury = 'siglo de nacimiento', birthuncertain = 'nacimiento incierto', region = 'región', region_values = 'otros/china/india/siglo', args_values_err = "Valor anormal del argumento '''%1 = %2''' (%3)", deathyear = 'año de la muerte', death = 'muerte', deathcentury = 'siglo de la muerte', deathuncertain = 'muerte incierto', description = 'descripción', occupation = 'profesión', genre = 'tipo', language = 'lengua', country = 'país', prize = 'premio', rights = 'derechos', rights_values = '70/50/mpf/nada', rights_values_cat_70 = "Autores en el dominio público en los Estados Unidos", rights_values_box_70 = "DP-EU-Auteur", rights_values_cat_50 = "Autores en el dominio público en Canadá", rights_values_box_50 = "-", rights_values_cat_mpf = "Autores que murieron por Francia", rights_values_box_mpf = "-", rights_values_cat_none = "-", rights_values_box_none = "-", wikipedia = 'wikipedia', wikiquote = 'wikiquote', commons = 'commons', commonscat = 'commonscat', namespace = 'espacio', category = 'Categoría', catspace = 'catespacio', -- oldargs selon wikisource Modèle:Auteur/Documentation le 05/01/2014 birth_text = 'textNacido', death_text = 'textMuerto', birth_type = 'nacimientoTipo', death_type = 'muertoTipo', birth_link = 'enlaceNacimiento', death_link = 'enlaceMuerto', birth_link2 = 'enlace2Nacimiento', death_link2 = 'enlace2Muerto', -- Scans and Notices author_scans_text = 'Escanea y autoridades', author_Notices = 'Avisos', ARC = 'ARC', ARCgeo = 'ARCgeo', ARCid = 'ARCid', ARCitem = 'ARCitem', ARCorg = 'ARCorg', ARCsub = 'ARCsub', ARCHIVE = 'ARCHIVE', BNF = 'BNF', BNFbook = 'BNFbook', DNB = 'DNB', GKD = 'GKD', GKD_V1 = 'GKD_V1', GND = 'GND', IA = 'IA', IBL = 'IBL', IBLid = 'IBLid', IBLbook = 'IBLbook', IMDb = 'IMDb', ISBN = 'ISBN', ISFDB = 'ISFDB', ISFDBid = 'ISFDBid', ISFDBpub = 'ISFDBpub', ISNI = 'ISNI', LCCN = 'LCCN', LCCNid = 'LCCNid', LT = 'LT', NDL = 'NDL', NKC = 'NKC', NLA = 'NLA', OCLC = 'OCLC', OL = 'OL', OLbook = 'OLbook', PND = 'PND', SELIBR = 'SELIBR', SUDOC = 'SUDOC', SWD = 'SWD', ULAN = 'ULAN', VIAF = 'VIAF', WORLDCAT = 'WORLDCAT', WORLDCATbook = 'WORLDCATbook', WORLDCATch = 'WORLDCATch', WORLDCATid = 'WORLDCATid', -- Categorías y Varios mensajes -- Estos mensajes deben incluir también los de módulo(s) llamado. -- error_deseada = 'ES error deseada', authors_authors = "Autores", authors_initiale = "Autores-%1", authors_birthyear = 'Nacido en el año %1', authors_deathyear = 'Muerte en %1', authors_birth_century = "Nacido en el año %1..", authors_death_century = "Muerte en %1..", list_limit_levelmaxi = "Limite de la estructura levelmaxi=%1", list_limit_maxn = "Limite de la estructura maxn=%1", limit_cat_birth_death = 'Limite los años de las categorías "Nacimientos en" y "Muerte en".', cat_epoch_china_antiquity = "Autor de la antigüedad china", cat_epoch_china_springs = "Autor de Primaveras y Otoños", cat_epoch_china_empires = "Autor de los Imperios chinos", cat_epoch_indian_indus = "Autor de la civilización del Indo", cat_epoch_indian_antiquity = "Autor de la antigüedad india", cat_epoch_indian_muslim = "Autor de el período indo-musulmán", cat_epoch_antiquity = "Autor de la antigüedad", cat_epoch_middle_age = "Autor de la Edad Media", cat_epoch_century_EC = "Nacido en el siglo del día 1%", cat_epoch_century_BEC = "Nacido en el siglo BEC día 1%", century_EC = "%1 siglo", century_BEC = "%1 siglo BEC", -- Los mensajes de error y categorías -- Estos mensajes deben incluir también los de módulo(s) llamado. err_one_number_argument = "Error: En el parámetro '''%1''', ingrese un número único entre -5000 y ahora.", err_assist_user_param = "Apoyo a los usuarios para comprobar los ajustes:", err_module_error = "Module error", -- err_vague_year = "Año incierto.", err_death_before_birth = "Error: muerte '''%1''' antes del nacimiento '''%2'''.", err_death_before_birth_cat = "Autor muerte antes del nacimiento.", err_life_too_long = "La vida es demasiado largo de %1 a %2.", err_life_too_long_cat = "Vida del autor es demasiado largo", err_module_miss_i18n_arg = "Error interno: el argumento %1 falta traducción i18n.", err_module_miss_i18n_cat = "Módulo faltante traducción i18n.", err_no_known_arguments = "Módulo sin argumentos tabla conocida.", err_vague_epoch = "Épocas inciertas.", err_unknown_epoch_cat = "Desconocido período", err_year_in_roman_number = "Ambigüedad: el año '''%1''' es en números romanos ¿Qué quieres definir un siglo?", err_notices_properties = "Error interno: Un registro de autoridad no está definido: %1.", err_notices_properties_cat = "Error interno: Uno o más registro de autoridad no está definido.", -- Estos mensajes se utilizan para módulo Cargs = ControlAgrs, y se copian aquí. c = 'c', debug = "debug", options = 'options', err_error_list_header = "Asistencia en los parámetros del modelo en:", err_unknown_argument = "Error: El parámetro '''%1''' es desconocido en este modelo. Compruebe el nombre o marca esta brecha.", err_nearest_argument = "Error: la '''%1''' argumento conocido es el que necesita?", err_value_re_defined = "Error: el valor del argumento '''%1''' ya se ha definido. Elige uno sólo argumento y valor.", err_need_value = "Error: Este argumento es necesario pero ausente : '''%1'''. Debe definir.", err_none_value = "Error: Ningún argumento ha sido definido.", err_too_unnamed_arguments = "Error: Demasiados argumentos sin nombre ( '''%1''' ).", err_internal_notice_wsid = "Error interno: Notificar al promotor que el argumento interno '''%1''' es desconocida en los registros.", err_without_translation = "<br/>Conocido argumento, pero no traducido: '''%1'''.", err_without_translation_N = "<br/>Hay %1 argumentos sin traducir.", err_is_defined = "<br/>El argumento %1:'''%2''' está definido.", err_is_undefined = "<br/>El argumento %1:'''%2''' no está definido.", err_module_with_error = "Módulo con error", err_wikidata_wikibase = "Error: Wikibase no está disponible.", err_wikidata_getEntity = "Error: getEntity Wikidata no está disponible.", err_wikidata_getElement = "Error: Elemento Wikidata '''%1''' no se encuentra.", err_wikidata_property = "Error: Propiedad Wikidata '''%1''' no se encuentra.", err_wikidata_error = "Error Wikidata: %1", err_wikidata_cat = "Error Wikidata", err_notice_link = "Error: mala nota por '''%1'''.", err_notice_link_cat = "Módulo con mala nota", list_limit_levelmaxi = "Límite de la lista levelmaxi=%1", list_limit_max_n = "Límite de la lista max_n=%1", err_module_miss_i18n_arg = "Error interno: el argumento '''%1''' falta en traducción i18n.", err_module_miss_i18n_res = "Error interno: Hay '''1%''' lagunas en '''%2''' traducciones.", err_module_miss_i18n_cat = "Módulo faltante traducción i18n", err_module_i18n_miss_trans = "Error interno: Tabla i18n tiene sólo '''1%''' traducciones.", err_no_args_known = "Error: Módulo sin tabla argumentos conocidos.", err_no_args_source = "Error: Módulo sin tabla argumentos fuentes.", err_no_args_lang = "Error: Módulo sin tabla argumentos trajo.", err_lang_table = "Error: La lengua '''%1''' o su tabla es incorrecta.", err_lang_table_cat = "Error: Idioma argumentos erróneos", err_lang_not_exist = "Error: La lengua '''%1''' no se una lengua en los wikipedias.", } -- p.i18n_Auteur.es p.i18n_Auteur.fr = { -- Traductions en francais des arguments, catégories et messages : -- to debug for arg 1, arg 2 : mode = 'mode', lastname = 'nom', initiale = 'initiale', familyname = 'nomfamille', firstname = 'prénom', pseudonym = 'pseudo', title = 'titre', galliname = 'prénomGalli', sex = 'sexe', sortkey = 'cle', image = 'image', birthyear = 'anneeNaissance', birth = 'naissance', birthcentury = 'siecleNaissance', birthuncertain = 'incertitudeNaissance', region = 'région', region_values = "autre/chine/inde/siècle", args_values_err = "Valeur anormale de l'argument '''%1 = %2''' (%3)", deathyear = 'anneeDeces', death = 'deces', deathcentury = 'siecleDeces', deathuncertain = 'incertitudeDeces', description = 'description', occupation = 'metier', genre = 'genre', language = 'langue', country = 'pays', prize = 'prix', rights = 'droits', rights_values = '70/50/mpf/non', rights_values_cat_70 = "Auteurs dans le domaine public aux États-Unis", rights_values_box_70 = "DP-EU-Auteur", rights_values_cat_50 = "Auteurs dans le domaine public au Canada", rights_values_box_50 = "-", rights_values_cat_mpf = "Auteurs morts pour la France", rights_values_box_mpf = "-", rights_values_cat_none = "-", rights_values_box_none = "-", wikipedia = 'wikipedia', wikiquote = 'wikiquote', commons = 'commons', commonscat = 'commonscat', namespace = 'espace', category = 'Category', catspace = 'catspace', -- oldargs par selon wikisource Modèle:Auteur/Documentation le 05/01/2014 birth_text = 'texteNaissance', death_text = 'texteDeces', birth_type = 'typeNaissance', death_type = 'typeDeces', birth_link = 'lienNaissance', death_link = 'lienDeces', birth_link2 = 'liaisonNaissance', death_link2 = 'liaisonDeces', -- Scans et Notices author_scans_text = 'Scans et notices', author_Notices = 'Notices', -- search BNF ARC = 'ARC', ARCgeo = 'ARCgeo', ARCid = 'ARCid', ARCitem = 'ARCitem', ARCorg = 'ARCorg', ARCsub = 'ARCsub', ARCHIVE = 'ARCHIVE', BNF = 'BNF', BNFbook = 'BNFbook', DNB = 'DNB', GKD = 'GKD', GKD_V1 = 'GKD_V1', GND = 'GND', IA = 'IA', IBL = 'IBL', IBLid = 'IBLid', IBLbook = 'IBLbook', IMDb = 'IMDb', ISBN = 'ISBN', ISFDB = 'ISFDB', ISFDBid = 'ISFDBid', ISFDBpub = 'ISFDBpub', ISNI = 'ISNI', LCCN = 'LCCN', LCCNid = 'LCCNid', LT = 'LT', NDL = 'NDL', NKC = 'NKC', NLA = 'NLA', OCLC = 'OCLC', OL = 'OL', OLbook = 'OLbook', PND = 'PND', SELIBR = 'SELIBR', SUDOC = 'SUDOC', SWD = 'SWD', ULAN = 'ULAN', VIAF = 'VIAF', WORLDCAT = 'WORLDCAT', WORLDCATbook = 'WORLDCATbook', WORLDCATch = 'WORLDCATch', WORLDCATid = 'WORLDCATid', -- Catégories et Messages divers -- Ces messages doivent aussi intégrer ceux du (ou des) module(s) appelé(s). -- erreur_voulue = 'FR erreur voulue', authors_authors = "Auteurs", authors_initiale = "Auteurs-%1", authors_birthyear = 'Naissance en %1', authors_deathyear = 'Décès en %1', authors_birth_century = "Naissance en %1..", authors_death_century = "Décès en %1..", list_limit_levelmaxi = "Limite de la structure levelmaxi=%1", list_limit_maxn = "Limite de la structure maxn=%1", limit_cat_birth_death = 'Limite les années des catégories "Naissance en" et "Décès en".', cat_epoch_china_antiquity = "Auteurs de l'antiquité chinoise", cat_epoch_china_springs = "Auteurs des Printemps et Automnes", cat_epoch_china_empires = "Auteurs des Empires chinois", cat_epoch_indian_indus = "Auteurs de la civilisation de l'Indus", cat_epoch_indian_antiquity = "Auteurs de l'antiquité indienne", cat_epoch_indian_muslim = "Auteurs de la période indo-musulmane", cat_epoch_antiquity = "Auteurs de l’Antiquité", cat_epoch_middle_age = "Auteurs du Moyen Âge", cat_epoch_century_EC = "Auteurs du %1e siècle", cat_epoch_century_BEC = "Auteurs du %1e siècle BEC", century_EC = "%1 ème siècle", century_BEC = "%1 ème siècle BEC", -- Messages d'erreurs et catégories -- Ces messages doivent aussi intégrer ceux du (ou des) module(s) appelé(s). err_one_number_argument = "Erreur : Dans le paramètre '''%1''', entrer un seul nombre entre -5000 et maintenant.", err_assist_user_param = "Assistance à l'utilisateur pour la vérification des paramètres :", err_module_error = "Module avec erreur", -- err_vague_year = "Année incertaine.", err_death_before_birth = "Erreur : le décès '''%1''' est avant la naissance '''%2'''.", err_death_before_birth_cat = "Erreur : le décès est avant la naissance.", err_life_too_long = "Durée de vie trop longue de %1 à %2.", err_life_too_long_cat = "Durée de vie de l'auteur trop longue", err_module_miss_i18n_arg = "Erreur interne: l'argument %1 manque de traduction i18n.", err_module_miss_i18n_cat = "Module manquant de traduction i18n.", err_no_known_arguments = "Module sans table d'arguments connus.", err_vague_epoch = "Époque incertaine.", err_unknown_epoch_cat = "Époque inconnue", err_year_in_roman_number = "Ambigüité : l'année '''%1''' est en nombres romains. Voulez-vous définir un siècle ?", err_notices_properties = "Erreur interne: Une notice d'autorité n'est pas définie : %1.", err_notices_properties_cat = "Erreur interne: Une ou plusieurs notice(s) d'autorité(s) n'est pas définie.", -- Ces messages servent au module CA = ControlAgrs, et sont copiés ici. c = 'c', debug = "debug", options = 'options', err_error_list_header = "Assistance sur les paramètres de ce modèle :", err_unknown_argument = "Erreur : Le paramètre '''%1''' est inconnu dans ce modèle. Vérifier ce nom ou signaler ce manque.", err_nearest_argument = "Erreur: L'argument connu '''%1''' est-il celui que vous voulez ?", err_value_re_defined = "Erreur : La valeur de l'argument '''%1''' est déjà définie. Choisir un seul argument et une seule valeur.", err_need_value = "Erreur : Cet argument est nécessaire mais absent : '''%1'''. Il faut le définir.", err_none_value = "Erreur : Aucun argument n'a été défini.", err_too_unnamed_arguments = "Erreur : Trop de paramètres non nommés ( '''%1''' ).", err_internal_notice_wsid = "Erreur interne : Signalez au developpeur que l'argument interne '''%1''' est inconnu dans les notices.", err_without_translation = "<br/>Argument connu, mais non traduit : '''%1'''.", err_without_translation_N = "<br/>Il y a %1 arguments non traduits.", err_is_defined = "<br/>L'argument %1:'''%2''' est défini.", err_is_undefined = "<br/>L'argument %1:'''%2''' n'est pas défini.", err_module_with_error = "Module avec erreur", err_wikidata_wikibase = "Erreur : Wikibase n'est pas disponible.", err_wikidata_getEntity = "Erreur : getEntity Wikidata n'est pas disponible.", err_wikidata_getElement = "Erreur : L'élément '''%1''' de Wikidata n'est pas trouvé.", err_wikidata_property = "Erreur : La propriété '''%1''' de Wikidata n'est pas trouvé.", err_wikidata_error = "Erreur Wikidata: %1", err_wikidata_cat = "Erreur Wikidata", err_notice_link = "Erreur : mauvaise notice pour '''%1'''.", err_notice_link_cat = "Module avec mauvaise notice", list_limit_levelmaxi = "Limite de liste levelmaxi=%1", list_limit_max_n = "Limite de liste max_n=%1", err_module_miss_i18n_arg = "Erreur interne : l'argument '''%1''' manque de traduction i18n.", err_module_miss_i18n_res = "Erreur interne : Il y a '''%1''' manques parmi '''%2''' traductions.", err_module_miss_i18n_cat = "Module manquant de traduction i18n", err_module_i18n_miss_trans = "Erreur interne : La table i18n n'a que '''%1''' traductions.", err_no_args_known = "Erreur : Module sans table d'arguments connus.", err_no_args_source = "Erreur : Module sans table d'arguments sources.", err_no_args_lang = "Erreur : Module sans table d'arguments traduits.", err_lang_table = "Erreur : La langue '''%1''' ou sa table est erronée.", err_lang_table_cat = "Erreur : Langue d'arguments erronée", err_lang_not_exist = "Erreur : La langue '''%1''' n'est pas une des langues des wikipedias.", } -- p.i18n_Auteur.fr ------------------------------------------------------------ -- i18n end ------------------------------------------------------------ ------------------------------------------------------------ -- MArgms object table start ------------------------------------------------------------ -- Special arguments to modify the fonctions and outputs of this module. -- Argumentos spéciaux vierta modificadoras le fonctionnement et les salidas de módulo ce. -- Arguments spéciaux pour modifier le fonctionnement et les sorties de ce module. p.args_known_auteur = { [1] = {val = "normal", typ = "syn", need = "0", found = "0", list = 1, keyword = "mode", found = "0"}, mode = {val = "normal", typ = "prg", need = "0", found = "0", list = 1, keyword = "mode"}, c = {val = nil, typ = "opt", need = "0", found = "0", list = 1, keyword = "c", }, debug = {val = nil, typ = "opt", need = "0", found = "0", list = 1, keyword = "debug", }, options = {val = nil, typ = "opt", need = "0", found = "0", list = 1, keyword = "options", }, -- All arguments have a keyword parameter identical to the registration name, except synonyms. -- Todos los argumentos tienen un parámetro keyword idéntica a la denominación registrada, a menos sinónimos. -- Tous les arguments ont un paramètre keyword identique au nom d'enregistrement, sauf les synonymes. lastname = {val = nil, typ = "dat", need = "1", found = "0", list = 2, keyword = "lastname", }, initiale = {val = nil, typ = "dat", need = "1", found = "0", list = 2, keyword = "initiale", }, familyname = {val = nil, typ = "dat", need = "0", found = "0", list = 9, keyword = "familyname", }, firstname = {val = nil, typ = "dat", need = "0", found = "0", list = 2, keyword = "firstname", }, pseudonym = {val = nil, typ = "ctr", need = "0", found = "0", list = 9, keyword = "pseudonym", }, title = {val = nil, typ = "dat", need = "0", found = "0", list = 9, keyword = "title", }, galliname = {val = nil, typ = "dat", need = "0", found = "0", list = 9, keyword = "galliname", }, sex = {val = nil, typ = "dat", need = "0", found = "0", list = 9, keyword = "sex", }, sortkey = {val = nil, typ = "dat", need = "0", found = "0", list = 9, keyword = "sortkey", }, image = {val = nil, typ = "dat", need = "0", found = "0", list = 2, keyword = "image", prop = "18", }, birthyear = {val = nil, typ = "dat", need = "0", found = "0", list = 2, keyword = "birthyear", prop = "569", format = "year"}, birth = {val = nil, typ = "syn", need = "0", found = "0", list = 1, keyword = "birthyear", prop = "569"}, birthcentury = {val = nil, typ = "dat", need = "0", found = "0", list = 2, keyword = "birthcentury", }, birthuncertain ={val = nil, typ = "dat", need = "0", found = "0", list = 3, keyword = "birthuncertain", }, region = {val = nil, typ = "dat", need = "0", found = "0", list = 2, keyword = "region", arg_values = "region_values", key_values = "other/china/india/century" }, deathyear = {val = nil, typ = "dat", need = "0", found = "0", list = 2, keyword = "deathyear", prop = "570", format = "year"}, death = {val = nil, typ = "syn", need = "0", found = "0", list = 1, keyword = "deathyear", prop = "570"}, deathcentury = {val = nil, typ = "dat", need = "0", found = "0", list = 2, keyword = "deathcentury", }, deathuncertain ={val = nil, typ = "dat", need = "0", found = "0", list = 3, keyword = "deathuncertain", }, description = {val = nil, typ = "dat", need = "0", found = "0", list = 1, keyword = "description", }, occupation = {val = nil, typ = "dat", need = "0", found = "0", list = 3, keyword = "occupation", }, genre = {val = nil, typ = "dat", need = "0", found = "0", list = 3, keyword = "genre", }, language = {val = nil, typ = "dat", need = "0", found = "0", list = 3, keyword = "language", }, country = {val = nil, typ = "dat", need = "0", found = "0", list = 3, keyword = "country", prop = "27", }, prize = {val = nil, typ = "dat", need = "0", found = "0", list = 4, keyword = "prize", }, rights = {val = nil, typ = "dat", need = "0", found = "0", list = 1, keyword = "rights", arg_values = "region_values", key_values = "70/50/mpf/none" }, wikipedia = {val = nil, typ = "dat", need = "0", found = "0", list = 2, keyword = "wikipedia", }, wikiquote = {val = nil, typ = "dat", need = "0", found = "0", list = 2, keyword = "wikiquote", }, commons = {val = nil, typ = "ctr", need = "0", found = "0", list = 2, keyword = "commons", }, commonscat = {val = nil, typ = "ctr", need = "0", found = "0", list = 3, keyword = "commonscat", }, namespace = {val = nil, typ = "ctr", need = "0", found = "0", list = 4, keyword = "namespace", }, category = {val = nil, typ = "ctr", need = "0", found = "0", list = 3, keyword = "category", }, -- Obsolete old arguments from wikisource Modèle:Auteur/Documentation le 05/01/2014 -- obsoleto viejos argumentos de wikisource Modèle:Auteur/Documentation le 05/01/2014 -- Obsolète anciens arguments selon wikisource Modèle:Auteur/Documentation le 05/01/2014 birth_text = {val = nil, typ = "oldargs", need = "0", found = "0", list = 9, keyword = "birth_text", }, death_text = {val = nil, typ = "oldargs", need = "0", found = "0", list = 9, keyword = "death_text", }, birth_type = {val = nil, typ = "oldargs", need = "0", found = "0", list = 9, keyword = "birth_type", }, death_type = {val = nil, typ = "oldargs", need = "0", found = "0", list = 9, keyword = "death_type", }, birth_link = {val = nil, typ = "oldargs", need = "0", found = "0", list = 9, keyword = "birth_link", }, death_link = {val = nil, typ = "oldargs", need = "0", found = "0", list = 9, keyword = "death_link", }, birth_link2 = {val = nil, typ = "oldargs", need = "0", found = "0", list = 9, keyword = "birth_link2", }, death_link2 = {val = nil, typ = "oldargs", need = "0", found = "0", list = 9, keyword = "death_link2", }, -- arguments managed only by program, not read from template -- p.arg_memorize("catspace", frame:preprocess("{{ns:Category}}")) -- memorize the localized namespace "Category" catspace = {val = nil, typ = "prg", need = "0", found = "0", list = 9, keyword = "catspace", }, limit_cat_birth_death = {val = "100", typ = "prg", need = "0", found = "0", list = 9, keyword = "catspace", }, ------------------------------------------------------------ -- Table de notices de notoriétés pour auteurs livres et autres ------------------------------------------------------------ -- The arguments for authority records are treated separately -- Les arguments pour les notices d'autorités sont traités à part ARC = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ARC", base_base = "ARC", base_id = "ARC", not_type = "Author", base_test = "1234", base_name = "National Archives and Records Administration", not_link = "http://arcweb.archives.gov/arc/action/ExternalPersonIdSearch?id=REF_1", }, ARCgeo = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ARC", base_base = "ARC", base_id = "ARCgeo", not_type = "Geo", base_test = "1234", base_name = "National Archives and Records Administration", not_link = "http://arcweb.archives.gov/arc/action/ExecuteRelatedGeographicalSearch?id=REF_1", }, ARCid = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ARCid", base_base = "ARC", base_id = "ARCid", not_type = "Author", base_test = "R457-J-44", -- ARCid = "R457-J-44" base_name = "National Archives and Records Administration", not_link = "http://arcweb.archives.gov/arc/action/ExternalPersonIdSearch?id=REF_1", }, ARCitem = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ARCitem", base_base = "ARC", base_id = "ARCitem", not_type = "Book", base_test = "1234", base_name = "National Archives and Records Administration", not_link = "http://arcweb.archives.gov/arc/action/ExternalIdSearch?id=REF_1", }, ARCorg = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ARCorg", base_base = "ARC", base_id = "ARCorg", not_type = "Org", base_test = "1234", base_name = "National Archives and Records Administration", not_link = "http://arcweb.archives.gov/arc/action/ExecuteRelatedOrganizationSearch?id=REF_1", }, -->|BNF=http://catalogue.bnf.fr/ark:/12148/{{{code|{{{2|}}} }}}<!-- -->|DNB=http://d-nb.info/gnd/{{{code|{{{2|}}} }}}<!-- ARCsub = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ARCsub", base_base = "ARC", base_id = "ARCsub", not_type = "Subject", base_test = "1234", base_name = "National Archives and Records Administration", not_link = "http://arcweb.archives.gov/arc/action/ExecuteRelatedTopicalSubjectsSearch?id=REF_1", }, ARCHIVE = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ARCHIVE", base_base = "ARC", base_id = "ARCHIVE", not_type = "Author", base_test = "1234", base_name = "National Archives and Records Administration", not_link = "http://www.archive.org/details/REF_1", }, BNF = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "BNF", prop = "268", base_base = "BNF", base_id = "BNF", not_type = "Author", base_test = "119067514", -- BNF = 11888266 = Alain Fournier base_name = "Bibliothèque nationale de France", not_link = "http://catalogue.bnf.fr/ark:/12148/cbREF_1", }, DNB = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "DNB", base_base = "DNB", base_id = "DNB", not_type = "Author", base_test = "3684200072", -- , DNB = "3684200072" base_name = "Bibliothèque nationale allemande", -- Deutsche National Bibliothek not_link = "http://d-nb.info/gnd/REF_1", }, GKD = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "GKD", base_base = "GKD", base_id = "GKD", not_type = "Author", base_test = "71yhjey852", -- , GKD = "71yhjey852" base_name = "Bibliothèque nationale allemande", not_link = "http://d-nb.info/gnd/REF_1", }, GKD_V1 = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "GKD_V1", base_base = "GKD", base_id = "GKD-V1", not_type = "Author", base_test = "71yhjey852", base_name = "Bibliothèque nationale allemande", not_link = "http://d-nb.info/gnd/REF_1", }, GND = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "GND", prop = "227", }, IA = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "IA", base_base = "IA", base_id = "IA", not_type = "Author", base_test = "1234", base_name = "Internet Archive", not_link = "http://www.archive.org/REF_1", }, IBL = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "IBL", base_base = "IBL", base_id = "IBL", not_type = "Author", base_test = "1234", base_name = "Internet Book List", -- Pas de page fr, en redirige vers Base de données bibliographiques not_link = "http://www.iblist.com/authorREF_1.html", }, IBLbook = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "IBLbook", base_base = "IBL", base_id = "IBLbook", not_type = "Book", base_test = "1234", base_name = "Internet Book List", -- Pas de page fr, en redirige vers Base de données bibliographiques not_link = "http://www.iblist.com/bookREF_1.html", }, IBLid = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "IBLid", base_base = "IBL", base_id = "IBLid", not_type = "Author", base_test = "37581257954", -- , IBLid = "37581257954" base_name = "Internet Book List", -- Pas de page fr, en redirige vers Base de données bibliographiques not_link = "http://www.iblist.com/authorREF_1.html", }, IMDb = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "IMDb", base_base = "IMDb", base_id = "IMDb", not_type = "Author", base_test = "0002776", -- Johnny Hallyday base_name = "Internet Movie Data base", not_link = "http://www.imdb.com/name/nmREF_1/", }, ISBN = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ISBN", base_base = "ISBN", base_id = "ISBN", not_type = "Book", base_test = "2-7073-0549-9", -- L'apartheid, de Nelson Mandela base_name = "International Standard Book Number", }, ISFDB = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ISFDB", base_base = "ISFDB", base_id = "ISFDB", not_type = "Author", base_test = "1234", base_name = "Internet Speculative Fiction Database", not_link = "http://www.isfdb.org/cgi-bin/ea.cgi?REF_1", }, ISFDBid = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ISFDBid", base_base = "ISFDB", base_id = "ISFDBid", not_type = "Author", base_test = "1234", base_name = "Internet Speculative Fiction Database", not_link = "http://www.isfdb.org/cgi-bin/ea.cgi?REF_1", }, ISFDBpub = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ISFDBpub", base_base = "ISFDB", base_id = "ISFDBpub", not_type = "Book", base_test = "1234", base_name = "Internet Speculative Fiction Database", not_link = "http://www.isfdb.org/cgi-bin/pl.cgi?REF_1", }, ISFDBtitle = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ISFDBtitle", base_base = "ISFDB", base_id = "ISFDBtitle", not_type = "Book", base_test = "1234", base_name = "Internet Speculative Fiction Database", not_link = "http://www.isfdb.org/cgi-bin/title.cgi?REF_1", }, ISNI = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ISNI", prop = "213", base_base = "ISNI", base_id = "ISNI", not_type = "Author", base_test = "1234", base_name = "International Standard Name Identifier", not_link = "http://isni.oclc.nl/DB=1.2/SET=10/TTL=1/CMD?ACT=SRCHA&IKT=8006&SRT=&TRM=REF_1", }, LCCN = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "LCCN", prop = "244", base_base = "LCCN", base_id = "LCCN", not_type = "Author", base_test = "n82212654", -- LCCN = n82212654 = Johnny Hallyday base_name = "Numéro de contrôle de la Bibliothèque du Congrès", not_link = "http://id.loc.gov/authorities/names/REF_1" }, --[[ LCCNid = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "LCCNid", prop = "244", base_base = "LCCN", base_id = "LCCNid", not_type = "Author", base_test = "n/50/23101", -- LCCN = n/50/23101 = Alain Fournier base_name = "Numéro de contrôle de la Bibliothèque du Congrès", not_link = "http://id.loc.gov/authorities/names/REF_1REF_2REF_3" }, -->|LCCN=http://id.loc.gov/authorities/names/{{ParmPart|1|{{{code|{{{2|}}} }}} }}{{ParmPart|2|{{{code|{{{2|}}} }}} }}{{padleft:{{ParmPart|3|{{{code|{{{2|}}} }}} }}|6|0}}.html<!-- -->|LCCNid=http://id.loc.gov/authorities/names/{{ParmPart|1|{{{code|{{{2|}}} }}} }}{{ParmPart|2|{{{code|{{{2|}}} }}} }}{{padleft:{{ParmPart|3|{{{code|{{{2|}}} }}} }}|6|0}}.html<!-- -->|LCCNbook=http://lccn.loc.gov/{{{code|{{{2|}}} }}}<!-- --]] LT = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "LT", base_base = "LT", base_id = "LT", not_type = "Author", -- prop = ? base_test = "1234", base_name = "Library Thing", not_link = "http://www.librarything.com/work/REF_1" }, NDL = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "NDL", prop = "349", }, NKC = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "NKC", prop = "691", }, NLA = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "NLA", base_base = "NLA", base_id = "NLA", not_type = "Author", base_test = "35096649", -- NLA = 35096649 = Alain Fournier base_name = "Online Computer Library Center", not_link ="http://www.worldcat.org/oclc/REF_1", }, OCLC = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "OCLC", base_base = "OCLC", base_id = "OCLC", not_type = "Author", base_test = "1234", base_name = "Online Computer Library Center", not_link ="http://www.worldcat.org/oclc/REF_1", }, OL = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "OL", base_base = "OL", base_id = "OL", not_type = "Author", base_test = "1234", base_name = "Open Library", not_link ="http://www.worldcat.org/oclc/REF_1", }, OLbook = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "OLbook", base_base = "OL", base_id = "OLbook", not_type = "Book", base_test = "2707305499", -- L'apartheid, de Nelson Mandela base_name = "Open Library", not_link ="http://openlibrary.org/search?wtitle=&wauthor=&wtopic=&wisbn=REF_1&wpublisher=&wdescription=&ftokens=&_save=Chercher", }, PND = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "PND", base_base = "PND", base_id = "PND", not_type = "Author", base_test = "11850133X", -- PND = 11850133X = Alain Fournier base_name = "Personennamendatei", not_link ="http://d-nb.info/gnd/REF_1", }, SELIBR = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "SELIBR", base_base = "SELIBR", base_id = "SELIBR", not_type = "Author", base_test = "1234", base_name = "Bibliothèque royale (Suède)", -- "National Library of Sweden" "Personennamendatei", not_link ="http://libris.kb.se/auth/REF_1", }, SUDOC = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "SUDOC", base_base = "SUDOC", base_id = "SUDOC", not_type = "Author", base_test = "1234", base_name = "Système universitaire de documentation", not_link ="http://www.idref.fr/REF_1", }, SWD = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "SWD", base_base = "SWD", base_id = "SWD", not_type = "Author", base_test = "1234", -- debug text : de : Subject Headings Authority File, base allemande nom anglais base_name = "Schlagwortnormdatei", not_link ="http://d-nb.info/gnd/REF_1", }, ULAN = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ULAN", base_base = "ULAN", base_id = "ULAN", not_type = "Author", base_test = "1234", base_name = "Union List of Artist Names", not_link ="http://www.getty.edu/vow/ULANFullDisplay?find=&role=&nation=&subjectid=REF_1", }, VIAF = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "VIAF", prop = "214", base_base = "VIAF", base_id = "VIAF", not_type = "Author", base_test = "34452139", -- VIAF = 34452139 = Alain Fournier -- VIAF = 7396281 = Arthur Rimbaud base_name = "Fichier d'autorité international virtuel", not_link ="http://viaf.org/viaf/REF_1", }, WORLDCAT = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "WORLDCAT", base_base = "WORLDCAT", base_id = "WORLDCAT", not_type = "", base_test = "35096649", base_name = "WorldCat", -- = http://www.worldcat.org/identities/lccn-n50-23101 not_link ="http://www.worldcat.org/search?qt=worldcat_org_all&q=REF_1+REF_2", }, WORLDCATbook = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "WORLDCATbook", base_base = "WORLDCAT", base_id = "WORLDCATbook", not_type = "Book", base_test = "2707305499", -- L'apartheid, de Nelson Mandela base_name = "WorldCat", not_link ="http://worldcat.org/search?q=REF_1&qt=owc_search", }, WORLDCATch = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "WORLDCATch", base_base = "WORLDCAT",base_id = "WORLDCATch", not_type = "", base_test = "35096649", -- http://www.worldcat.org/search?q=Alain-Fournier&qt=owc_search base_name = "WorldCat", not_link ="http://www.worldcat.org/search?q=REF_2-REF_1&qt=owc_search", }, WORLDCATid = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "WORLDCATid", base_base = "WORLDCAT", base_id = "WORLDCATid", not_type = "Author", base_test = "lccn-n50-23101", -- = http://www.worldcat.org/identities/lccn-n50-23101 base_name = "WorldCat", not_link ="http://www.worldcat.org/identities/REF_1", }, } -- p.args_known_auteur ------------------------------------------------------------ -- Manage options. Administrar opciones. Gérer les options. ------------------------------------------------------------ -- MArgms local catView = "" -- = ":" to display a category to document it rather than truly categorize CA.trc = "<br/>* Modele:Auteur trace " --local CA.trackon = false --local CA.track = function(x) -- if CA.trackon then trc = trc .. tostring(x) end --end -- Options de maîtrise du fonctionnement de ce module CA.invoke_options = " " -- options normales venant du modèle, normal options from template -- options= en es fr params docavant doc-min docmax docdef doc-apres docligne -- local CA.debug_options = " " -- pas d'options de debug du module par edit CA.debug_options = " " -- " unitest debug erron params docavant no-box no-cat doc-min doc-max doc-notice doc-def docligne not-ices tra-ck " -- options de debug du module par edit ------------------------------------------------------------ -- Petites fonctions utilitaires. Miscellaneous functions ------------------------------------------------------------ local function isDef(x) -- x is defined. x est défini return (type(x) == "string") and (x ~= "") and (x ~= " ") and (x ~= "nil") end -- function isDef(x) function wordstotable(txt, opt) -- convertit un texte en table de mots local t = "" local tab = { } function inserer(ti) if ti ~= "" then table.insert(tab, ti.."") end -- table.insert(tab, t.."") end local xyz = string.gsub( txt, "(%S*%-*%S*)", inserer ) -- "(%w*%-*%'*%w*)", "(%S*%-*%S*)" for key, val in pairs(tab) do -- Pour tous les mots t = t .. " ( " .. tostring(key) .. " = " .. tostring(val) .. " ) " end t = "\n* wordstotable txt = " .. tostring(xyz) .. " " .. t return tab, t, opt end -- function p.wordstotable(txt, opt) ------------------------------------------------------------ -- Données de wikidata par mw.wikibase ------------------------------------------------------------ -- http://test2.wikipedia.org/w/index.php?title=Bertha_von_Suttner&action=edit -- {{authority control|TYP=p|GND=118620126|LCCN=n/50/66831|NDL=01229737|VIAF=95160848}} -- http://test2.wikipedia.org/wiki/Module:Wikibase -- mw.wikibase.getEntityObject() -- gets entity data of the Wikidata item connected with the current page. See the section Entity table and data structure for an example of the structure returned. -- mw.wikibase.label( id ) -- takes an item ID and returns the label in the language of the local wiki. -- mw.wikibase.sitelink( id ) -- takes an item ID and returns the title of the corresponding page on the local wiki. -- http://www.mediawiki.org/wiki/Extension:WikibaseClient/Lua -- p.entity = mw.wikibase.getEntityObject() -- p.father = mw.wikibase.label( "Q" .. entity.claims.p107[0].mainsnak.datavalue.value["numeric-id"]) -- p.id = "" -- father == "Lord Byron" -- http://www.wikidata.org/wiki/Wikidata:Project_chat#Getting_a_subset_of_claims_for_an_entity -- The props=claims API query retrieves ALL the claims stored for an entity. ------------------------------------------------------------ ------------------------------------------------------------ -- Manage and géenerate autority notices and scans -- Gérer et générer les notices d'autorité et les scans ------------------------------------------------------------ -- Notice book double : --srcset="//upload.wikimedia.org/wikipedia/commons/thumb/5/51/Nuvola_apps_bookcase_2.svg/33px-Nuvola_apps_bookcase_2.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/5/51/Nuvola_apps_bookcase_2.svg/44px-Nuvola_apps_bookcase_2.svg.png 2x" --src="//upload.wikimedia.org/wikipedia/commons/thumb/5/51/Nuvola_apps_bookcase_2.svg/22px-Nuvola_apps_bookcase_2.svg.png" -- {{Nota | BNF | {{{BNF | cb11888266r }}} | BNF | http://catalogue.bnf.fr/ark:/12148/{{{BNF|cb11888266r}}} | espace=Auteur }} function p.subst_string(input, find, replace) local L = string.len(find) local res = "" -- if (type(L) ~= "number") or (L == 0) then return "" end if L == 0 then return "" end local i = string.find(input, find) if i and (i > 0) then res = string.sub(input, 1, i-1) .. replace .. string.sub(input, i+L, -1) else return input end return res end -- function p.subst_string(input, find, replace) function p.split_by_char(input, split) if type(input) ~= "string" then return end if type(split) ~= "string" then return end local i, j, k, char, str, tbl = 0, 0, 0, "", "", {} local len = string.len(input) for i = 1, len do -- pour tous les caracteres de input char = string.sub(input, i, i) if char == split then -- a chaque coupure, stocker une partie en table k = k+1 table.insert(tbl, str) -- tostring(k).."-".. j = 0 str = "" else j = j+1 str = str .. char end end k = k+1 table.insert(tbl, str) -- tostring(k).."-".. return tbl end -- function p.split_by_char(input, split) function p.split_by_char_test() local t = "\n* Test '''split_by_char''' : " local test = { "debut", "un/deux", "1/23/4567", "abc//def", "/start/next/stop/", "fin", } local max = table.maxn(test) for N, str in ipairs( test) do tbl = p.split_by_char(str, "/") t = t .. CA.ta(str, table.concat(tbl, " , ")) end -- tostring(N).."*"..refN return t end -- function p.split_by_char_test() function p.str_subst(txt, find, repl) -- in txt, replace find by repl -- Replace string.gsub( because : -- Erreur Lua dans Module:Auteur invalid capture index, in wt = string.gsub(wt, "REF_1", tostring(v1) ) txt = tostring(txt) local i = string.find(txt, find) if i and (i > 1) then txt = string.sub(txt, 1, i-1) .. tostring(repl) .. string.sub(txt, i + string.len(find), -1) end return txt end -- function p.str_subst(txt, find, repl) function p.str_REF(wt_ref, v1, v2, v3) -- replace REF_1 to REF_3 by v1 to v3 in the translation of wt_ref, else in wt_ref wt_ref = tostring(wt_ref) local wt = "" if p.wiki_args and p.wiki_args[wt_ref] then wt = p.wiki_args[wt_ref] -- Utiliser wt_ref comme la reference d'un texte à traduire. else wt = wt_ref end -- Avant init de p.wiki_args utiliser wt_ref comme le texte lui-même if type(wt) ~= "string" then wt = wt_ref end -- Sinon utiliser wt_ref comme le texte lui-même. if v1 then wt = p.str_subst(wt, "REF_1", tostring(v1) ) end if v2 then wt = p.str_subst(wt, "REF_2", tostring(v2) ) end if v3 then wt = p.str_subst(wt, "REF_3", tostring(v3) ) end return wt end -- function p.str_REF(wt_ref, v1, v2, v3) function p.HTMLnotice(ref, noticeN) -- Générer le wikitexte d'une notice -- exemple : notice("cb11888266r", noticeN) -- ARCitem = {base_base = "ARC", base_id = "ARCitem", _space = "", base_test = "1234", not_type = "Book", ... if type(noticeN) ~= "table" then return "" end local base_id = noticeN.base_id local base_link = noticeN.not_link if type(base_id) ~= "string" then return "" end if type(noticeN.not_link) ~= "string" then return "" end if type(ref) ~= "string" or ref == "" then return "" end -- relire : declarer une erreur err_notice_missing_ref -- ne garder que le première reference si references multiples (voir Johnny Hallyday) -- Keep only the fisrt reference in case of multiple references (see Johnny Hallyday) local i = string.find( ref, ",") if i and (i > 1) then ref = string.sub(ref, 1, i-1) end local ref_link = mw.uri.encode(ref, "PATH") -- espace = space = %20 local autority_alt_text = base_id .. " : " .. ref local wikipedia_name = noticeN.base_name local wikipedia_name_link = mw.uri.encode(wikipedia_name, "PATH") -- espace == %20 local wikipedia_base_link = 'http://fr.wikipedia.org/wiki/' .. wikipedia_name_link local authority_icon_link = noticeN.not_link -- REF_1 = reference en un seul identifiant comme "cb11888266r" -- REF_1/REF_2 = reference en 2 parties comme "...worldcat_org_all&q=REF_1+REF_2" -- REF_1/REF_2/REF_3 = reference en 3 parties comme "http://id.loc.gov/.../REF_1REF_2REF_3" local v = mw.text.split(ref_link, "/", true) -- nobug -- LCCNid : allonger à 6 chiffres, avec des 0 à gauche, la partie 3 de "n/50/23101", soit 023101. -- v[3] = string.sub( "000001234" .. tostring(v[3]), -8, -1 ) -- -6, -1 ) local authority_icon_link = p.str_REF(authority_icon_link, v[1], v[2], v[3]) -- local img = 'Farm-Fresh draw calligraphic.png' if noticeN.not_type == "Book" then img = 'Nuvola_apps_bookcase_2.svg' end -- exemple : wt = '<span style="margin-left:10px;" > * [' .. wikipedia_base_link .. ' ' .. base_id .. '] : [[File:' .. img .. '|22px|link=' .. authority_icon_link .. '|' .. autority_alt_text .. ']]</span>' -- <form> non - <ins> calé à gauche - use the <object> tag to embed another webpage into your HTML document. -- <wbr> (Word Break Opportunity) -- text-wrap: normal|none|unrestricted|suppress; local wt = '<span style="text-wrap:none;" ><span style="margin-left:10px;" >*</span><span style="margin-left:10px;" >[' .. wikipedia_base_link .. ' ' .. base_id .. ']</span><span style="margin-left:10px;" >[[File:' .. img .. '|22px|link=' .. authority_icon_link .. '|' .. autority_alt_text .. ']]</span> </span>' -- :</span> return wt end -- function p.HTMLnotice(ref, noticeN) --[[ example of autority notice definition BNF = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "BNF", prop = "268", base_base = "BNF", base_id = "BNF", not_type = "Author", base_test = "119067514", -- BNF = 11888266 = Alain Fournier base_name = "Bibliothèque nationale de France", not_link = "http://catalogue.bnf.fr/ark:/12148/REF_1", }, ISBN = {val = nil, typ = "not", need = "0", found = "0", list = 3, keyword = "ISBN", base_base = "ISBN", base_id = "ISBN", not_type = "Book", base_test = "2-7073-0549-9", -- L'apartheid, de Nelson Mandela base_name = "International Standard Book Number", }, ]] -- Générer des notices d'autorités indépendantes sur une personne, un livre ou autre. function p.gener_notices(args_known, args_final) -- Generate notices ARCid DNB GKD IBLid ... if args_known == nil then args_known = CA.args_known end if args_final == nil then args_final = CA.args_final end if wiki_args == nil then wiki_args = CA.wiki_args end local wt = "" for key, ref in pairs(args_final) do -- Pour tous les paramètres connus key = tostring(key) if args_known[key] and (args_known[key]["typ"] == "not") then wt = wt .. p.HTMLnotice(ref, args_known[key]) end end return wt end -- function p.gener_notices(args_known, args_final) -- Tester toutes les notices d'autorités indépendantes sur une personne, un livre ou autre. -- Generate all know notices ARCid DNB GKD IBLid ... function p.HTMLnotice_test( res, args_known) if args_known == nil then args_known = CA.args_known end res = res or "\n\n* Test all know authority notices : " local i, ntc = 1, "" for key, noticeN in pairs(args_known) do -- Pour toutes les notices connus res = res .. p.HTMLnotice(noticeN.base_test, noticeN) end return res end -- function p.HTMLnotice_test( res, args_known) function p.toUTF8(t) -- convertir un simple texte en UTF8 pour URL -- base_name = "Bibliothèque d'autorité (Suède)" -- wikipedia_name = "Biblioth%%C3%%A8que%%20d%%27autorit%%C3%%A9%%20%%28Su%%C3%%A8de%%29" -- The default type, "QUERY", encodes spaces using '+' for use in query strings; "PATH" encodes spaces as %20; and "WIKI" encodes spaces as '_'. -- if type(t) ~= "string" then return "" end --t = mw.uri.encode( t, "QUERY" ) t = string.gsub(t, "%s", "%%20") -- espace == %20 t = string.gsub(t, "'", "%%27") -- , == %27 t = string.gsub(t, ",", "%%2C") -- , == %2C t = string.gsub(t, ":", "%%3A") -- : = %3A t = string.gsub(t, "%(", "%%%%28") t = string.gsub(t, "%)", "%%%%29") t = string.gsub(t, "é", "%%C3%%A9") t = string.gsub(t, "è", "%%C3%%A8") return t end function p.scanNames(wt, site, args_final) -- wt = scanNames("http://gallic ... &q=-ws-name-+-ws-firstname-", md_data) -- replace names for scans -- anti errors if type(args_final) ~= "table" then args_final = CA.args_final end -- optional arguments local lastname = args_final.lastname or "" local firstname = args_final.firstname or "" local galliname = args_final.galliname or "" -- if galliname == "" then galliname = firstname end -- wt = mw.uri.encode(wt, "WIKI" ) -- The default type, "QUERY", encodes spaces using '+' for use in query strings; "PATH" encodes spaces as %20; and "WIKI" encodes spaces as '_'. -- replace names for scans wt = tostring(wt) firstname = mw.uri.encode(firstname, "QUERY" ) wt = tostring(string.gsub(wt, "wsfirstname", firstname) ) -- "ws_firstname", firstname lastname = mw.uri.encode(lastname, "QUERY" ) wt = tostring(string.gsub(wt, "wslastname", lastname) ) galliname = mw.uri.encode(galliname, "QUERY" ) wt = tostring(string.gsub(wt, "wsfirstgall", galliname) ) -- wt = p.toUTF8(wt) -- wt = mw.uri.encode(wt, "QUERY" ) -- The default type, "QUERY", encodes spaces using '+' for use in query strings; "PATH" encodes spaces as %20; and "WIKI" encodes spaces as '_'. -- str2 = str.gsub(/\s/,'') wt = "\n*[" .. wt .. " " .. site .. "] - - " -- .. '<br/>[' .. wt return wt end -- function p.scanNames(wt, site, args_final) function p.HTMLscans(args_final) -- à faire : i18n['fr']author_scans_text = 'Scans fr : ', author_scans_text -- wt = scanNames("http://gallic ... &q=-ws-name-+-ws-firstname-") -- replace names for scans -- anti errors if type(args_final) ~= "table" then args_final = CA.args_final end -- optional arguments -- Generate scans to display local firstname, lastname, galliname = "x", "x", "x" local t = "" -- "HTMLscans " if type(args_final.firstname) == "string" -- then firstname = mw.uri.encode(args_final.firstname, "QUERY" ) then firstname = string.gsub(args_final.firstname, "%s", "+") else firstname = "" end if type(args_final.lastname) == "string" -- then lastname = mw.uri.encode(args_final.lastname, "QUERY" ) then lastname = string.gsub(args_final.lastname, "%s", "+") -- lastname = "Noël+Renée" else lastname = "" end if type(args_final.galliname) == "string" -- then galliname = mw.uri.encode(args_final.galliname, "QUERY" ) then galliname = string.gsub(args_final.galliname, "%s", "+") else galliname = "" end local scans = "" -- CA.ta("firstname", firstname) .. CA.ta("lastname", lastname) .. CA.ta("galliname", galliname) local SCAN_gallica = "http://gallica.bnf.fr/Search?ArianeWireIndex=index&p=1&lang=FR&q=" .. lastname .. "+" .. firstname t = t .. " <span> [" .. SCAN_gallica .. " Gallica] </span>" local SCAN_europeana = "http://www.europeana.eu/portal/search.html?query=who:" .. firstname .. ",+" .. lastname .. "&rows=12" t = t .. " <span> [" .. SCAN_europeana .. " Europeana] </span>" local SCAN_google = "https://www.google.fr/search?q=inauthor%3A%22" .. firstname .. "+" .. lastname .. "%22&ie=utf-8&oe=utf-8&aq=t" t = t .. " <span> [" .. SCAN_google .. " Google] </span>" local scan_notices = p.gener_notices(CA.args_known, CA.args_final) local start = CA.trans('author_scans_text') .. ' : ' CA.track( "CA.trans('author_scans_text')" .. start ) local scans = '<div class="vcard" style=" background-color:#F1F1DE; border:0px solid #CCCCCC; "><span>' .. start .. t .. " " .. scan_notices .. ' </span></div>' -- scans = scans .. p.HTMLnotice_test( "\n\n* Test de '''gener_notices''' : " ) return scans -- .. "\n\n* Test de '''gener_notices''' : " end -- function p.HTMLscans(args_final) ------------------------------------------------------------ -- Gérer les catégories. Manage categories. Administrar categorías. ------------------------------------------------------------ function p.gener_categories(argfinal) -- category_space = frame:preprocess("{{ns:Category}}") -- Category namespace from system, par init if type(argfinal) ~= "table" then argfinal = CA.argfinal end local catspace = CA.category_space local cats = CA.category_list local initiale = argfinal.initiale -- CA.argv("initiale") if not isDef(initiale) then initiale = "" end local sans = "" -- tostring(CA.argv("authors-category-no-initials") ) CA.track(" categories() initiale=" .. initiale .. " sans=" .. sans .. " catView=" .. CA.catView) local cat_initiale = "" if isDef(initiale) then cat_initiale = CA.str_vars("authors_initiale", initiale) cat_initiale = CA.catGen(cat_initiale, cat_initiale) end local commonscat = argfinal.commonscat if nil ~= commonscat then CA.catGen(catspace, "Commons category") end CA.catGroup("%1", argfinal.genre) -- |genre=Romanciers/Poètes/Auteurs de théatre CA.catGroup("%1", argfinal.language) -- |langue=français/japonais CA.catGroup("%1", argfinal.occupation) -- |metier=Académiciens/Personnalités politiques CA.catGroup("Auteurs %1", argfinal.country) -- |pays=français/italiens/chinois CA.catGroup("%1", argfinal.prize) -- |prix=Nobel de littérature/Pulitzer/Renaudot CA.track(" occupation=" .. tostring(argfinal.occupation) ) return table.concat(cats) end -- function p.gener_categories(argfinal) ------------------------------------------------------------ -- Gérer et générer les droits d'auteurs, annotations, microformat, defaultsort ------------------------------------------------------------ function p.author_rights(args_final) -- wkt, ee = p.author_rights(args_final) if type(args_final) ~= "table" then args_final = CA.args_final end local rights = args_final.rights local birthyear = tonumber(args_final.birthyear) local deathyear = tonumber(args_final.deathyear) local tst = "" local wkt = "" local cat = nil local err = "" local box = nil -- -- Compute the rights type for this author if rights == "mpf" then -- 'Auteur Mort pour la France' if deathyear then if p.nowyear <= deathyear + 95 then cat = "rights_values_cat_mpf" -- Catégorie:Auteurs morts pour la France box = "rights_values_box_mpf" -- Modèle:Auteurs morts pour la France end end elseif rights == "50" then -- standard 70 year rights along the time if deathyear then if p.nowyear <= deathyear + 50 then cat = "rights_values_cat_50" -- Catégorie:Auteurs dans le domaine public au Canada box = "rights_values_box_50" -- Modèle:DP-CN-Auteur end end elseif rights == "70" then -- Auteurs dans le domaine public aux États-Unis if deathyear then if p.nowyear <= deathyear + 70 then cat = "rights_values_cat_70" -- Catégorie:Auteurs dans le domaine public aux États-Unis box = "rights_values_box_70" -- Modèle:DP-EU-Auteur end end else -- aucune information sur les Droits d'auteur cat = nil box = nil end -- Générer sans erreur la catégorie et le modèle de droits d'auteur -- Generate without error the category and the template wkt = "" if cat and cat == "-" then cat = nil end if cat and not CA.option("nocat") then -- pour normal et pour test cat = CA.str_vars(cat) cat = CA.catGen(cat, cat, args_final.c) end if box and box == "-" then box = nil end if box and not CA.option("nobox") then -- pour normal et pour test -- Verifier si le modèle existe, pour éviter l'erreur de script -- Verify if the template exists, for no script error box = CA.str_vars(box) local template = mw.title.new( box, "template" ) if template.exists then wkt = wkt .. mw.getCurrentFrame():expandTemplate{ title = box } end end tst = "\n* author_rights " tst = tst .. CA.ta("birthyear", birthyear) .. CA.ta("deathyear", deathyear) tst = tst .. CA.ta("rights", rights) .. CA.ta("box", box) tst = tst .. CA.ta("options", options) tst = tst .. CA.ta("err", CA.error_color(err)) .. CA.tam("cat", cat) -- args_final.tst = tst args_final.wkt = wkt args_final.cats = args_final.cats or "" args_final.cats = args_final.cats .. (cat or "") args_final.errs = args_final.errs or "" args_final.errs = args_final.errs .. (err or "") return wkt, args_final end -- function p.author_rights(args_final) function p.author_rights_test( wkt, args_final) -- Unitary tests of p.author_rights -- res = res .. p.author_rights_test( "<br/><br/>\n* Test de '''author_rights''' : ", args_final) local args_final = mw.clone(args_final) wkt = wkt .. "<br>This list displays always the same variables." wkt = wkt .. "<br>Cette liste affiche toujours les mêmes variables." -- wkt = wkt .. "<br/>* Droits pour les morts pour la France" -- args_final = { c = ":", options = " nobox ", birthyear = 1888, deathyear = (p.nowyear - 96), rights = "mpf" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- args_final = { c = ":", options = " nobox ", birthyear = 1888, deathyear = (p.nowyear - 95), rights = "mpf" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- args_final = { c = ":", options = " nobox ", birthyear = 1888, deathyear = (p.nowyear - 94), rights = "mpf" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- wkt = wkt .. "<br/>* Droits français" -- args_final = { c = ":", options = " nobox ", deathyear = (p.nowyear - 72), rights = "70" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- args_final = { c = ":", options = " nobox ", birthyear = (p.nowyear - 99), deathyear = (p.nowyear - 71), rights = "70" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- args_final = { c = ":", options = " nobox ", birthyear = (p.nowyear - 99), deathyear = (p.nowyear - 70), rights = "70" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- args_final = { c = ":", options = " nobox ", birthyear = (p.nowyear - 99), deathyear = (p.nowyear - 69), rights = "70" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- wkt = wkt .. "<br/>* Droits canadien" -- args_final = { c = ":", options = " nobox ", deathyear = (p.nowyear - 52), rights = "50" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- args_final = { c = ":", options = " nobox ", birthyear = (p.nowyear - 79), deathyear = (p.nowyear - 51), rights = "50" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- args_final = { c = ":", options = " nobox ", birthyear = (p.nowyear - 79), deathyear = (p.nowyear - 50), rights = "50" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- args_final = { c = ":", options = " nobox ", birthyear = (p.nowyear - 79), deathyear = (p.nowyear - 49), rights = "50" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- wkt = wkt .. "<br/>* Droits pour un deces il y a 50 ans" -- args_final = { c = ":", options = " nobox ", birthyear = (p.nowyear - 99), deathyear = (p.nowyear - 50), rights = "non" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- args_final = { c = ":", options = " nobox ", birthyear = (p.nowyear - 99), deathyear = (p.nowyear - 50), rights = "70" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- args_final = { c = ":", options = " nobox ", birthyear = (p.nowyear - 99), deathyear = (p.nowyear - 50), rights = "50" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- args_final = { c = ":", options = " nobox ", birthyear = (p.nowyear - 99), deathyear = (p.nowyear - 50), rights = "mpf" } res, args_final = p.author_rights(args_final) wkt = wkt .. args_final.tst -- -- wkt = wkt .. "\n* '''author_rights''' errors = " .. CA.error_color(errs) return wkt end -- function p.author_rights_test( wkt, args_final) local defaultsort = function(args_final) if type(args_final) ~= "table" then args_final = CA.args_final end local name = args_final.sortkey or args_final.lastname or args_final.title or "Module:Auteur" return mw.getCurrentFrame():preprocess("{{DEFAULTSORT:" .. name .. "}}") end ------------------------------------------------------------ -- Gérer et générer l'entête de page d'un auteur -- Voir aussi les styles dans Mediawiki:commons.css, Utilisateur:Xyz/commons.css ------------------------------------------------------------ -- Extract one number from a text, digital or roman -- In the chain of calls : p.a_number() p.year_century() p.century_epoch() p.events_epochs() function p.a_number( ee, base_in) -- ee = p.a_number( ee, "decim") if type(wkt) ~= "string" then wkt = "" end if type(tst) ~= "string" then tst = "" end ee.nbr = nil -- -- La base du nombre (decim ou roman) est définie par ee.base_in puis par ee.base ici. -- Ensuite elle sera forcée par des valeurs d'années décimales trop grandes pour être des siècles. -- Ensuite elle sera forcée par des chiffres romains de siècle. -- voir aussi err_year_in_roman_number ee.base = "decim" -- valeur par défaut if base_in then ee.base_in = base_in end if ee.base_in then ee.base = ee.base_in end -- correct abnormal values, corriger des valeurs anormales if ee.base ~= "roman" then ee.base = "decim" end local val, argmt, argmX = nil, "", "" local an_tab = {} ee.nbr_txt = "" ee.nbr_in = ee.nbr_in or "" -- Search roman numbers. Chercher les nombres romains. ee.digit_select = "[^MDCLXVIJ]" local spaces = string.gsub( " "..ee.nbr_in.." ", ee.digit_select, " " ) local lst = wordstotable( spaces ) -- convertit un texte en table de mots for key, word in pairs(lst) do -- search eventual numbers val = nil if word then -- L'argument peut contenir un nombre décimal, un nombre romain ou les deux. -- On lit les deux pour traiter tous les cas plus tard. val, errx = MathRoman.roman2int(word) if val == 0 then val = nil end if (val ~= nil) then ee.roman_txt = word -- il y a au moins un nombre roman parmi les mots table.insert( an_tab, val ) ee.nbr = val ee.base = "roman" ee.spaces = spaces ee.nbr_txt = ee.nbr_txt .. ee.roman_txt ee.vague_txt = string.gsub( ee.nbr_in, ee.nbr_txt or "", "" ) ee.vague_txt = string.gsub( ee.vague_txt, "[^%l%<%=%>]", "" ) ee.vague_roman = isDef(ee.vague_txt) end end end -- Chercher les nombres décimaux ee.digit_select = "[^%d]" -- "[^%d]" local spaces = string.gsub( " "..ee.nbr_in.." ", ee.digit_select, " " ) local lst = wordstotable( spaces ) -- convertit un texte en table de mots " "..ee.nbr_in.." " for key, word in pairs(lst) do -- search eventual numbers val = nil if word then -- L'argument peut contenir un nombre décimal, un nombre romain ou les deux. -- On lit les deux pour traiter tous les cas plus tard. val = tonumber( word ) if (val ~= nil) then ee.decim_txt = word -- il y a au moins un nombre décimal parmi les mots table.insert( an_tab, val ) ee.nbr = val ee.base = "decim" ee.spaces = spaces ee.nbr_txt = ee.decim_txt -- Dans le texte d'entrée, sans le nombre trouvé, garder seulement les lettres et "<=>". -- In the input text, without the found number, keep only letters and "<=>" ee.vague_txt = string.gsub( ee.nbr_in, ee.nbr_txt or "", "" ) ee.vague_txt = string.gsub( ee.vague_txt, "[^%l%<%=%>]", "" ) ee.vague_decim = isDef(ee.vague_txt) end end end -- ee.tabN = table.maxn( an_tab ) if ee.tabN == 1 then -- verify the number is alone -- Si on a un nombre et un seul, on peut utiliser sa valeur -- Et on connait sa base par decim_txt ou roman_txt ee.nbr = an_tab[1] else -- erreur s'il n'y a pas de nombre ou s'il y en a plusieurs -- cat = cat .. CA.erreur_add("err_one_number_argument", tostring( ee[argname] ) ) ee.nbr = nil ee.nbr_txt = nil end if ee.nbr then -- adjust for negative numbers, including romans local negatif = string.find( ee.nbr_in, "-" .. ee.nbr_txt ) if negatif then ee.nbr = - ee.nbr -- ee.nbr_txt = "" -- if ee.decim_txt then ee.nbr_txt = ee.decim_txt end -- Pour les catégories EC, BEC ou Av. JC -- if ee.roman_txt then ee.nbr_txt = ee.nbr_txt .. ee.roman_txt end end end -- Chercher du texte significatif en plus du nombre -- Search for significant text in addition to the number tst = "\n* a_number " -- tostring(tst) .. "\n* a_number " tst = tst .. CA.ta("nbr_in", ee.nbr_in) .. CA.ta("base_in", ee.base_in) .. CA.ta("base", ee.base) tst = tst .. CA.ta("nbr", ee.nbr) .. CA.ta("uncertain_txt", ee.vague_txt) -- tst = tst .. CA.ta("spaces", ee.spaces) -- .. CA.ta("argmX", argmX) tst = tst .. CA.ta("tabN", ee.tabN) .. CA.ta("nbr_txt", ee.nbr_txt) -- tst = tst .. CA.ta("decim_txt", ee.decim_txt) .. CA.ta("roman_txt", ee.roman_txt) -- tst = tst .. CA.ta("err", err) .. CA.ta("cat", cat) ee.wkt = tst return ee, tst -- wkt, cats, tst, errs, ee end -- function p.a_number( ee, base_in) -- In the chain of calls : p.a_number() p.year_century() p.century_epoch() p.events_epochs() function p.a_number_test( wkt, args_final) -- Unitary tests of p.a_number local ee, errs -- wkt, cats, wkt = tostring(wkt) wkt = wkt .. "<br>This list displays always the same variables." wkt = wkt .. "<br>Cette liste affiche toujours les mêmes variables." -- ee.base_in = "decim" ee = { c = ":", argname = "birthyear", event = "birth", nbr_in = "1234" } ee = p.a_number( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", nbr_in = "vers -1234" } ee = p.a_number( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", nbr_in = "< -1234" } ee = p.a_number( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", nbr_in = ">= -1234" } ee = p.a_number( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", nbr_in = "MCCXXXIV" } ee = p.a_number( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", nbr_in = "1234" } ee = p.a_number( ee, "roman") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", nbr_in = "MMCXXXIJ" } ee = p.a_number( ee, "roman") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", nbr_in = "-MMMCCXJ" } ee = p.a_number( ee, "roman") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", nbr_in = "avant -CXJ" } ee = p.a_number( ee, "roman") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", nbr_in = "début du XVIIème siècle" } ee = p.a_number( ee, "roman") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", nbr_in = " vers 1357 ou 1358" } ee = p.a_number( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", nbr_in = "le 14/07/1789" } ee = p.a_number( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", nbr_in = "vers 1357 ou MCCXXXIV" } ee = p.a_number( ee, "decim") wkt = wkt .. ee.wkt -- wkt = wkt .. "\n* '''a_number_test''' errors = " .. CA.error_color(err or "") return wkt end -- function p.a_number_test( wkt, args_final) -- Convert a digital or roman number to a year or century -- In the chain of calls : p.a_number() p.year_century() p.century_epoch() p.events_epochs() function p.year_century( ee ) -- ee = p.a_number( ee, "decim") ee.cats = ee.cats or "" ee.errs = ee.errs or "" local err, cat = "", "" ee.nowyear = p.nowyear -- -- Type of arguments if ee.birthcentury then ee.argname = "birthcentury" end if ee.birthyear then ee.argname = "birthyear" end -- keep year rather than century if ee.deathcentury then ee.argname = "deathcentury" end if ee.deathyear then ee.argname = "deathyear" end -- keep year rather than century if ee.birthyear or ee.birthcentury then ee.event = "birth" end if ee.deathyear or ee.deathcentury then ee.event = "death" end -- -- Pour un évènement, on utilise l'argument année plus précis, sinon le siècle. if ee.event == "birth" then ee.nbr_in = ee.birthyear or ee.birthcentury -- keep year rather than century elseif ee.event == "death" then ee.nbr_in = ee.deathyear or ee.deathcentury -- keep year rather than century else -- Pour un évènement indéterminé, on utilise plutôt le décès pour les droits d'auteur, sinon la naissance. ee.nbr_in = ee.deathyear or ee.birthyear or ee.deathcentury or ee.birthcentury end local ee = p.a_number( ee, "decim") -- The number is a priori a year. -- Le nombre est à priori une année. ee.century = nil ee.year = ee.nbr -- A roman number defines a century, and cancel the year. -- Un nombre romain définit un siecle, et annule l'année. -- if ee.base_in == "roman" then if ee.base == "roman" then ee.century = ee.nbr ee.year = nil end -- A number coming from a century argument defines a century. -- Un nombre qui vient d'un argument de siècle définit un siecle. if ee.argname == "birthcentury" or ee.argname == "deathcentury" then ee.century = ee.nbr ee.year = nil end -- A number too big or too small to be a century is a year. -- Un nombre trop grand ou trop petit pour être un siècle est une année. -- L'Antiquité européenne commence au IVe millénaire av. J.-C. -- La civilisation de l'Indus (5000 av. J.-C. – 1900 av. J.-C.). -- In 2013, keep a margin of one unit (year or century). -- En 2013, garder une marge d'une unité (année ou siècle). if ee.nbr then if ee.nbr < -60 or 22 < ee.nbr then ee.century = nil ee.year = ee.nbr end end -- -- Consequences for a year : -- Conséquences pour une année : if ee.year then ee.vague_year = ee.vague_decim or ee.vague_roman if ee.event == "birth" then -- Auteur par défaut à partir de 20 ans ee.event_author = ee.year + p.constantes.author_birth_to_writing elseif ee.event == "death" then -- Auteur par défaut jusqu'à 5 ans avant le décès ee.event_author = ee.year - p.constantes.author_writing_before_death else ee.event_author = ee.year end -- year anno année ee.event_yr = ee.event_author -- Assurer la continuité des années autour de 1 pour comparaisons futures if ee.event_yr and ee.event_yr < 1 then ee.event_yr = ee.event_yr + 1 end -- century siglo siècle ee.event_century_abs = math.floor( math.abs(ee.event_author - 1 ) / 100 ) + 1 ee.event_ct = ee.event_century_abs -- Assurer la continuité des siècles autour de 1 pour comparaisons futures if ee.event_ct and ee.event_ct < 1 then ee.event_ct = ee.event_ct + 1 end if ee.event_ct then ee.event_ct = ee.event_ct*100 end ee.century_roman, ee.error_roman = MathRoman.int2roman(ee.event_ct / 100) elseif ee.century then ee.vague_cent = ee.vague_decim or ee.vague_roman -- century siglo siècle ee.event_century_abs = math.floor( math.abs(ee.century) ) ee.event_ct = ee.century -- Assurer la continuité des siècles autour de 1 pour comparaisons futures if ee.event_ct and ee.event_ct < 1 then ee.event_ct = ee.event_ct + 1 end if ee.event_ct then ee.event_ct = ee.event_ct*100 end ee.century_roman, ee.error_roman = MathRoman.int2roman(ee.event_ct / 100) end -- tst = "\n* year_century " -- tostring(tst) .. tst = tst .. CA.tam("event", ee.event) .. CA.tam("nbr_in", ee.nbr_in) tst = tst .. CA.tam("base", ee.base) -- .. CA.tam("base_in", ee.base_in) tst = tst .. CA.tam("year", ee.year) .. CA.tam("event_author", ee.event_author) tst = tst .. CA.tam("event_yr", ee.event_yr) .. CA.tam("century", ee.century) tst = tst .. CA.tam("event_ct", ee.event_ct) .. CA.tam("century_roman", ee.century_roman) tst = tst .. CA.tam("err", CA.error_color(err)) .. CA.tam("cat", cat) ee.wkt = tst ee.cats = ee.cats .. cat ee.errs = ee.errs .. err return ee, ee.wkt end -- function p.year_century( ee ) -- In the chain of calls : p.a_number() p.year_century() p.century_epoch() p.events_epochs() function p.year_century_test( wkt, args_final) -- Unitary tests of p.year_century local args_final = mw.clone(args_final) local cats, errs, ee -- wkt, wkt = wkt .. "<br>This list do not displays nil variables." wkt = wkt .. "<br>Cette liste n'affiche pas les variables nil." -- ee.base_in = "decim" ee = { c = ":", argname = "birthyear", event = "birth", birthyear = "1234" } -- nbr_in = "1234" } ee = p.year_century( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", birthyear = "vers -1234" } -- nbr_in = "vers -1234" } ee = p.year_century( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", birthyear = "< -1234" } ee = p.year_century( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", birthyear = ">= -1234" } ee = p.year_century( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", birthyear = "MCXI" } ee = p.year_century( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", birthyear = "1234" } ee = p.year_century( ee, "roman") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", birthyear = "MCXI" } ee = p.year_century( ee, "roman") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", birthyear = "-MMMMCCCXXIJ" } ee = p.year_century( ee, "roman") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", birthyear = "avant -CXJ" } ee = p.year_century( ee, "roman") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthcentury", event = "birth", birthcentury = "début du XVIIème siècle" } ee = p.year_century( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", birthyear = " vers 1357 ou 1358" } ee = p.year_century( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", birthyear = "le 14/07/1789" } ee = p.year_century( ee, "decim") wkt = wkt .. ee.wkt -- ee = { c = ":", argname = "birthyear", event = "birth", birthyear = "vers 1357 ou MCCXXXIV" } ee = p.year_century( ee) wkt = wkt .. ee.wkt -- wkt = wkt .. "\n* '''year_century_test''' errors = " .. CA.error_color(err or "") return wkt end -- function p.year_century_test( tst, args_final) -- Computes the epoch from a year or a century -- Calcule l'époque pour une année ou un siècle -- In the chain of calls : p.a_number() p.year_century() p.century_epoch() p.events_epochs() function p.century_epoch( ee) -- ee = p.century_epoch( ee) -- ee = p.a_number( ee, "decim") local err, cat = "", "" local epq, epoq, epoque = "", "", "" local wkt = wkt or "" local cats = cats or "" local tst = tst or "" local errs = errs or "" local ee = p.year_century( ee, "decim") -- wkt, cats, xxx, errs, -- -- En Asie, l'Antiquité se termine à peu près vers l'an -200, avec la Dynastie Qin qui inaugure la période impériale en Chine et le début de la dynastie Chola en Inde. -- En Chine, la période des Printemps et Automnes s'étend de 770 à 453 av. J.-C. -- En Chine, la période des Royaumes combattants s'étend de 453 à 221 av. J.-C -- En Chine, la période de l'empire s'étend de 220 av. J.-C. à 1911. -- En Chine, la république commence en 1912. -- -- En Inde, Des origines à l'Empire moghol (dynasties musulmanes venues de Perse et d'Afghanistan), dominant jusqu'au milieu du XVIIIe siècle. La période coloniale britannique (1750-1947), l'Empire britannique des Indes comprenant alors le Bangladesh et le Pakistan actuels, Depuis l'indépendance de l'Inde (1947-). -- En Inde, la civilisation de l'Indus (5000 av. J.-C. – 1900 av. J.-C.). -- En Inde, l'Antiquité finit vers l'an -200, suivie de la dynastie Chola. -- En Inde, la Civilisation védique en ... ? -- En Inde, Antiquité et Moyen Âge indien aux IVe et Ve siècles. -- En Inde, époque moderne depuis La colonie britannique (1750-1947). -- -- l'Antiquité européenne commence au IVe millénaire av. J.-C. -- -- A faire : valeurs autorisées pour un argument, region_values = 'autre/chine/inde/siècle' -- region_values = "other/china/india/century", -- region_values = "autre/chine/inde/siècle", -- args_values_err = "Abnormal value of the argument %1", -- args_values_err = "Valor anormal del argumento %1", -- args_values_err = "Valeur anormale de l'argument %1", -- p.args_known p.msgs_list p.i18n[p.msgs_lang] CA.i18n[CA.msgs_lang]["region"]["values"] -- local args_values_err = " test args_values_err " -- local args_values_err = string.find(CA.i18n[CA.msgs_lang]["region"]["values"], ee.region) -- local args_values_err = string.find("other/china/india/century", ee.region) -- if ee.region and not string.find("other/china/india/century", ee.region) then -- ee.region = "fr" -- args_values_err = CA.str_vars("args_values_err", tostring(ee.region) ) -- CA.erreur_add("Valeur anormale de l'argument %1" .. args_values_err) -- CA.catGen( epoque, epoque, ee.c ) -- end if (ee.region ~= "china") and (ee.region ~= "india") and (ee.region ~= "century") then ee.region = "other" end local liste_epoques = { { reg = "china", start = -9999, stop = -771, cat = "cat_epoch_china_antiquity", val = "", }, { reg = "china", start = -770, stop = -221, cat = "cat_epoch_china_springs", val = "", }, { reg = "china", start = -220, stop = 1911, cat = "cat_epoch_china_empires", val = "", }, { reg = "china", start = 1912, stop = 9999, cat = "cat_epoch_century_EC", val = ee.century_roman, }, -- { reg = "india", start = -9999, stop = -1901, cat = "cat_epoch_indian_indus", val = "", }, { reg = "india", start = -1900, stop = 500, cat = "cat_epoch_indian_antiquity", val = "", }, { reg = "india", start = 501, stop = 1750, cat = "cat_epoch_indian_muslim", val = "", }, { reg = "india", start = 1751, stop = 9999, cat = "cat_epoch_century_EC", val = ee.century_roman, }, -- { reg = "century", start = -9999, stop = -1, cat = "cat_epoch_century_BEC", val = ee.century_roman, }, { reg = "century", start = 1, stop = 9999, cat = "cat_epoch_century_EC", val = ee.century_roman, }, -- { reg = "other", start = -9999, stop = 500, cat = "cat_epoch_antiquity", val = "", }, { reg = "other", start = 501, stop = 1400, cat = "cat_epoch_middle_age", val = "", }, { reg = "other", start = 1401, stop = 9999, cat = "cat_epoch_century_EC", val = ee.century_roman, }, } local error_id = nil for i, epq in pairs(liste_epoques) do -- Parmi toutes les époques définies if ee.region then if ee.event_author then if ( epq.reg == ee.region) and ( epq.start <= ee.event_author) and (ee.event_author <= epq.stop ) then epoque = CA.str_vars(epq.cat, epq.val ) cat = cat .. CA.catGen( epoque, epoque, ee.c ) end elseif ee.event_ct then if ( epq.reg == ee.region) and ( epq.start <= ee.event_ct) and (ee.event_ct <= epq.stop ) then epoque = CA.str_vars(epq.cat, epq.val ) cat = cat .. CA.catGen( epoque, epoque, ee.c ) if ee.vague and not ee.year and ee.century and epq.cat == "cat_epoch_century_EC" then if ee.event == "birth" then -- Catégorie:Naissance en 18.. incertain epoque = CA.str_vars("authors_birth_century", ee.century ) elseif ee.event == "death" then -- Catégorie:Décès en 18.. incertain epoque = CA.str_vars("authors_death_century", ee.century ) end cat = cat .. CA.catGen( epoque, epoque, ee.c ) end end end end end -- -- Un seul nombre accepté if ee.tabN > 1 then -- verify the number is alone -- err = err .. CA.error_color(" n ± 1 années. ") local arg_nm = CA.wiki_args[ee.argname] -- p.args_final arg_nm = CA.error_color(arg_nm) err = err .. CA.erreur_add("err_one_number_argument", arg_nm ) end -- -- Ambigüité des années en nombres romains if ee.year and ee.base and (ee.base == "roman") then -- local arg_nm = CA.wiki_args[ee.argname] -- p.args_final -- arg_nm = CA.error_color(arg_nm) err = err .. CA.erreur_add("err_year_in_roman_number", ee.nbr_in ) end -- local tst = "\n* century_epoch " tst = tst .. CA.tam("event", ee.event) .. CA.tam("nbr_in", ee.nbr_in) tst = tst .. CA.tam("year", ee.year) .. CA.tam("event_author", ee.event_author) tst = tst .. CA.tam("century", ee.century) .. CA.tam("century_roman", ee.century_roman) tst = tst .. CA.tam("region", ee.region) tst = tst .. CA.tam("err", CA.error_color(err)) .. CA.tam("cat", cat) ee.wkt = tst ee.errs = ee.errs .. err ee.cats = ee.cats .. cat return ee, tst -- wkt, cats, tst, errs, ee end -- function p.century_epoch( wkt, cats, tst, errs, ee) -- In the chain of calls : p.a_number() p.year_century() p.century_epoch() p.events_epochs() function p.century_epoch_test( wkt, args_final) -- Unitary tests of p.century_epoch -- local args_final = mw.clone(args_final) wkt = wkt or "" cats = cats or "" errs = errs or "" -- wkt = wkt .. "<br>This list do not displays nil variables." wkt = wkt .. "<br>Cette liste n'affiche pas les variables nil." wkt = wkt .. "\n* '''Chine''' " local c = ":" local ee = { c=c, nowyear=p.nowyear, region = "china", birthyear = "-771" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "china", birthyear = "-770" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "china", birthyear = "-221" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "china", birthyear = "-220" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt --[ [ local ee = { c=c, nowyear=p.nowyear, region = "china", birthyear = "1911" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "china", birthyear = "1912" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "china", birthyear = "2000" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "china", birthyear = "2001" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- wkt = wkt .. "\n* '''Inde''' " local ee = { c=c, nowyear=p.nowyear, region = "india", birthyear = "-1901" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "india", birthyear = "-1900" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "india", birthyear = "500" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "india", birthyear = "501" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "india", birthyear = "1750" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "india", birthyear = "1751" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "india", birthyear = "1900" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "india", birthyear = "1901" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- wkt = wkt .. "\n* '''Autres''' " local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "500" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "501" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "1379" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "1380" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "1381" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "1400" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "1401" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "1880" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "1881" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "1900" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "1901" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "500" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- wkt = wkt .. "\n* '''Siècles''' " local ee = { c=c, nowyear=p.nowyear, region = "century", birthyear = "-201" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "century", birthyear = "-1" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "century", birthyear = "1" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "century", birthyear = "201" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- wkt = wkt .. "\n* '''Siècles ou années ?''' " local ee = { c=c, nowyear=p.nowyear, region = "other", event = "x", birthcentury = "début du XVIIème siècle" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- wkt = wkt .. "\n* '''Incertains''' " local ee = { c=c, nowyear=p.nowyear, region = "other", event = "x", birthyear = "vers -1357" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", event = "x", birthyear = "vers MCXI" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", event = "x", birthyear = "vers 1357 ou MCCCLIX" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", event = "x", birthyear = "deux dates de naissance" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", event = "x", birthyear = "avant le X siècle" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", event = "x", birthcentury = "avant le X siècle" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", event = "x", deathyear = "avant le X ème siècle" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", event = "x", deathcentury = "avant le X ème siècle" } ee = p.century_epoch( ee) wkt = wkt .. ee.wkt -- wkt = wkt .. "\n* '''century_epoch''' errors = " .. CA.error_color(errs) return wkt end -- function p.century_epoch_test( tst, args_final) --[[ * ancien Modèle:Auteur : Générer un nom d'époque à partir d'un numéro de siècle ou d'année, comme "du XVe siècle", ou "de l'Antiquité". * Lier ce nom au texte précédent. * S'adapter à des valeurs numériques ou non. * Un auteur est dit du 20e siècle, de 1901 à 2000, s’il a écrit pendant ce siècle de 20 ans après sa naissance à 5 ans avant son décès. * Cette règle automatique peut donc classer un auteur dans deux siècles ou deux époques à la fois. * Le Ve siècle av. J.-C. s'étend de -500 à -401. Il n'existe pas d'an 0 ni de siècle 0 dans le calendrier grégorien ni dans le calendrier julien. Les époques sont : * à partir du siècle 15 (en l'an 1401 et suivants) : "du XVe siècle" et suivants * des siècles 6 à 14 inclus (de l'an 501 à l'an 1400 inclus) : "du Moyen Âge" * pour le siècle 5 et avant (avant l'an 501) : "de l'Antiquité" * pour le siècle -9 et avant (avant l'an -800) : "de l'Antiquité chinoise" * pour les années -771 et avant : "de l'Antiquité chinoise * On ne catégorise les années de naissances et de décès que dans les 100 dernières années. --]] -- Générer les textes de categories et d'erreurs des annees et siecles. -- In the chain of calls : p.a_number() p.year_century() p.century_epoch() p.events_epochs() function p.events_epochs(args_final, mode, c, verif) local err, cat = "", "" local wkt = wkt or "" local cats = cats or "" local tst = tst or "" local errs = errs or "" if type(args_final) ~= "table" then args_final = CA.args_final end -- local ee_birth = { c = ":", region = args_final.region, region_values = args_final.region_values, birthyear = args_final.birthyear, birthcentury = args_final.birthcentury, argname = "birthyear", event = "birth" } local ee_birth = p.century_epoch( ee_birth) cats = cats .. ee_birth.cats -- local ee_death = { c = ":", region = args_final.region, region_values = args_final.region_values, deathyear = args_final.deathyear, deathcentury = args_final.deathcentury, argname = "deathyear", event = "death" } local ee_death = p.century_epoch( ee_death) cats = cats .. ee_death.cats -- cat = cat .. ee_birth.cat .. ee_death.cat -- -- Categorize the year of death for 100 years -- Clasificar el año que murió hace 100 años -- Catégoriser l'année de décès depuis 100 ans local year_limit = p.nowyear - p.constantes.categorise_death_for_n_years if ee_birth.year and (year_limit < ee_birth.year) then -- Naissance en ... epq = CA.str_vars( "authors_birthyear", ee_birth.year ) cat = cat .. CA.catGen( epq, c ) end if ee_death.year and (year_limit < ee_death.year) then -- Décès en ... epq = CA.str_vars( "authors_deathyear", ee_death.year ) cat = cat .. CA.catGen( epq, c ) end -- -- Années ou siècles vagues incertains local epq = nil if ee_birth.vague_year or ee_death.vague_year then epq = "err_vague_year" elseif ee_birth.vague_cent or ee_death.vague_cent then epq = "err_vague_epoch" end if epq then epq = CA.str_vars( epq ) cat = cat .. CA.catGen( epq, c ) end -- -- Verify bith < death -- Comprobar nacer <muerte -- Vérifier naissance < Décès ee_birth.event_yr = tonumber(ee_birth.year) -- annees ee_death.event_yr = tonumber(ee_death.year) ee_birth.event_ct = tonumber(ee_birth.century) -- siecles if ee_birth.event_ct then ee_birth.event_ct = ee_birth.event_ct*100 end ee_death.event_ct = tonumber(ee_death.century) if ee_death.event_ct then ee_death.event_ct = ee_death.event_ct*100 end if ee_birth.event_yr and ee_birth.event_yr < 0 then ee_birth.event_yr = ee_birth.event_yr + 1 end if ee_death.event_yr and ee_death.event_yr < 0 then ee_death.event_yr = ee_death.event_yr + 1 end if ee_birth.event_ct and ee_birth.event_ct < 0 then ee_birth.event_ct = ee_birth.event_ct + 100 end if ee_death.event_ct and ee_death.event_ct < 0 then ee_death.event_ct = ee_death.event_ct + 100 end -- birth_yr = birth_yr or birth_ct -- death_yr = death_yr or death_ct -- local birthdeath = true -- Vérifier naissance < Décès local lifetime = true -- Durée de vie anormale > 120 ans local lifetime_txt = "" -- Durée de vie anormale > 120 ans if ee_birth.event_yr and ee_death.event_yr then -- annee -> annee if ( (ee_birth.event_yr + p.constantes.lifetime_limit) < ee_death.event_yr ) then lifetime = false lifetime_txt = CA.str_vars("err_life_too_long", ee_birth.event_yr, ee_death.event_yr) end if ee_birth.event_yr > ee_death.event_yr then birthdeath = false end elseif ee_birth.event_ct and ee_death.event_yr then -- siecle -> annee if (ee_birth.event_ct + p.constantes.lifetime_limit) < ee_death.event_yr then lifetime = false lifetime_txt = CA.str_vars("err_life_too_long", ee_birth.event_ct, ee_death.event_yr) end if (ee_birth.event_ct - 100) > ee_death.event_yr then birthdeath = false end elseif ee_birth.event_yr and ee_death.event_ct then -- annee -> siecle if (ee_birth.event_yr + p.constantes.lifetime_limit) < (ee_death.event_ct - 100) then lifetime = false lifetime_txt = CA.str_vars("err_life_too_long", ee_birth.event_yr, (ee_death.event_ct - 100) ) end if ee_birth.event_yr > (ee_death.event_ct) then birthdeath = false end elseif ee_birth.event_ct and ee_death.event_ct then -- siecle -> siecle if (ee_birth.event_ct + p.constantes.lifetime_limit) < ee_death.event_ct then lifetime = false lifetime_txt = CA.str_vars("err_life_too_long", ee_birth.event_ct, ee_death.event_ct) end if ee_birth.event_ct > ee_death.event_ct then birthdeath = false end end if not lifetime then -- err_life_too_long = "Durée de vie trop longue de %1 à %2.", err = err .. lifetime_txt -- CA.str_vars("err_life_too_long", ee_birth.year, ee_death.year) local err_life_too_long_cat = CA.str_vars("err_life_too_long_cat") cat = cat .. CA.catGen(err_life_too_long_cat, err_life_too_long_cat, c) error_id = "err-year"..tostring(ee_birth.year)..">"..tostring(ee_death.year) end if not birthdeath then -- si naissance apres Décès pour year ou century -- err_death_before_birth = "Error: death '''%1''' is before birth '''%2'''.", -- err_death_before_birth_cat= "Author death is before birth", err = err .. CA.str_vars("err_death_before_birth", ee_death.year, ee_birth.year) local err_death_before_birth_cat = CA.str_vars("err_death_before_birth_cat") cat = cat .. CA.catGen(err_death_before_birth_cat, err_death_before_birth_cat, c) error_id = "err-year"..tostring(ee_birth.year)..">"..tostring(ee_death.year) end if not (ee_birth.event_yr or ee_death.event_yr or ee_birth.event_ct or ee_death.event_ct) then -- not (ee_birth.event_yr or ee_death.event_yr or birth_ct or death_ct) -- ni annees ni siecles local err_unknown_epoch_cat = CA.str_vars("err_unknown_epoch_cat") cat = cat .. CA.catGen(err_unknown_epoch_cat, err_unknown_epoch_cat, c) end -- -- birthcentury birthuncertain deathyear death deathcentury -- A faire : Catégorie:Siècle incertain -- A faire : Catégorie:Epoque inconnue -- return res, cat, err, t -- p.annees_epoques(args_final, mode, c, verif) -- res = res .. tostring(t) ; errors = errors .. err -- err = err .. ee_birth.errs .. ee_death.errs tst = "\n* events_epochs " -- tst = tst .. CA.tam("event", ee_birth.event) .. CA.ta("nbr_in", ee_birth.nbr_in) if ee_birth.year then tst = tst .. CA.tam("birth.nbr_in", ee_birth.nbr_in) tst = tst .. CA.tam("birth.year", ee_birth.year) tst = tst .. CA.tam("birth.author", ee_birth.event_author) elseif ee_birth.century then tst = tst .. CA.tam("birth.nbr_in", ee_birth.nbr_in) tst = tst .. CA.tam("birth.century", ee_birth.century) end -- tst = tst .. "<br/>" .. CA.ta("event", ee_death.event) .. CA.ta("nbr_in", ee_death.nbr_in) if ee_death.year then tst = tst .. CA.tam("death.nbr_in", ee_death.nbr_in) tst = tst .. CA.tam("death.author", ee_death.year_author) tst = tst .. CA.tam("death.year", ee_death.year) elseif ee_death.century then tst = tst .. CA.tam("death.nbr_in", ee_death.nbr_in) tst = tst .. CA.tam("death.century", ee_death.century) end tst = tst .. CA.tam("region", ee_death.region) -- tst = tst .. CA.ta("birth_yr", birth_yr) .. CA.ta("death_yr", death_yr) -- tst = tst .. wkt tst = tst .. CA.tam("err", CA.error_color(err)) -- .. CA.ta("cats", cats) -- -- Remplacer les siècles sans texte par X ème siècle local birth_txt, death_txt = "", "" if ee_birth.century and not ee_birth.year and not ee_birth.vague then birth_txt = ee_birth.century_roman else birth_txt = ee_birth.nbr_in end if ee_death.century and not ee_death.year and not ee_death.vague then death_txt = ee_death.century_roman else death_txt = ee_death.nbr_in end -- birth_txt = ee_birth.vague_year or ee_birth.vague_cent or "" death_txt = ee_death.vague_year or ee_death.vague_cent or "" wkt = "<br/>(" .. ee_birth.nbr_in .. " — " .. ee_death.nbr_in .. ") " .. cat local ee = {} ee.wkt = wkt ee.tst = tst ee.errs = err ee.cats = cats return ee -- wkt, cats, tst, errs, ee end -- function p.events_epochs(args_final, mode, c, verif) -- In the chain of calls : p.a_number() p.year_century() p.century_epoch() p.events_epochs() function p.events_epochs_test( wkt, args_final) -- Unitary tests of p.century_epoch -- local args_final = mw.clone(args_final) wkt = wkt or "" wkt = wkt .. "<br>This list do not displays nil variables." wkt = wkt .. "<br>Cette liste n'affiche pas les variables nil." -- wkt = wkt .. "\n* '''Exemples d'époques en Inde''' " -- local c = ":" local nowyear = tonumber(os.date("%Y") ) -- local now_date = os.date("%Y-%m-%d %H:%M:%S") local ee = { c=c, nowyear=p.nowyear, region = "india", birthyear = "-1958", deathyear = "-1834" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "india", birthyear = "1700", deathyear = "1777" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- wkt = wkt .. "\n* '''Durée de vie''' normale " -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "-519", deathyear = "-400" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "-33", deathyear = "33" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "82", deathcentury = "3" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthcentury = "3", deathyear = "419" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "400", deathyear = "519" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- wkt = wkt .. "\n* '''Durée de vie''' > 120 ans de la naissance au décès" -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "-520", deathyear = "400" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "-20", deathyear = "100" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "400", deathyear = "520" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "400", deathcentury = "7" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthcentury = "4", deathyear = "555" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- wkt = wkt .. "\n* Autres cas : pas d'époque : " -- local ee = { c=c, nowyear=p.nowyear, region = "other", } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "après CDLVII", deathyear = "585" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "1907", deathyear = "1985" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- wkt = wkt .. "\n* Autres cas : année en nombre romain : " -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthcentury = "début du XVIIème siècle", deathyear = "avant 1885" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- local ee = { c=c, nowyear=p.nowyear, region = "other", birthyear = "1768", deathcentury = "fin du XIXème siècle" } ee = p.events_epochs(ee, mode, c, verif) wkt = wkt .. ee.tst .. ee.wkt -- -- wkt = wkt .. "\n* '''events_epochs''' errors = " .. CA.error_color(errs) return wkt end -- function p.events_epochs_test( wkt, argfinal) -- Generate the main box. Generar el cuadro principal. Générer la boîte principale. function p.author_box(args_final) -- Generate the main box, in HTML if type(args_final) ~= "table" then args_final = CA.args_final end -- optional arguments local title = args_final.title local caption = args_final.caption local image = args_final.image local initiale = args_final.initiale local description = args_final.description local birthyear = args_final.birthyear local deathyear = args_final.deathyear local wikipedia = args_final.wikipedia local wikiquote = args_final.wikiquote local commons = args_final.commons local interwikis = {} -- local ee = p.events_epochs(args_final, mode, c, verif) if type(description) == "string" then description = description .. " " .. ee.wkt else description = ee.wkt end -- Generate image part of the table if type(image) == "string" then image = '<td valign="middle" align="center" rowspan="2" style=" border-left:{{{border|1}}}px solid #CCCCCC; ">' .. '<div id="AuthorImage" style=" padding:4px; ">' .. "[[File:" .. image .. "|frameless|170x170px||class=photo]]" .. '</div>' .. '</td>' else image = "" end -- Generate interwikis links local links = "" if type(initiale) == "string" then local cat_initiale = CA.str_vars("authors_initiale", initiale) cat_initiale = CA.catGen(cat_initiale, cat_initiale, ":") cat_initiale = '<br/><span style="color:#aaaa66; line-height:120%; ">◀</span> ' .. cat_initiale .. '<br/><br/>' links = links .. cat_initiale -- Failed to encode the character ◀=(U+25C0) '<<' (U+25C4) at column 73 in line 60 end if type(wikipedia) == "string" then -- table.insert(interwikis, '<span style="color:#232388; font-size:140%; line-height:120%; ">⦁ </span>[[wikipedia:' .. wikipedia .. '|Biographie]]<br/>') links = links .. '<span style="color:#232388; font-size:140%; line-height:120%; ">⦁ </span>[[wikipedia:' .. wikipedia .. '|Biographie]]<br/>' end if type(wikiquote) == "string" then -- table.insert(interwikis, '<span style="color:#232388; font-size:140%; line-height:120%; ">⦁ </span>[[wikiquote:' .. wikiquote .. '|Citations]]<br/>') links = links .. '<span style="color:#232388; font-size:140%; line-height:120%; ">⦁ </span>[[wikiquote:' .. wikiquote .. '|Citations]]<br/>' end if type(commons) == "string" then -- table.insert(interwikis, '<span style="color:#232388; font-size:140%; line-height:120%; ">⦁ </span>[[commons:' .. commons .. '|Médias]]<br/>') links = links .. '<span style="color:#232388; font-size:140%; line-height:120%; ">⦁ </span>[[commons:' .. commons .. '|Médias]]<br/>' end -- FIXME: The french display is in HTML direct to better adapt the size and the look to plural environments. -- Generate scans to display local scans = p.HTMLscans(args_final) -- Generate the main box. local wt = '<div id="Author" class="vcard" style="margin-right:5px; box-shadow:0.2em 0.3em 0.2em #B7B7B7; background-color:#F1F1DE; padding:0.3em; width=99.9%; overflow-x:hidden; ">' .. '<table cellspacing="0" cellpadding="0" style="background-color: transparent; border:{{{border|1}}}px solid #CCCCCC; padding:0em;">' .. '<tr>' .. '<td valign="middle" rowspan="2" style="padding: 0em 0.6em; background-color: #F1F1DE; text-align:left; font-size:90%; line-height:80%; ">' .. '<div style="text-align:left; font-size:120%; padding-top:0.5em; text-indent:1em">' .. links .. '</div>' .. '</td>' .. '<td valign="top" align="center" style=" min-width:150px; border-left:{{{border|1}}}px solid #CCCCCC; padding:0.5em; ">' .. '<span class="fn" id="AuthorName" style="line-height:90%; font-size:160%; font-weight:bold; padding-top:0.1em; border-bottom: none; ">' .. title .. '</span>' .. '</td>' .. image .. '</tr>' .. '<tr>' .. '<td valign="top" align="center" style="width:100%; border-left:{{{border|1}}}px solid #CCCCCC; padding:1em; ">' .. '<span class="label" style=" font-size:110%; line-height:80%; text-align:center; " >' .. description .. '</span>' .. '</td>' .. '</tr>' .. '<tr>' .. '<td valign="top" align="center" colspan="3" style="width:100%; border-top:{{{border|1}}}px solid #CCCCCC; padding:1em; ">' .. '<span class="label" style=" font-size:110%; line-height:80%; text-align:center; " >' .. scans .. '</span>' .. '</td>' .. '</tr>' .. '</table>' .. '</div>' return wt end -- function p.author_box(args_final) -- relire ControlArgs/Auteur : module code in english -- voir mw.text.trim(s) mw.text.unstrip(s) truncate() -- split()/gsplit() vers table -- mw.text.nowiki( s ) ou mw.text.encode( s ) vers Html, mw.text.decode( s ) retour -- mw.text.listToText( list, separator, conjunction ) function p.first_last_name( firstname, lastname, args_source) -- if there is no firstname, try to extract it from lastname -- s'il n'y a pas de prénom, essayer de le séparer du nom local first, last, initemp = "", "", nil local part_found, key_ini = false, 1 local t = "" -- On cherche une particule dans le nom, et une initiale if isDef(lastname) then tab = mw.text.split(lastname, '%s') -- convertit tout le nom en table de mots max = table.maxn( tab ) t = t .. " maxn=" .. max -- if max == 2 then -- firstname = tostring(tab[1]) -- .."*" -- lastname = tostring(tab[2]) -- "*".. if max > 0 then -- t = t .. " max > 0 " -- S'il n'y a qu'un mot dans le nom, c'est le nom -- if max == 1 then part_found = true end -- firstname = "" -- lastname = val -- elseif max > 1 then -- t = t .. " max > 1 " first = "" last = "" initemp = nil key_ini = 1 for key, val in pairs(tab) do -- Pour tous les mots du nom -- if part_found then ini = ini or val end t = t .. " key=" .. key -- S'il y a une particule, on le note if val == "de" and not part_found then part_found = true if key_ini == 1 then key_ini = key end -- on note la position de la particule end if key == key_ini + 1 then initemp = val -- le premier mot après la particule donnera l'initiale end -- On cumule les mots dans le prénom, puis dans le nom, à partir de la particule if part_found then t = t .. CA.ta("part_found", val) last = last .. " " .. val else -- Avant la particule ou le dernier mot on cumule les prénoms first = first .. " " .. val t = t .. CA.ta("first", val) end -- Si on a pas de particule quand on arrive au dernier mot if key == max then -- first = first -- Les mots qu'on a déja sont les prénoms, -- last = val -- et le mot actuel est le nom -- t = t .. CA.ta("key == max last", last) firstname = firstname .. " " .. first lastname = last end end --[[ -- initiale = initiale or ini if part_found then firstname = first -- .."e"..tostring(max) lastname = last -- .."d"..tostring(max) else if key == max then firstname = first end end firstname = firstname -- .. "-F-"..tostring(max) lastname = lastname -- .. "-L-"..tostring(max) --]] end end return firstname, lastname, initemp end -- function p.first_last_name( firstname, lastname, args_source) -- Interact parameters in args_final international function p.interact_args_final(args_final) if type(args_final) ~= "table" then args_final = CA.args_final end -- arguments, new or known local args_final = mw.clone(args_final) -- normalize args local lastname = (args_final.lastname) local firstname = (args_final.firstname) local description = (args_final.description) local galliname = (args_final.galliname) local pseudonym = (args_final.pseudonym) -- local sortkey = (args_final.sortkey) local familyname = (args_final.familyname) local title = (args_final.title) local entity = (args_final.entity) local label = (args_final.label) local sitelink = (args_final.sitelink) local image = (args_final.image) local initiale = (args_final.initiale) local birthyear = (args_final.birthyear) local deathyear = (args_final.deathyear) local region = (args_final.region) local wikipedia = (args_final.wikipedia) local wikiquote = (args_final.wikiquote) local commons = (args_final.commons) local t = "" t = t .. "\n* begin :" .. CA.ta("initiale", initiale) .. CA.ta("firstname", firstname) .. CA.ta("lastname", lastname) -- -- S'il n'y a pas de prenom on le cherche dans le nom -- if lastname and not firstname then -- firstname, lastname, initemp = p.first_last_name( firstname, lastname) -- end -- if lastname and firstname and not title then title = firstname .. " " .. lastname CA.args_known.title.src = "inter" end if type(title) ~= "string" then title = lastname or label or sitelink title = title or tostring(mw.site.namespaces.Module.name) .. ":" .. CA.module_name CA.args_known.title.src = "inter" end -- -- normalize initiale from interact Names and title if initiale == "" then initiale = nil end if lastname and not initiale then local string_in_chars = string.byte( lastname .. "----", 1, 1 ) initiale = string.char( string_in_chars ) CA.args_known.initiale.src = "inter" end initiale = string.upper( initiale or "" ) -- -- interact link to other wikis if not wikipedia then wikipedia = title CA.args_known.wikipedia.src = "inter" end if not wikiquote then wikiquote = title CA.args_known.wikiquote.src = "inter" end if not commons then commons = title CA.args_known.commons.src = "inter" end -- t = t .. "\n*: end :" .. CA.ta("initiale", initiale) .. CA.ta("firstname", firstname) .. CA.ta("lastname", lastname) -- to return and memorize in CA.args_final args_final.lastname = lastname args_final.firstname = firstname args_final.galliname = galliname args_final.pseudonym = pseudonym -- args_final.sortkey = sortkey args_final.familyname = familyname args_final.title = title args_final.initiale = initiale args_final.birthyear = birthyear args_final.deathyear = deathyear args_final.region = region args_final.wikipedia = wikipedia args_final.wikiquote = wikiquote args_final.commons = commons args_final.c = c args_final.options = options -- CA.args_final = args_final p.args_final = args_final return args_final, t end -- function p.interact_args_final(args_final) function p.interact_test( res, args_final) -- res = res .. "\n\n\n* Test de '''interact_args_final''' : " local wd = {} local argi, t = nil, "" argi, t = p.interact_args_final({firstname="Paul", lastname="", initiale=""}) res = res .. t argi, t = p.interact_args_final({firstname="Noël-Gérard", lastname="de La Fontaine de Beauprés", initiale=""}) res = res .. t argi, t = p.interact_args_final({lastname="Noël-Gérard Phương-Thắn de Gomez dos Santos", initiale=""}) res = res .. t argi, t = p.interact_args_final({firstname="", lastname="La Fontaine", initiale="f", wikipedia="La Fontaine"}) res = res .. t argi, t = p.interact_args_final({firstname="", lastname="Arthur Rimbaud", initiale=""}) res = res .. t return res end ------------------------------------------------------------ -- Tests internes. Internal tests. ------------------------------------------------------------ function p.minitest_argfinal( res, args_final) if type(args_final) ~= "table" then args_final = CA.args_final end -- optional arguments -- local res = "" -- CA.minitest_argfinal(args_final, label) res = res .. "\n* " res = res .. CA.ta("args_final.firstname", args_final.firstname) res = res .. CA.ta("args_final.lastname", args_final.lastname) res = res .. CA.ta("args_final.title", args_final.title) return res end -- function p.minitest_argfinal( res, args_final) function p.unit_tests( res, args_final) if type(args_final) ~= "table" then args_final = CA.args_final end -- optional arguments local res = "\n\n* '''Module:Auteur unit_tests''' <br/>" local nowyear = tonumber(os.date("%Y") ) -- local now_date = os.date("%Y-%m-%d %H:%M:%S") p.nowyear = nowyear res = res .. p.HTMLnotice_test( "<br/><br/>\n* Test de '''gener_notices''' : ") res = res .. CA.wikidata_test("<br/><br/>\n* Test de '''wikidata''', données centralisées des wikipedia : ") res = res .. p.minitest_argfinal("<br/><br/>\n* Test de '''minitest_argfinal''' : ", args_final) res = res .. p.interact_test( "<br/><br/>\n* Test de '''interact_args_final''' : ", args_final) res = res .. p.a_number_test( "<br/><br/>\n* Test de '''a_number''' : ", args_final) res = res .. p.year_century_test( "<br/><br/>\n* Test de '''year_century''' : ", args_final) res = res .. p.century_epoch_test( "<br/><br/>\n* Test de '''century_epoch''' : ", args_final) res = res .. p.events_epochs_test( "<br/><br/>\n* Test de '''events_epochs''' : ", args_final) res = res .. p.author_rights_test( "<br/><br/>\n* Test de '''author_rights''' : ", args_final) return res end -- function p.unit_tests( res, args_final) function p.tests_time( if_view, res, time1, time2, time3, time4) if not if_view then return "" end time1 = time1 or p.time1 time2 = time2 or p.time2 time3 = time3 or p.time3 time4 = time4 or p.time4 local nowyear = os.date("%Y-%m-%d %H:%M:%S") local mwtitle = mw.title.getCurrentTitle() -- res = res .. p.testable_args( mwtitle, "mwtitle") -- Script Error : bug not enouth memory -- local localUrl = tostring(mwtitle:localUrl( )) local url = tostring(mwtitle:canonicalUrl( )) -- local fullUrl = mw.uri.fullUrl( canonicalUrl, "http" ) -- tostring(mwtitle:canonicalUrl( )) -- local fullUrl_relat = fullUrl.relativePath -- relative mais pas edit -- time1 = tonumber(time1) or 0 -- time2 = tonumber(time2) or 0 -- time3 = tonumber(time3) or 0 -- time4 = tonumber(time4) or 0 local time2d = time2 - time1 local time3d = time3 - time2 local time4d = time4 - time3 res = res or "" res = res .."<br/>\n* Execution and test time : " .. nowyear .. " UTC" res = res .. CA.ta("url", url) res = res .. CA.ta("<br/>start", time1) .. CA.ta("import", time2d, "+") res = res .. CA.ta("generate page", time3d, "+") .. CA.ta("tests", time4d, "+") return res -- res = res .. p.tests_time( CA.option("debug") or CA.option("testable") or CA.option("trackon"), "" ) -- Execution and test time : 2013-10-16 21:51:28 UTC , url = http://test2.wikipedia.org/wiki/Module:ControlArgs/doc , -- start = 0.025952527 , import + 0.010959653 , generate page + 8.3540000000021e-06 , tests + 0.141406215 end -- function p.tests_time( if_view, res, time1, time2, time3, time4) -- Execution and test time : 2013-06-25 13:11:39, url=http://test2.wikipedia.org/wiki/Victor_Hugo -- , start = 0.015929905 , import = 0.182058582 , générer page = 0.187372364 , tests = 0.29485522 -- Execution and test time : 2013-07-07 21:09:56 UTC, url=http://test2.wikipedia.org/wiki/Victor_Hugo -- , start = 0.321415473 , import + = 0.131845213 , générer page + = 0.004046632 , tests + = 0.054075742 -- Execution and test time : 2013-07-08 00:44:50 UTC, url=http://test2.wikipedia.org/wiki/Victor_Hugo -- , start = 0.608310706 , import + = 0.138837626 , générer page + = 0.004156741 , tests + = 0.056325155 -- Execution and test time : 2013-07-15 18:01:21 UTC, url=http://test2.wikipedia.org/wiki/Victor_Hugo -- , start = 0.567618459 , import + = 0.086441609 , générer page + = 0.00272198 , tests + = 0.085100533 function p.verif_tables(txt) if not txt then return "" end local res = "\n* verif_tables : " .. txt .. " : " res = res .. CA.ta("CA.args_src", CA.args_src) res = res .. CA.ta("CA.wiki_args", CA.wiki_args) res = res .. CA.ta("CA.i18n", CA.i18n) res = res .. CA.ta("CA.args_wikidata", CA.args_wikidata) res = res .. CA.ta("CA.args_known", CA.args_known) res = res .. CA.ta("CA.args_import", CA.args_import) res = res .. CA.ta("CA.args_final", CA.args_final) return res end -- function p.verif_tables() -- Identify the obsolete arguments from old template. -- Repérer les arguments obsolètes de l'ancien modèle. -- Identificar los argumentos obsoletos de viejos modelos. function p.gener_oldargs(args_final) -- Si un ancien argument spécial est utilisé, mettre la page dans la catégorie prévue -- pour repérer toutes les pages concernées if type(args_final) ~= "table" then args_final = CA.args_final end -- optional arguments local res = "" local ifcat = false -- birth_text = {val = nil, typ = "oldargs", need = "0", found = "0", list = 9, keyword = "birth_text", }, for key, arg in pairs(CA.args_known) do -- Parmi toutes les époques définies if (arg.typ == "oldargs") and (arg.val ~= nil) then ifcat = true end end if ifcat then res = res .. CA.catGen("Arguments obsolètes") end if not ifcat then res = res .. CA.catGen("Arguments normaux") end return res end -- function p.gener_oldargs(args_final) -- 27/01/2014 19:14 Norm=0 Obso=0 somme=0 + 6495 = 6495 Auteurs -- 27/01/2014 21:12 Norm=2887 Obso=0 somme=2887 + 3608 = 6495 Auteurs -- 09/02/2014 22:50 Norm=3489 Obso=0 somme=3489 + 3006 = 6495 Auteurs -- relire ControlArgs/Auteur : module code in english -- Basic and documented wikitext result or mask -- Resultado wikitexto y documentado de base o máscara -- Wikitexte généré et documentation de base ou masquée function p.gener_result(args_final) if type(args_final) ~= "table" then args_final = CA.args_final end -- optional arguments local res = "" -- CA.options = " : docdata docmin docdef docmax docligne docavant docapres " -- for documentation -- CA.options = " erron noerr nobox nocat " -- without normal result -- CA.options = " debug notrack trackon testable en es fr " -- for debug or enforce language res = res .. p.gener_oldargs(args_final) if CA.mode_name == "doc" or CA.mode_name == "tests" then res = res .. "<br/>infos de : " .. CA.wikidata_color(" Wikidata, ") .. " modèle ou module, " .. CA.inter_color(" interactions, ") .. CA.message_color(" message, ") .. CA.error_color(" erreur") .. ".<br/>" end if CA.option("docdata") then res = res .. "\n*" .. CA.generDoc("", CA.args_wikidata, "Wikidata") end if CA.option("docavant") then res = res .. "\n*" .. CA.generDoc("", args_final, "Auteur") end -- Assistance à l'utilisateur venant de la vérification des paramètres : if not CA.option("noerr") then res = res .. "\n*" .. CA.erreur_lister("err_assist_user_param") end -- Générer normalement le wikitext, les catégories et autres if not CA.option("nobox") then res = res .. p.author_box(args_final) end if not CA.option("nobox") then res = res .. microformat(args_src, args_final) end if not CA.option("nobox") then res = res .. p.author_rights(args_src, args_final) end -- if not CA.option("nobox") then res = res .. defaultsort(args_src, args_final) end -- if not CA.option("nobox") then Interprojet.interprojet( CA.frame ) end p.gener_categories(args_final) if not CA.option("nocat") then res = res .. "\n*" .. CA.categ_lister() end -- categories in wikitext if CA.option("docapres") then res = res .. "\n*" .. CA.generDoc("", args_final, "Auteur") end return res end -- function p.gener_result(args_final) -- More detailed tests -- Pruebas más detalladas -- Tests détaillés supplémentaires function p.gener_tests(args_final) -- if not bug6 then return " function p.gener_tests(args_final) " end --bug6 if type(args_final) ~= "table" then args_final = CA.args_final end -- optional arguments local res = "" -- Identify the arguments of the previous template. -- Repérer les arguments de l'ancien modèle. p.gener_oldargs(args_final) if CA.option("testable") then -- local contenu = p.unit_tests( "args_final ", args_final) res = res .. CA.dropdown_box(1, "Détails des tests unitaires pour éviter les régressions : ", contenu) -- local contenu = CA.testable_args(CA.args_source, "CA.args_source") res = res .. CA.dropdown_box(1, "Détails de la table des arguments reçus. ", contenu) -- local contenu = CA.testable_args(CA.args_known, "CA.args_known") res = res .. CA.dropdown_box(1, "Détails des arguments connus : args_known : ", contenu) -- local contenu = CA.testable_args(CA.i18n, "CA.i18n") res = res .. CA.dropdown_box(1, "Détails des tables de traductions : i18n ", contenu) -- local contenu = CA.verif_i18n() res = res .. CA.dropdown_box(1, "Vérifier la cohérence des tables de traductions : ", contenu) -- end if CA.option("trackon") then -- local contenu = CA.track_read() -- res = res .. CA.dropdown_box(1, "\n* Trace détaillée. Detailed track : ", contenu) res = res .. CA.tested_options_list() res = res .. CA.debug_traceback() end return res end -- function p.gener_tests(args_final) function p.init_tests(args_src) if type(args_src) ~= "table" then args_src = CA.args_src end -- optional arguments --[[ if lang == "en" then args_src = ArgtestEN end if lang == "es" then args_src = ArgtestES end if lang == "fr" then args_src = ArgtestFR end if not args_src.debug then args_src.debug = "docdata docdef docavant docligne trackon" end --]] if not args_src.description then args_src.description = "Victor Hugo est très connu." end if not args_src.genre then args_src.genre = "Romanciers/Poètes/Auteurs de théatre" end if not args_src.language then args_src.language = "français/japonais" end if not args_src.occupation then args_src.occupation = "Académiciens/Personnalités politiques" end if not args_src.prize then args_src.prize = "Nobel de littérature/Pulitzer" end if not args_src.wikipedia then args_src.wikipedia = "Alain Fournier" end if not args_src.wikiquote then args_src.wikiquote = "Charles Beaudelaire" end if not args_src.commons then args_src.commons = "Victor Hugo" end --if not args_src.LCCN then args_src.LCCNid = "n/50/23101" -- LCCN = n/50/23101 = Alain Fournier return end -- function p.init_tests(args_src) -- relire ControlArgs/Auteur : module code in english ------------------------------------------------------------ -- Arguments sources exemples ------------------------------------------------------------ local ArgtestEN = { c=": debug wikidata docavant docdef docligne docapres erron interon data-on test-on i18non ", --bug6 local ArgtestEN = { c=": docdef docligne docapres ", lastname = "Pierre Yves-André de La Fontaine", rights = "non", image = "Carjat Arthur Rimbaud 1872 n2.jpg", birthyear = "before 1793", deathyear = "1950", region = "chine", description = "French poet.", genre = "Poètes", Prize = "Goncourt", prizze = "Lauréats du Prix Goncourt", occupation = "Idéologues/Personnalités politiques", language = "Littérature bretonne", BNF = "cb11888266r" } local ArgtestES = { c=": debug wikidata docavant docdef docligne docapres erron interon data-on test-on i18non ", --bug6 local ArgtestES = { c=": docdef docligne docapres ", nom = "Pierre Yves-André de La Fontaine", droits = "non", image = "Carjat Arthur Rimbaud 1872 n2.jpg", anneeNaissance = "antes 1793", anneeDeces = "1950", ["región"] = "chine", description = "Poeta francés", Pris = "Goncourt", genre = "Poètes", metier = "Idéologues/Personnalités politiques", prix = "Lauréats du Prix Goncourt", langue = "Littérature bretonne", BNF = "cb11888266r" } local ArgtestFR = { c=": debug wikidata docavant docdef docligne docapres erron interon data-on test-on i18non ", --bug6 local ArgtestFR = { c=": docdef docligne docapres ", nom = "Pierre Yves-André de La Fontaine", droits = "non", image = "Carjat Arthur Rimbaud 1872 n2.jpg", anneeNaissance = " 1793", anneeDeces = "1950", ["région"] = "chine", description = "Poète français.", Pris = "Goncourt", genre = "Poètes", metier = "Idéologues/Personnalités politiques", prix = "Lauréats du Prix Goncourt", langue = "Littérature bretonne", BNF = "cb11888266r" } -- ARCid = "R457-J-44", BNF = "45274126861", DNB = "3684200072", GKD = "71yhjey852", IBLid = "37581257954" -- BNF = cb11888266r = Alain Fournier -- LCCN = n/50/23101 = Alain Fournier -- = http://www.worldcat.org/identities/lccn-n50-23101 -- NLA = 35096649 = Alain Fournier -- PND = 11850133X = Alain Fournier -- VIAF = 7396281 = Arthur Rimbaud -- VIAF = 34452139 = Alain Fournier -- worldcat = 35096649 = Happy Gilmore -- relire ControlArgs/Auteur : module code in english ------------------------------------------------------------ -- Main interface to templates -- Interfaz principales de modelos -- Interface principal avec les modèles ------------------------------------------------------------ function p.base(frame, function_mode, debug_options) local res = "" Interprojet.interprojet( frame ) CA.time1 = os.clock() CA.frame = frame CA.module_name = CA.frame:getTitle() -- example "Auteur" local lang = tostring(mw.language.getContentLanguage().code) local args_invoke = frame.args local args_template = frame:getParent().args -- local x, template_ni, template_nn = CA.table_mixer(args_template) local y, invoke_ni, invoke_nn = CA.table_mixer(args_invoke) -- Remplacer ou ajouter tous les champs du modèle à ceux du module. local args_src, args_src_ni, args_src_nn = CA.table_mixer(args_invoke, args_template) -- -- mode = mode_name get priority from: -- 1: argument mode from template {{Auteur|mode=doc|...}}} -- 2: else argument 1 from template {{Auteur|doc|...}}} -- 3: else argument mode from the module {{#invoke:Auteur|base|mode=doc|...}} -- 4: else fonction from the module {{#invoke:Auteur|doc|...}} -- 5: else normal as default local mode_name = "normal" -- 5: normal as default if type(function_mode) == "string" then mode_name = function_mode end -- 4: function from the module local t0 = CA.init_lang() local mode_lang = CA.wiki_args["mode"] if mode_lang and type(args_invoke[mode_lang]) == "string" then mode_name = args_invoke[mode_lang] end -- 3: argument mode from the module if args_src[1] and type(args_src[1]) == "string" then mode_name = args_src[1] end -- 2: argument 1 from the template if mode_lang and type(args_src[mode_lang]) == "string" then mode_name = args_src[mode_lang] end -- 1: argument mode from the template CA.mode_name = mode_name -- if mode_name == "doc" then debug_options = " : docdef docavant docligne docdata" elseif mode_name == "notice" then debug_options = "noerr nocat" elseif mode_name == "oldargs" then debug_options = "noerr nocat" elseif mode_name == "tests" then debug_options = " : docdef docavant docligne docdata testable trackon" else mode_name = "normal" ; debug_options = "noerr nocat" end -- local function_res = "\n" .. CA.module_name .. ":" .. mode_name .. ":" .. lang .. " " -- function_res = function_res .. CA.str_vars(" fn=%1 invoke_nn=%2 template_nn=%3 args_src_nn=%4", mode_name, invoke_ni+invoke_nn, template_ni+template_nn, args_src_ni+args_src_nn) if mode_name == "doc" or mode_name == "tests" then res = res .. "<br/>" .. function_res end -- CA.invoke_options = args_src.c CA.debug_options = debug_options -- if mode_name == "tests" then res = res .. function_res CA.trc = "\n* CA.tests : Traces du module." p.init_tests(args_src) end -- local lang = nil local t0 = CA.init_lang(lang) -- Initialisations des tables de langues local xx, t1 = CA.add_i18n(CA.i18n_args) local xx, t2 = CA.add_i18n("ControlArgs/I18N") local xx, t3 = CA.add_i18n(p.i18n_Auteur) local xx, t4 = CA.add_i18n("Auteur/I18N") -- if mode_name == "tests" then if CA.i18n and CA.i18n.en then CA.i18n.es.error_i18n_wanted = 'EN error wanted' end if CA.i18n and CA.i18n.es then CA.i18n.es.error_i18n_deseada = 'ES error deseada' end if CA.i18n and CA.i18n.fr then CA.i18n.fr.error_i18n_voulue = 'FR erreur voulue' end res = res .. CA.table_compte("i18n") end CA.init_args( p.args_known_auteur, args_src) -- -- Adapter wikidata au module local args_wikidata, t = CA.import_wikidata(CA.args_known) -- p.args_known p.args_known_auteur p.wikidata_properties -- res = res .. t local args_import, t = CA.control_arguments(CA.args_known, lang) -- , i18n_fr, args_src, p.args_known_auteur -- Interactions entre parametres et doc (exemples : titre = prenom+nom, l'initiale vient du nom) local args_final = p.interact_args_final(args_import) args_final.LCCNid = "n/50/23101" CA.time2 = os.clock() -- if mode_name == "notice" then -- Generate autority notices. Generer la ou les notices. res = res .. p.gener_notices(CA.args_known, CA.args_final) elseif mode_name == "oldargs" then -- Identify the special arguments of the previous template. -- Repérer les arguments spéciaux de l'ancien modèle. CA.category_list = { } CA.args_final = { } p.gener_oldargs(args_final) res = res .. CA.categ_lister() -- categories in wikitext else -- Generer normalement le wikitexte, les categories, la documentation et autres res = res .. p.gener_result(args_final) -- res = res .. p.wikidata_test("<br/><br/>\n* Test de '''wikidata''', données centralisées des wikipedia : ") end -- CA.time3 = os.clock() -- Tests et traces très détaillés res = res .. p.gener_tests(args_final) CA.time4 = os.clock() if CA.option("testable") or CA.option("debug") or CA.option("trackon") then res = res .. "\n*" .. CA.tests_time(true, "") end if mode_name == "tests" then res = res .. function_res end return res -- Execution and test time : 2013-10-24 23:47:36 UTC , url = http://test2.wikipedia.org/wiki/Victor_Hugo , -- start = 5703 mS , import + 690 mS , generate page + 1 mS , tests + 3046 mS Auteur:tests end -- function p.base(frame, function_mode, debug_options) ------------------------------------------------------------ -- Interfaces, alias and functions to templates -- Interfaces, alias y funciones para modelos -- Interfaces, allias et fonctions pour les modèles ------------------------------------------------------------ ------------------------------------------------------------ -- Normal interface ------------------------------------------------------------ -- Select the function from #invoke:module|function|... -- Seleccione la función a partir de #invoke:module|function|... -- Sélectionner la fonction à partir de #invoke:module|function|... function p.normal(frame) local res = p.base(frame, "normal", "noerr nocat") return res end -- function p.normal(frame) function p.doc(frame) local res = p.base(frame, "doc", " : docdef docavant docligne") return res end -- function p.normal(frame) function p.tests(frame) local res = p.base(frame, "tests", " : docdef docavant docligne docdata testable trackon") return res end -- p.tests(frame) function p.oldargs(frame) local res = p.base(frame, "oldargs", "noerr nocat") return res end -- p.oldargs(frame) ------------------------------------------------------------ -- Notices interface ------------------------------------------------------------ -- Interface to generate independent authority instructions over a person, a book or other. -- Interfaz para generar autoridad independiente instruccione sobre una persona, un libro u otro. -- Interface pour générer une notice d'autorité indépendante sur une personne, un livre ou autre. function p.instructions(frame) return p.notice(frame) end function p.instrucciones(frame) return p.notice(frame) end function p.notices(frame) return p.notice(frame) end function p.notice(frame) local res = p.base(frame, "notice", "docdata docdef docavant docligne") return res end -- p.notice(frame) return p