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

Contenu supprimé Contenu ajouté
ModuleCentralizer restore a valid events library OK
ModuleCentralizer datas.get_item_report(t) better on 20181204 2128.lua
Ligne 1 :
local p = {} -- The main central module install central libraries and bind the main and its sub-modules
local Central = p -- Save as ModuleCentralizer.lua ModuleCentralizer updatedatas.get_item_report(t) Levenshteinbetter diffmaxi=0.30*length+0.82on ok20181204.lua
--------------------------------------------------|------------------------ typical length --------------------------|
 
p.NOWNOW = { -- in work subtasks for replace on 20181203
-- For Begin, why errors ? how to debug ? translate already done :["contentlang"], pagelang, userlang, QITEM.
{ "20181204", "20181207", "todo", "Rical", "S181125CrC", "Module:CentralSchool: finish reciprocal adaptation with Module:Centralizer", },
-- Already checked : declarations types ["need"] = 0, where and how detect errors ...
-- { "20181204", "20181204", "todo", "Rical", "S181204SCi", "For 'Begin' function modes.get_args_datas(args_known) Simplify Central.init" },
-- Try to check exactly these points ... ?
-- { "20181203", "20181204", "todo", "Rical", "S181203mad", "For 'Begin' rename function modes.get_args_datas( to modes.get_mode_args_datas( To simplify Central.init" },
-- For Begin try, for all libaries to all the sub modules and the main module, the function modes.mix_args(mix, mode_name, args_template) -- Mix arguments from options_for_modes, args_template
{ "20181203", "20181203", "todo", "Rical", "S181203amt", "arg mises of translation try en=50%, es=7%, de=6%, fr=4% see Wivivi: In which language do you read Wikipedia?" },
-- Save as ModuleCentralizer try modes.mix_args for translate content pagelang...lua
{ "20181203", "20181203", "todo", "Rical", "S181203oTc", 'others: ["Tactic"] = "canbenil;nevererror" ', },
-- See the documentation in: MediaWiki:Scribunto/Central_modules_reference_manual
{ "20181130", "20181203", "NOW", "Rical", "S181130mgT", "function modes.get_args_datas_tests(t) Tactic all in one for modes args datas no args_final no origins" },
{ "20181203", "20181203", "todo", "Rical", "S181203ust", "Module:Centralizer update subtasks list", },
}
 
p.version = { -- Modules dependencies. Dependencias del módulo. Dépendances du module.
["versionName"] = "Central-s-fr",
["versionNumber"] = "1.0.0(181023T07181204T18:4552)",
["versionDate"] = "20181023T072018-12-04T18:4552:00", -- UTC version structure MWMW NOWNOW
["mainDescription"] = "Begin to use",
["functionDescription"] = "first functional support",
Ligne 25 ⟶ 28 :
{ "Mathroman22", "Mathroman34" }, -- lower
}
}
} -- Task details : ...() from 2018-07-28 = for 14 days.
Central.Central_version_name = Central.version.versionName
-- https://www.MediaWiki.org/wiki/Module:drop_box https://fr.wikisource.org/wiki/Module:drop_box
Central.Central_version = Central.version.versionName
p.ModuleNS = mw.site.namespaces.Module.name .. ":" -- translate Module: in other languages
 
Ligne 33 ⟶ 35 :
 
-- - - - ------------------ - - - - ----------------- - - - - -----------------------------
-- Development guide lineTactic on 20180905
-- A central module could need a translation service and a versioning service to enhance its functions or its stability without disturbing the preview normal use.
-- A main module can define its sought sub-modules versions names and its known sub-modules versions names.
Ligne 48 ⟶ 50 :
-- To avoid conflict of translations keys between libraries, all translations keys names start with the library name.
--
-- GuidelineTactic for modules, arguments, options and default values 20180908.
-- In all cases the main module protects all original tables, including for itself.
-- Permit modules without versions for many existing modules. Modules are also simply tables for data-modules or PageData in Json.
Ligne 75 ⟶ 77 :
modes = {} -- Library:modes from arguments support on 20130125 in Module:Author, 20130312 in Module:ControlArgs
central_library = {} -- Object:central_library from versions.central_library on 20171211 in Module:Centralizer
-- p_template_drop_box_name = 'Cuadro desplegable', -- Equivalent templates exist in other wikis
-- p_template_drop_box_name = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.form. delete all function tables.
-- p_template_drop_box_name = 'Drop-down box', -- Template: Drop-down box for drop_box.form
-- p_template_drop_box_name = 'Cuadro desplegable', -- Modelo: cuadro desplegable :Boîte déroulante for drop_box.form
tableview = {} -- Object:tableview from 20170208
tab_view = {} -- Object:tab_view from 20170208
Ligne 942 ⟶ 940 :
end -- function activity.central_libraries_autodoc(t, sorted_functions)
 
activity.report_subtasks_list = { -- List of subtasks to report. See "NOWNOWNOW", update
-- Begin later below
--loadData
-- DUPLICATE NOWNOW, in change. toDoc
{ "---", "---", "---", "---", "---", "DUPLICATE NOW, in change", },
{ "20181101", "20181101", "NOW", "Rical", "S181101tgl", "Begin: translate by groups of languages : like for viet, laos, cambodgia, allways with en, es, fr 1 days", },
{ "20181101", "20181101", "NOW", "Rical", "S181101aip", "Begin: when 10 used cases, announce that in the phabtask, then when 20, then for xmas 1 days", },
{ "20181023", "20181030", "NOW", "Rical", "S181023s7P", "Begin: search 7 Projects : MediaWikis wikidata wikipedia wikisource wikiquote ? 3 days", },
{ "20181023", "20181030", "NOW", "Rical", "S181023iLC", "Begin: Rical invite 7 Lua-coders : Tpt, Zolo, Od1n, Julien1978, Daehan, VIGNERON ? 3 days", },
{ "20181020", "20181022", "NOW", "Rical", "S181020umf", "update MediaWiki:Scribunto/Central manual for ;activity.phabricator_tasks_report;activity.rough_date_days;...", },
{ "20181020", "20181022", "NOW", "Rical", "S181020aec", "For 'Begin' function events.add_err+add_cat comfrom depends need=0 1 2 prop+prop_defaut.", },
{ "20181018", "20181020", "NOW", "Rical", "S181018CrC", "Module:CentralSchool: finish reciprocal adaptation with Module:Centralizer", },
{ "20181016", "20181017", "NOW", "Rical", "S181016vap", "restore versions.anti_crash(frame) if not pcall() recursive in versions.tree_branch='v1;v2;v3' ", },
{ "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_arg has a arg_default in p.known_args and a .delete = 'delete' ", },
{ "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_data has a data_default in datas.known_datas and a .delete = 'delete' ", },
{ "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_mode has a mode_default in modes.known_modes and a .delete = 'delete' ", },
{ "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_version has a version_default in versions.version_args and a .delete = 'delete' ", },
-- function versioning.antiCrash(options, content_or_func, ...) -- Form the display of a running error. in ModuleCentral 20170902.ModuleCentral 2e no antiCrash ok.lua
{ "2018101420190208", "2018101420190210", "NOWtodo", "Rical", "S181014uftS190201ime", "updateinclude functionLua tab_view.form_one_casemodules +in translate from multiple_selection_test1(Wikibase/client/includes/DataAccess/Scribunto/mw.wikibase.lua, see phabtask T41610.", },
{ "2018101420190207", "2018101420190208", "NOWtodo", "Rical", "S181014uftS190128cCD", "updateCreate functionMediaWiki:Scribunto/CentralData tab_view.form_one_case(change +from translateadmin from recursive_normal_test1(...only)", },
{ "2018101420190105", "2018101420190207", "NOWtodo", "Rical", "S181014uptS190126cCD", "updateCreate activity.phabricator_tasks_reportCentral/PageData/CentralData (change from any user)", },
-- see 4.2 Paramètre "wikidata" https://fr.wikipedia.org/wiki/Aide:Infobox_en_Lua#Param.C3.A8tre_.22wikidata.22
{ "20181014", "20181014", "NOW", "Rical", "S181014ust", "Module:Centralizer update subtasks list", },
{ "20190124", "20190126", "todo", "Rical", "S190124bob", "Create a button object for boxes, like drop_box with: n, states, shapes, keywords, colors", },
{ "20190122", "20190124", "todo", "Rical", "S190122tbe", "restructure for a structure in Table of Box Elements in viewers.boxviews.form()", },
{ "20190122", "20190122", "todo", "Rical", "S190122dut", "delete unused tracker in _G : ARGS, IAMO, MAMO, tests_groups", },
{ "20190120", "20190122", "todo", "Rical", "S190120vtg", "try graphics in viewers.try_graph() -- see Macron", },
{ "20190117", "20190120", "todo", "Rical", "S190117obv", "make object viewers.boxviews.form(cssView)", },
{ "20190115", "20190117", "todo", "Rical", "S190115mMW", "use Special:PageData CentralData T163923+T168726 in activity.MW_Versions_report()", },
{ "20190114", "20190115", "todo", "Rical", "S190114eli", "easy https://en.wikisource.org/wiki/Template:Lorem_ipsum", },
{ "20190112", "20190114", "todo", "Rical", "S190112acr", "debug versions.anti_crash() using pcall in modes(frame) + tests", },
{ "20190110", "20190112", "todo", "Rical", "S190110uPD", "automatize PageData change in datas.update_PageData(t) for activity.MW_Versions_report() IF AVAILABLE", },
{ "20190109", "20190110", "todo", "Rical", "S190109tac", "langs.abnormal_char_in_text() fails", },
{ "20190106", "20190109", "todo", "Rical", "S190106css", "use Conventional css parameters cssview in edit, content, drop_box, infobox, tableview ... ", },
{ "20190106", "20190106", "todo", "Rical", "S190106FLI", "Propose to use existant Initial in wikidata. No matter the result.", },
{ "20190104", "20190106", "todo", "Rical", "S190104uMD", "After 'Begin' fully use Module:drop_box from es.wikipedia.org/wiki/Módulo:Lista_plegable", },
{ "20190103", "20190104", "todo", "Rical", "S190103ilp", "After 'Begin' T20180621 Enough inform Central modules for jumps to lang.project URI.", },
{ "20190102", "20190103", "todo", "Rical", "S190102alp", "After 'Begin' T20180621 Automatic adapt Central modules for lang.project URI.", },
{ "20190101", "20190102", "todo", "Rical", "S190101rlv", "After 'Begin' Fully report modules and libraries versions.", },
{ "20181231", "20190101", "todo", "Rical", "S181231ruc", "After 'Begin' report all viewers.usual_color(t)", },
{ "20181230", "20181231", "todo", "Rical", "S181230vdf", "debug function versions.deprecated_function() nil table : mask it on 20180306", },
{ "20181228", "20181228", "todo", "Rical", "S181228tva", "Use tableview.new() for all tables, search .table_end()", }, --
{ "20181226", "20181228", "todo", "Rical", "S181226icc", "Begin: begin to integrate changes from other coders", },
{ "20181225", "20181226", "todo", "Rical", "S181225icc", "Begin: update important Phabricator tasks to activate their availability", },
{ "20181225", "20181225", "todo", "Rical", "S181225cJP", "Begin: informs public Lua-coders Utilisateur:JackPotte [[:fr:Utilisateur:JackPotte|JackPotte fr de es en]]", },
{ "20181225", "20181225", "todo", "Rical", "S181225iTN", "Begin: inform [https://meta.wikimedia.org/wiki/Tech/News#contribute Tech News] about central modules begin phase", },
{ "20190103", "20190104", "todo", "Rical", "S181224tgl", "Begin: translate by groups of languages : like for viet, laos, cambodgia, allways with en, es, fr 1 days", },
{ "20190101", "20190102", "todo", "Rical", "S181224atr", "Begin: Ask translations in meta [https://meta.wikimedia.org/wiki/Translation_requests Translation_requests]", },
{ "20181225", "20190101", "todo", "Rical", "S181217aip", "Begin: when 20 used cases, announce that in the phabtask", },
{ "20181218", "20181225", "todo", "Rical", "S181210aip", "Begin: when 10 used cases, announce that in the phabtask", },
{ "20181211", "20181218", "todo", "Rical", "S181202s7P", "Begin: search 7 Projects : MediaWikis wikidata wikipedia wikisource wikiquote ? 3 days", },
{ "20181211", "20181218", "todo", "Rical", "S181202iLC", "Begin: Rical invite 7 Lua-coders : Tpt, Zolo, Od1n, Julien1978, Daehan, VIGNERON ? 3 days", },
{ "20181209", "20181211", "todo", "Rical", "S181206uCM", "For 'Begin' update CentralManual.xml Guideline to Tactic, func names ..." },
{ "20181207", "20181209", "todo", "Rical", "S181204tmm", "For 'Begin' check all args, datas, functions, modes, tests", },
{ "20181204", "20181207", "todo", "Rical", "S181125CrC", "Module:CentralSchool: finish reciprocal adaptation with Module:Centralizer", },
{ "20181203", "20181204", "todo", "Rical", "S181203mad", "For 'Begin' function modes.get_mode_args_datas(args_known) -- To simplify Central.init" },
{ "20181203", "20181203", "todo", "Rical", "S181203amt", "arg mises of translation try en=50%, es=7%, de=6%, fr=4% see Wivivi: In which language do you read Wikipedia?" },
{ "20181203", "20181203", "todo", "Rical", "S181203oTc", 'others: ["Tactic"] = "canbenil;nevererror" ', },
{ "20181130", "20181203", "NOW", "Rical", "S181130mgT", "function modes.get_args_datas_tests(t) Tactic all in one for modes args datas no args_final no origins" },
{ "20181203", "20181203", "todo", "Rical", "S181203ust", "Module:Centralizer update subtasks list", },
--
-- Automatic shift of below "todo" subtasks.
{ "---", "---", "---", "---", "---", "Automatic shift of below todo subtasks", },
{ "20180108", "20180109", "todo", "Rical", "S180108wtd", "Restore old function datas.wikidata_time_details()", },
{ "20180108", "20180109", "todo", "Rical", "S180108blg", "For each wikidata search the better lang in userlang, userlang2, pagelang, contentlang", },
{ "20180106", "20180108", "todo", "Rical", "S180106arg", "new Object:args form known arguments to import, complete from datas and finalize", },
{ "20171019", "20171022", "todo", "Rical", "S171019ime", "include Lua modules in extensions like Wikibase/client/includes/DataAccess/Scribunto/mw.wikibase.lua, see phabtask T41610.", },
{ "20171015", "20171018", "todo", "Rical", "S171015trk", "add a method tracker:trk(self, ...) from tracker.add(opt, ...). see Lua_reference_manual#Function_declaration_statements", }, --
{ "20171001", "20171002", "todo", "Rical", "S170801cvG", "put MW versions and Central versions in _G and CentralData", },
Ligne 998 ⟶ 1 014 :
{ "20170811", "20170815", "todo", "Rical", "S170718FLI", "lua_table.4_diffs(A, B) Detect 4 first diffs of tables A/B and B/A, in-deep/in-next with limits", },
{ "20170811", "20170815", "todo", "Rical", "S170811uMD", "After 'Begin' fully use Module:drop_box from es.wikipedia.org/wiki/Módulo:Lista_plegable", },
-- S170718FLI : in https://www.wikidata.org/wiki/Wikidata:Property_proposal/Person#Noms().", },
-- S170718FLI : T53657 is Close : Firstname and Lastname properties
-- S170718FLI : T53657 to re Open : Firstname and Lastname properties. Follow Aklapper comment on Jul 19 2013, 12:51
{ "20170810", "20170811", "todo", "Rical", "S180311a2c", "if _i_cat or _u_cat add 2 categories: detailed and ( internal or usage )", },
-- if viewers.is_in("_i_cat", key) then key = "versions_with_internal_error" -- = "Module with internal error",
-- elseif viewers.is_in("_u_cat", key) then key = "versions_with_usage_error" -- = "Module with usage error",
{ "20170810", "20170811", "todo", "Rical", "S180810lts", "continue function lua_table.to_sort(tab, ...) To convert any table in sequence, and sort it.", },
{ "20180410", "20180414", "todo", "Rical", "S180410ilp", "After 'Begin' T20180621 Enough inform Central modules for jumps to lang.project URI.", },
{ "20180410", "20180414", "todo", "Rical", "S180410alp", "After 'Begin' T20180621 Automatic adapt Central modules for lang.project URI.", },
Ligne 1 015 ⟶ 1 024 :
{ "20170808", "20170810", "todo", "Rical", "S170707icc", "Begin: begin to integrate changes from other coders", },
{ "20170808", "20170810", "todo", "Rical", "S170707icc", "Begin: update important Phabricator tasks to activate their availability", },
{ "20181209", "20181209", "todo", "Rical", "S170702cJP", "Begin: informs public Lua-coders Utilisateur:JackPotte [[:fr:Utilisateur:JackPotte|JackPotte fr de es en]]", },
-- Inform after 'Create Begin'
{ "2017080520181209", "2017080720181209", "todo", "Rical", "S170702cJPS170702atr", "Begin: Lua-codersAsk Utilisateur:JackPottetranslations in meta [[https:fr:Utilisateur:JackPotte|JackPotte fr de es//meta.wikimedia.org/wiki/Translation_requests en]Translation_requests]", },
{ "2017080520181209", "2017080720181209", "todo", "Rical", "S170702wvmS181209iTN", "Begin: announce Meet coders throught Wikis video meeting France SWEL-frinform [https://meetmeta.jitwikimedia.siorg/swel-frwiki/Tech/News#contribute Tech News] about central modules begin phase", },
{ "20170805", "20170807", "todo", "Rical", "S170702atr", "Begin: Ask translations in meta [https://meta.wikimedia.org/wiki/Translation_requests Translation_requests]", },
{ "20170805", "20170807", "todo", "Rical", "S170604iTN", "Begin: inform [https://meta.wikimedia.org/wiki/Tech/News#contribute Tech News] about central modules begin phase", },
-- S170604iTN : Tech/News#contribute : central, begin to use, efficiency, ask lua coders ?
-- Debug to support Create Begin's group
Ligne 1 025 ⟶ 1 032 :
-- Begin later behind
--
-- NOWNOW DP, NOW, in change
{ "---", "---", "---", "---", "---", "NOW, in change", },
{ "20181101", "20181101", "NOW", "Rical", "S181101tgl", "Begin: translate by groups of languages : like for viet, laos, cambodgia, allways with en, es, fr 1 days", },
{ "20181101", "20181101", "NOW", "Rical", "S181101aip", "Begin: when 10 used cases, announce that in the phabtask, then when 20, then for xmas 1 days", },
{ "20181023", "20181030", "NOW", "Rical", "S181023s7P", "Begin: search 7 Projects : MediaWikis wikidata wikipedia wikisource wikiquote ? 3 days", },
{ "20181023", "20181030", "NOW", "Rical", "S181023iLC", "Begin: Rical invite 7 Lua-coders : Tpt, Zolo, Od1n, Julien1978, Daehan, VIGNERON ? 3 days", },
{ "20181020", "20181022", "NOW", "Rical", "S181020umf", "update MediaWiki:Scribunto/Central manual for ;activity.phabricator_tasks_report;activity.rough_date_days;...", },
{ "20181020", "20181022", "NOW", "Rical", "S181020aec", "For 'Begin' function events.add_err+add_cat comfrom depends need=0 1 2 prop+prop_defaut.", },
{ "20181018", "20181020", "NOW", "Rical", "S181018CrC", "Module:CentralSchool: finish reciprocal adaptation with Module:Centralizer", },
{ "20181016", "20181017", "NOW", "Rical", "S181016vap", "restore versions.anti_crash(frame) if not pcall() recursive in versions.tree_branch='v1;v2;v3' ", },
{ "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_arg has a arg_default in p.known_args and a .delete = 'delete' ", },
{ "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_data has a data_default in datas.known_datas and a .delete = 'delete' ", },
{ "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_mode has a mode_default in modes.known_modes and a .delete = 'delete' ", },
{ "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_version has a version_default in versions.version_args and a .delete = 'delete' ", },
-- function versioning.antiCrash(options, content_or_func, ...) -- Form the display of a running error. in ModuleCentral 20170902.ModuleCentral 2e no antiCrash ok.lua
{ "20181014", "20181014", "NOW", "Rical", "S181014uft", "update function tab_view.form_one_case + translate from multiple_selection_test1(...", },
{ "20181014", "20181014", "NOW", "Rical", "S181014uft", "update function tab_view.form_one_case + translate from recursive_normal_test1(...", },
{ "20181014", "20181014", "NOW", "Rical", "S181014upt", "update activity.phabricator_tasks_report", },
{ "20181014", "20181014", "NOW", "Rical", "S181014ust", "Module:Centralizer update subtasks list", },
-- Already done
{ "---", "~-sort~-", "---", "---", "---", "Already done", },
{ "20170810", "20170811", "done", "Rical", "S180311a2c", "if _i_cat or _u_cat add 2 categories: detailed and ( internal or usage )", },
{ "20181014", "20181014", "done", "Rical", "S181014uft", "update function tab_view.form_one_case + translate from multiple_selection_test1(...", },
{ "20180824", "20180825", "done", "Rical", "S180824iCD", "in activity.begin_central_modules_support() header namespace and local links.", },
{ "20180730", "20180730", "done", "Rical", "S180730ust", "Module:Centralizer update subtasks list", },
Ligne 1 068 ⟶ 1 058 :
{ "20180604", "20180604", "done", "Rical", "S180604crm", "For 'Begin' T20180604 Update Central modules reference manual. DONE", },
{ "20180518", "20180518", "done", "Rical", "S180518ust", "Module:Centralizer update subtasks list", },
{ "20180421", "20180421", "done", "Rical", "S180421CGL", "For 'Begin' renew CentralGuidelineCentral Tactic from CentralModules and CentralManual", },
{ "20180419", "20180420", "done", "Rical", "S180419aCv", "add Central version in running_times", },
{ "20180414", "20180414", "done", "Rical", "S180414ust", "Module:Centralizer update subtasks list", },
Ligne 1 176 ⟶ 1 166 :
-- T135845 : For this goal they need to join a standard template with the central module.
-- T135845 : But the MediaWiki security prohibit them in Lua modules. Then the deployment must do these.
{ 114, "Important", "20181101", "T208437", 0, "Open", "Consolidate and migrate Module namespace to Commons", },
{ 116, "Important", "20160822", "T53660", 0, "Open", "Detect the edit state for modules which help users and helpers", },
{ 118, "Important", "20180806", "T4085", 0, "Open", "Add a {{USERLANGUAGE}}/{{USERLANG}} magic word", },
Ligne 1 550 ⟶ 1 541 :
datas_update_Special_PageData_header = "site; temps de version; identificateur de version; heure de vue",
datas_get_item_report_title = "datas.get_item_report() Rapporte les données de mw.wikibase pour la page ou tout autre élément.",
datas_get_item_report_headers = "mot-clé; type; propriété; défaut; valeur"; -- br
-- Messages et erreurs divers
datas_no_args_Wikidata_err = "Erreur interne : Module sans table d'arguments Wikidata.",
Ligne 1 577 ⟶ 1 569 :
datas_update_Special_PageData_header = "Ort; Versionszeit; Versionskennung; Stunde der Sicht",
datas_get_item_report_title = "datas.get_item_report() Gibt mw.wikibase-Daten für die Seite oder einen anderen Artikel aus.",
datas_get_item_report_headers = "Stichwort; Art; Eigentum; Standard; Wert"; -- de
-- Verschiedene Nachrichten und Fehler
datas_no_args_Wikidata_err = "Interner Fehler: Modul ohne Wikidata-Argumenttabelle.",
Ligne 1 584 ⟶ 1 577 :
-- To translate, referral languages are English and French.
-- To translate, do not translate parts like these: <b>%1</b> ; <b>%1</b> = <b>%2</b> (%3) ; <code>Q535</code> ; <br/> ; \n* ; _G.
args_known_countrymw_wikibase_country = "England", -- English
args_known_flag mw_wikibase_flag = "Flag_of_EnglandEngland in the UK and Europe.svg", -- English
args_known_monument mw_wikibase_monument = "St_Pauls_aerial_%28cropped%29St Paul Cathedral.jpgpng", -- English St Paul's Cathedral
args_known_town mw_wikibase_town = "London", -- English
datas_Wikidata_header = "Datas: ",
datas_known_Datas_header = "Known datas: ",
Ligne 1 608 ⟶ 1 601 :
datas_update_Special_PageData_header = "site; version time; version identifier; seen hour",
datas_get_item_report_title = "datas.get_item_report() Reports datas from mw.wikibase for the page or any other item.",
datas_get_item_report_headers = "keyword; type; property; default; value"; -- en
-- Miscellaneous warnings and errors
datas_no_args_Wikidata_err = "Error: Module without Wikidata arguments table.",
Ligne 1 616 ⟶ 1 610 :
-- Para traducir, no traduzca partes como estas: <b>%1</b> ; <b>%1</b> = <b>%2</b> (%3) ; <code>Q535</code> ; <br/> ; \n* ; _G.
-- Wikidata
args_known_countrymw_wikibase_country = "España", -- Spanish
args_known_flag mw_wikibase_flag = "Flag_of_Spain.svg", -- Flag of SpainSpanish
args_known_monument mw_wikibase_monument = "MADRID_100206_UDCI_023Panorama_Madrid_Ayuntamiento_20090417.jpg", -- Puerta del SolSpanish
args_known_town mw_wikibase_town = "Madrid", -- Capital citySpanish
datas_Wikidata_header = "Datos: ",
datas_known_Datas_header = "Datos conocidas: ",
Ligne 1 639 ⟶ 1 633 :
datas_update_Special_PageData_header = "sitio; tiempo de versión; identificador de versión; tiempo visto",
datas_get_item_report_title = "datas.get_item_report() Informes de datos de mw.wikibase para la página o cualquier otro elemento.",
datas_get_item_report_headers = "palabra clave; tipo; propiedad; defecto; valor"; -- es
-- Diversos mensajes y errores
datas_no_args_Wikidata_err = "Error: Módulo sin argumentos Wikidata tabla.",
Ligne 1 647 ⟶ 1 642 :
-- Pour traduire, ne traduisez pas des parties comme celles-ci : <b>%1</b> ; <b>%1</b> = <b>%2</b> (%3) ; <code>Q535</code> ; <br/> ; \n* ; _G.
-- Wikidata
args_known_countrymw_wikibase_country = "France", -- French
args_known_flag mw_wikibase_flag = "Flag_of_Franceflag of France.svg.png", -- French
args_known_monument mw_wikibase_monument = "Tour Eiffel", -- French
args_known_town mw_wikibase_town = "Paris", -- French
datas_Wikidata_header = "Données : ",
datas_known_Datas_header = "Données connues : ",
Ligne 1 671 ⟶ 1 666 :
datas_update_Special_PageData_header = "site; temps de version; identificateur de version; heure de vue",
datas_get_item_report_title = "datas.get_item_report() Rapporte les données de mw.wikibase pour la page ou tout autre élément.",
datas_get_item_report_headers = "mot-clé; type; propriété; défaut; valeur"; -- fr
-- Messages et erreurs divers
datas_no_args_Wikidata_err = "Erreur interne : Module sans table d'arguments Wikidata.",
Ligne 1 698 ⟶ 1 694 :
 
datas_get_item_report_title = "datas.get_item_report() Rapporte les données de mw.wikibase pour la page ou tout autre élément.",
datas_get_item_report_headers = "kulcsszó; típus; ingatlan; alapértelmezett; érték"; -- hu
-- Messages et erreurs divers
datas_no_args_Wikidata_err = "Erreur interne : Module sans table d'arguments Wikidata.",
Ligne 1 725 ⟶ 1 722 :
datas_update_Special_PageData_header = "địa điểm; thời gian phiên bản; định danh phiên bản; thấy giờ",
datas_get_item_report_title = "datas.get_item_report() Báo cáo dữ liệu mw.wikibase cho trang hoặc bất kỳ mục nào khác.",
datas_get_item_report_headers = "từ khóa; kiểu; bất động sản; mặc định; giá trị"; -- vi
-- Các thông báo và lỗi khác nhau
datas_no_args_Wikidata_err = "Lỗi nội bộ: Mô-đun không có bảng đối số Wikidata.",
Ligne 1 734 ⟶ 1 732 :
local t = t or "\n* <b>datas.available_props_report(t)</b> Reports availables datas properties.\n* "
local i = 0
-- t = t .. "\n* GuidelineTactic for this stat : Count lists of translations by languages and libraries, then convert in a 2D table, then format and report them."
local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = {...}
for key, argmt in pairs(args_known) do -- For all known parameters
Ligne 1 840 ⟶ 1 838 :
datas.default_item = datas.default_item or "Q34743" -- Rudyard Kipling
 
-- And ["prop_default"] depends of need in function modes.one_arg_check_need()
function datas.property(one_data) -- Get datas from mwwikibase for one property of the page.
 
one_data = mw.clone(one_data or {}) -- avoid any interaction with other properties.
function datas.one_prop(one_arg) -- Get datas from mwwikibase for one property of the page.
local one_arg = mw.clone(one_arg or {}) -- avoid any interaction with other properties.
local claimRanks = { 1, 2, 3, 4, }
datas.QITEM = mw.wikibase.getEntityIdForCurrentPage() -- use props.QITEM Returns the Item id as string, like "Q42"
datas.QITEM = datas.QITEM or datas.default_item or "Q34743" -- Rudyard Kipling
datas.entity = mw.wikibase.getEntity(datas.QITEM or datas.default_item or "Q34743" ) -- Rudyard Kipling
local val = nil ; one_dataone_arg["val"] = val
datas.entity = mw.wikibase.getEntity(datas.QITEM or datas.default_item or "Q34743" ) -- Rudyard Kipling
if one_data["prop"] == "label" then one_data["val"] = datas.item:getLabel(datas.QITEM) -- use props.label Returns a string, like "Berlin" with 'de'
-- Sub-task "S181027n13", "For 'Begin' "NOW",CentralManual need=0=noevent need=1=depend keyword+default event need=2=permit default need=3=enforce default", },
elseif one_data["prop"] == "sitelink" then one_data["val"] = datas.item:getSitelink() -- use props.sitelink like Author:Aristotel
-- and ["prop_default"] depends of need in function datas.one_prop(
elseif one_data["prop"] == "labelwithlang" then one_data["val"] = mw.wikibase.entity:getLabelWithLang() -- use props.labelwithlang -- Returns a string like "Berlin" and a language like
local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = {...}
elseif one_data["prop"] == "description" then one_data["val"] = mw.wikibase.description(datas.QITEM) -- use props.description -- ric : Description of the QITEM page
local local_need = 0 -- to select
elseif one_data["prop"] == "labelcontent" then one_data["val"] = mw.wikibase.getLabelByLang(datas.QITEM, langs.content_lang) -- Returns the content_lang label of the item
if args_known["keyword"] and args_known["keyword"]["need"] then local_need = args_known["keyword"]["need"] end -- need=0=noevent
elseif one_data["prop"] == "labelpage" then one_data["val"] = mw.wikibase.getLabelByLang(datas.QITEM, langs.page_lang) -- Returns the page_lang label of the item
if not args_known["keyword"] then one_arg["val"] = nil end -- need=0=noevent
elseif one_data["prop"] == "labeluser" then one_data["val"] = mw.wikibase.getLabelByLang(datas.QITEM, langs.user_lang ) -- Rudyard Kipling
if (args_known["keyword"] == one_arg["keyword"]) and (local_need == 3 ) then -- need=3=enforce default
else
one_arg["val"] = args_known["keyword"]["prop_default"] -- Wanted even if nil.
if claimRanks["RANK_TRUTH"] then one_data["prop"] = one_data["prop"] or datas.item:formatPropertyValues(claimRanks["RANK_TRUTH"]) end
else -- need=others : 2, 1, 0.
if claimRanks["RANK_PREFERRED"] then one_data["prop"] = one_data["prop"] or datas.item:formatPropertyValues(claimRanks["RANK_PREFERRED"]) end
if one_arg["prop"] == "label" then one_arg["val"] = datas.item:getLabel(datas.QITEM) -- use props.label Returns a string, like "Berlin" with 'de'
if claimRanks["RANK_NORMAL"] then one_data["prop"] = one_data["prop"] or datas.item:formatPropertyValues(claimRanks["RANK_NORMAL"]) end
elseif one_arg["prop"] == "sitelink" then one_arg["val"] = datas.item:getSitelink() -- use props.sitelink like Author:Aristotel
if claimRanks["RANK_DEPRECATED"]then one_data["prop"] = one_data["prop"] or datas.item:formatPropertyValues(claimRanks["RANK_DEPRECATED"]) end
elseif one_arg["prop"] == "labelwithlang" then one_arg["val"] = mw.wikibase.entity:getLabelWithLang() -- use props.labelwithlang -- Returns a string like "Berlin" and a language like
elseif one_arg["prop"] == "description" then one_arg["val"] = mw.wikibase.description(datas.QITEM) -- use props.description -- ric : Description of the QITEM page
elseif one_arg["prop"] == "labelcontent" then one_arg["val"] = mw.wikibase.getLabelByLang(datas.QITEM, langs.content_lang) -- Returns the content_lang label of the item
elseif one_arg["prop"] == "labelpage" then one_arg["val"] = mw.wikibase.getLabelByLang(datas.QITEM, langs.page_lang) -- Returns the page_lang label of the item
elseif one_arg["prop"] == "labeluser" then one_arg["val"] = mw.wikibase.getLabelByLang(datas.QITEM, langs.user_lang ) -- Rudyard Kipling
else
if claimRanks["RANK_TRUTH"] then one_arg["prop"] = one_arg["prop"] or datas.item:formatPropertyValues(claimRanks["RANK_TRUTH"]) end
if claimRanks["RANK_PREFERRED"] then one_arg["prop"] = one_arg["prop"] or datas.item:formatPropertyValues(claimRanks["RANK_PREFERRED"]) end
if claimRanks["RANK_NORMAL"] then one_arg["prop"] = one_arg["prop"] or datas.item:formatPropertyValues(claimRanks["RANK_NORMAL"]) end
if claimRanks["RANK_DEPRECATED"]then one_arg["prop"] = one_arg["prop"] or datas.item:formatPropertyValues(claimRanks["RANK_DEPRECATED"]) end
end
end
if (not one_dataone_arg["valprop"]) and one_arg["prop_default"] then one_dataone_arg["valprop"] = one_dataone_arg["prop_default"] end -- Rudyard Kipling -- Theneed=2=permit default value can be of any type
if (one_arg["format"] == "year") and tonumber(one_arg["val"]) then one_arg["val"] = mw.ustring.sub( tostring(one_arg["val"]), -4, -1 ) end
one_data["val"] = tostring(one_data["val"])
one_arg = mw.clone(one_arg) -- avoid any interaction with other properties.
if (one_data["format"] == "year") and tonumber(one_data["val"]) then one_data["val"] = mw.ustring.sub( tostring(one_data["val"]), -4, -1 ) end
return one_arg
one_data = mw.clone(one_data) -- avoid any interaction with other properties.
end -- local one_arg = function datas.one_prop(one_arg) -- Get datas from mwwikibase for one property of the page.
return one_data
end -- local val = datas.property(one_data, loc) -- Get datas from mwwikibase for one property of the page.
 
function datas.get_item(args_known, QITEM) -- Get datas from mw.wikibase for the page.
Ligne 1 882 ⟶ 1 892 :
one_arg.key = key
one_arg.syn = one_arg.syn or 0
one_arg = datas.propertyone_prop(one_arg) -- Get datas from mwwikibase for one property of the page. function datas.propertyone_prop(
if one_arg.keyword == "QITEM" then one_arg.val = QITEM end
if one_arg.prop then -- Admit any type of keyword and prop.
Ligne 1 897 ⟶ 1 907 :
end -- local prop, props = datas.get_item(args_known, QITEM) -- Get datas from mw.wikibase for the page.
 
-- datas_get_item_report_title = "datas.get_item_report() Rapporte les données de mw.wikibase pour la page ou tout autre élément.",
function datas.get_item_report(t) -- datas.get_item() Report datas from mw.wikibase
function datas.get_item_report(t) -- datas.get_item() Report datas from mw.wikibase datas_get_item_report
local memo = viewers.save_configs("datas.get_item_report") -- Save global configuration before eventual changes.
local t = t or "\n* <b>datas.get_item_report(t)</b>: Report datas from mw.wikibase"
Ligne 1 913 ⟶ 1 924 :
test_group = sortprops, -- Use default cases.
rowGroup = {},
title_memo = "modes_args_known_report_titledatas_get_item_report_title", -- Report datas from mw.wikibase",
headers = "modes_args_known_report_headersdatas_get_item_report_headers", -- "keyword; value; type; need; keyword; syn; property; by default; format; sourcevalue",
headers = "keyword; value; type; property; default; format",
headers_class = "wikitable alternative center sortable",
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
return { case.keykeyword, case.val, case.typ, case.needprop, case.keyword, case.syn, case.propprop_default, case.format, } end,
headers = "key; val; typ; need; keyword; syn; prop; format",
}
t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
Ligne 2 024 ⟶ 2 035 :
end
end -- function datas.load_data(t, datext) -- Pass data between #invoke's
 
-- cut_libraries
 
-- - - - ------------------ - - - - ------------------ - - - - -----------------------------
-- - - - ------------------ - - - - ------------------ - - - - -----------------------------
-- The Library:events supports events of types erros, warnings and categories.
-- viewers.save_configs("events.save_configs" memo, tab_view, group ) -- Init a new events group
-- events.add_err(key, ... ) -- Add an error in the actual table of events.
-- events.add_cat_group(groupCat, groupList) -- Add some categories in the actual table of events.
-- events.form(evt) -- Format events types
-- events.all_categories_test(t) -- test categories
-- - - - ------------------ - - - - ---------------------------------
-- - - - ------------------ - - - - ---------------------------------
 
-- events = {} -- already declared by Scribunto, see central_library.new() -- Record a library in package.loadedS
 
events.i18n = {} -- Translations for Library:events
events.i18n.br = {
events_test_tests_title = "List a table, test with limits:",
events_test_resTest_title = "List a table, test with limits:",
events_test_projects_title = "Test and display tests events for projects",
events_test_projects_headers = "Type;Key;Name test and values;result of the test",
events_test_MediaWiki_title = "Test and display tests events for MediaWiki",
events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test",
events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues",
events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)",
events_all_kinds_tests_headers = "typ;key;idargs;result",
events_add_cat_deprecated = "Fonction obsolète dans le module principal.",
events_close_without_memo_err = "viewers.restore_configs(memo, where) sans <b>memo</b> dans le module <b>%1</b>.",
events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.",
} -- events.i18n.br
events.i18n.en = {
events_test_tests_title = "List a table, test with limits:",
events_test_resTest_title = "List a table, test with limits:",
events_test_projects_title = "Test and display tests events for projects",
events_test_projects_headers = "Type;Key;Name test and values;result of the test",
events_test_MediaWiki_title = "Test and display tests events for MediaWiki",
events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test",
events_test_categ_Test_title = "categ_Test test : classes in some languages",
events_all_kinds_tests_title = "events.all_kinds_test() Test: all kinds of events (err, wng, cat)",
events_all_kinds_tests_headers = "typ;key;idargs;result",
events_close_without_memo_err = "viewers.restore_configs(memo, where) without <b>memo</b> in module <b>%1</b>.",
events_antiCrash_protect_err = "The antiCrash() function protects this page against a complete crash due to an internal error: %1.",
} -- events.i18n.en
events.i18n.es = {
events_test_tests_title = "List a table, test with limits:",
events_test_resTest_title = "List a table, test with limits:",
events_test_projects_title = "Test and display tests events for projects",
events_test_projects_headers = "Type;Key;Name test and values;result of the test",
events_test_MediaWiki_title = "Test and display tests events for MediaWiki",
events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test",
events_test_categ_Test_title = "Prueba categ_Test: clases en algunos lenguajes",
events_all_kinds_tests_title = "events.all_kinds_test() Prueba: todo tipo de eventos (err, wng, cat)",
events_all_kinds_tests_headers = "typ;key;idargs;result",
events_add_cat_deprecated = "Función obsoleto en módulo principal.",
events_close_without_memo_err = "viewers.restore_configs(memo, where) sin <b>memo</b> en el módulo <b>%1</b>.",
events_antiCrash_protect_err = "La función antiCrash() protege esta página contra un colapso completo debido a un error interna: %1.",
} -- events.i18n.es
events.i18n.fr = {
events_test_tests_title = "List a table, test with limits:",
events_test_resTest_title = "List a table, test with limits:",
events_test_projects_title = "Test and display tests events for projects",
events_test_projects_headers = "Type;Key;Name test and values;result of the test",
events_test_MediaWiki_title = "Test and display tests events for MediaWiki",
events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test",
events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues",
events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)",
events_all_kinds_tests_headers = "typ;key;idargs;result",
events_add_cat_deprecated = "Fonction obsolète dans le module principal.",
events_close_without_memo_err = "viewers.restore_configs(memo, where) sans <b>memo</b> dans le module <b>%1</b>.",
events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.",
} -- events.i18n.fr
events.i18n.hu = {
events_test_tests_title = "List a table, test with limits:",
events_test_resTest_title = "List a table, test with limits:",
events_test_projects_title = "Test and display tests events for projects",
events_test_projects_headers = "Type;Key;Name test and values;result of the test",
events_test_MediaWiki_title = "Test and display tests events for MediaWiki",
events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test",
events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues",
events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)",
events_all_kinds_tests_headers = "typ;key;idargs;result",
events_add_cat_deprecated = "Fonction obsolète dans le module principal.",
events_close_without_memo_err = "viewers.restore_configs(memo, where) sans <b>memo</b> dans le module <b>%1</b>.",
events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.",
} -- events.i18n.hu
events.i18n.vi = {
events_test_tests_title = "List a table, test with limits:",
events_test_resTest_title = "List a table, test with limits:",
events_test_projects_title = "Test and display tests events for projects",
events_test_projects_headers = "Type;Key;Name test and values;result of the test",
events_test_MediaWiki_title = "Test and display tests events for MediaWiki",
events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test",
events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues",
events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)",
events_all_kinds_tests_headers = "typ;key;idargs;result",
events_add_cat_deprecated = "Fonction obsolète dans le module principal.",
events_close_without_memo_err = "viewers.restore_configs(memo, where) sans <b>memo</b> dans le module <b>%1</b>.",
events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.",
} -- events.i18n.vi
 
events.test_group = {}
events.rowGroup = {}
events.tab_view = {}
events.tab_view.test_group = {}
events.tab_view.rowGroup = {}
 
 
function events.add_cat(key, ... ) -- Add a category in the actual table of events.
return events.add_record("cat", key, ...) -- Add a error, warning or category in the lists. S170626rev
end
 
function events.add_err(key, ... ) -- Add an error in the actual table of events.
return events.add_record("err", key, ...) -- Add a error, warning or category in the lists. S170626rev
end
 
function events.add_wng(key, ... ) -- Add a warning in the actual table of events.
return events.add_record("wng", key, ...) -- Add a error, warning or category in the lists. S170626rev
end
 
function events.form_cat(evt, txt, lnk, c, space)
local space = space or (mw.site.namespaces.Category.name .. ":")
local c = c or evt.ccc or ":"
if evt.typ == "cat" then -- Format a category to display or activate
evt.content_wkt = viewers.form9content(evt.key, lua_table.to_list( evt.vals ) )
evt.page_wkt = viewers.form9page(evt.key, lua_table.to_list( evt.vals ) )
evt.user_wkt = viewers.form9user(evt.key, lua_table.to_list( evt.vals ) )
return " [[" .. c .. space .. (evt.content_wkt or lnk) .. "|" .. (evt.user_wkt or txt) .. "]] "
else
return ""
end
end
 
events.list_all_events = {} -- Table to collect all events types "err", "wng" and "cat".
 
function events.new(typ, key, ...) -- Initialize and finalize a new event.
local evt = {} -- default event
if type(typ) == "table" then
evt = typ -- Use a predefined event
else -- To finalize an existing event.
evt.typ = typ
evt.key = key
end -- Finalize all events
evt.typ = evt.typ or typ -- Type of event: err, wng, cat
evt.key = evt.key or key -- Translation key, simple or extended by name
if type(typ) ~= "string" then typ = "notyp" end -- To debug abnormal type of event
if type(key) ~= "string" then key = "nokey" end -- To debug abnormal translation key
evt.name = evt.typ or evt.key or "name" -- Translation key, simple or extended by name
evt.vals = evt.vals or { ... } -- table of arguments values
evt.catview = evt.catview or ":" -- Default value for eventual use
-- Check, yes or no, to form an event, in special cases
if (evt.typ == "cat") then
evt.res, evt = events.form( evt ) -- Formats the resulting wikitext, can be re-form later
elseif (evt.typ == "err") then
evt.res, evt = events.form( evt ) -- Formats the resulting wikitext, can be re-form later
elseif (evt.typ == "wng") then
evt.res, evt = events.form( evt ) -- Formats the resulting wikitext, can be re-form later
end
return evt
end -- function events.new(typ, key, ...)
 
function events.add_new(evt) -- Add a error, warning or category in the lists. S170626rev
-- Select only new events
if type(evt) ~= "table" then evt = {} end
local new_evt = viewers.form9tests( tostring(evt.key), lua_table.to_list( evt.vals ) )
for i, event in pairs(events.list_all_events) do
local old_evt = viewers.form9tests( tostring(event.key), lua_table.to_list( event.vals ) )
if new_evt == old_evt then new_evt = nil ; break end -- Add only new events. Reject already seen events.
end
-- events.add_wng("modes_auto_val_warning_wng", langs.user_translations[key], val) -- form_result
if new_evt then table.insert(events.list_all_events, evt) end
return evt
end -- function events.add_new(typ, ref, ...)
 
function events.add_record(typ, key, ... ) -- Add a new error, warning or category in a list.
-- Guide line: all events are in a single table, including categories, without duplication.
-- Guide line: without duplication: events differ if the type, the key or any value of any argument differs.
-- Guide line: We can view or categorize categories.
local intern_or_use = versions.memo_i18n["en"][key]
local evt = events.new(typ, key, ...) -- Initialize and finalize a new event.
local evt = events.add_new(evt) -- Add an error, warning or category in the lists. S170626rev
local res, evt = events.form(evt, c) -- Format an event as an error, warning or category.
return res, evt
end -- local res, evt = events.add_record(typ, key, ... )
 
function events.form(evt, c) -- Format an event as an error, warning or category.
evt.res = tostring(evt.res) .. "? form " .. viewers.form9tests(".form evt.key=%1, evt.res=%2, ", evt.key, evt.res )
local evt = mw.clone(evt) -- do not disturb input event
if type(evt) ~= "table" then
evt.res = lua_table.rough_view(evt)
return evt.res, evt
end
if (evt.typ ~= "cat") and (evt.typ ~= "wng") and (evt.typ ~= "err") then
evt.res = lua_table.rough_view(evt)
return evt.res, evt
end
evt.tableStyle = evt.tableStyle or "" -- Could change the style of the wikitext. Not available on 20160916
if type(evt.name) ~= "string" then evt.name = ""
elseif evt.name ~= "" then evt.name = evt.name .. "_" end
evt.idargs = evt.name .. tostring( viewers.form9user( tostring(evt.key), lua_table.to_list( evt.vals ) ) )
-- Each type of event formats its own type of wikitext
evt.content_wkt = viewers.form9content(evt.key, lua_table.to_list( evt.vals ) )
evt.page_wkt = viewers.form9page(evt.key, lua_table.to_list( evt.vals ) )
evt.user_wkt = viewers.form9user(evt.key, lua_table.to_list( evt.vals ) )
evt.res = "" -- multilingual
if evt.typ == "err" then evt.res = viewers.styles_color_error(evt.user_wkt) end
if evt.typ == "wng" then evt.res = viewers.styles_color_warning(evt.user_wkt) end
evt.ccc = c or evt.catview or events.catview or ":"
evt.content_catspace = mw.site.namespaces.Category.name -- name: Local namespace name.
if evt.typ == "cat" then -- Format a category to display or activate
evt.res = events.form_cat(evt)
if viewers.is_in("_i_cat", key) then -- If needed, add a second "Category:Module with internal error"
res = res .. events.add_cat("versions_with_internal_error")
end
if viewers.is_in("_u_cat", key) then -- If needed, add a second "Category:Module with user error"
res = res .. events.add_cat("versions_with_user_error")
end
end
return evt.res, evt
end -- function events.form(evt, c)
 
events.all_kinds_test_test_group = {
{ "abc", "langs_form9user_all_types_values", { "pi = ", "circle / diameter", 3.14, }, },
{ "equation", "langs_form9user_all_types_values", { 11, 7, 3.14, }, },
{ "Matrix:", "langs_form9user_all_types_values", { "2.1.0", "v4-6, ISO_8601, FC14 h6", }, },
{ "pi = ", "langs_form9user_all_types_values", { "circle / diameter", 3.14, }, },
{ "quadrature", "langs_form9user_all_types_values", { function() end, "convert a square to a circle", }, },
}
-- langs_form9user_all_types_values = "Test: string=%1 number=%2 nil=%3 function=%4 table=%5.",
function events.all_kinds_test(t) -- Test: all kinds of events (err, wng, cat)
local memo = viewers.save_configs("events.all_kinds_test") -- Save global configuration before eventual changes.
events.all_kinds_trck = "\n* events.all_kinds_trck: "
local t = t or ""
t = t .. "\n* events.all_kinds_test(t) -- Test: all kinds of events (err, wng, cat): "
t = t .. events.all_kinds_trck
local tab_view = { -- Group datas and options for a table view with lines and columns.
test_group = events.all_kinds_test_test_group, -- Use default cases.
title_memo = "events_all_kinds_tests_title", -- "events.all_kinds_test() Test: all kinds of events (err, wng, cat)",
headers = "events_all_kinds_tests_headers", -- "typ;key;idargs;result",
rowGroup = {},
}
function tab_view.form_one_case(evt) -- Convert a case from test_group to rowGroup.
return { evt.typ or "t", evt.key or "k", evt.idargs or "i", evt.res or "r" }
end
t = t .. tableview.new(tab_view) -- Formats a table view with lines and columns.
t = t .. viewers.ta("end #test_group *2", lua_table.level_count(tab_view.test_group) ) -- function tableview.new( nil bug170602
t = t .. viewers.ta("end #rowGroup *2", lua_table.level_count(tab_view.rowGroup) ) -- function tableview.new( nil bug170602
t = t .. events.all_kinds_trck
viewers.restore_configs(memo, "events.all_kinds_test") -- Restore global configurations after eventual changes.
return t
end -- function events.all_kinds_test(t)
 
function events.add_cat_group(groupCat, groupList) -- Add some categories in the actual table of events. Separated by ";".
-- catGroup("Country %1", "France,Italia") -> [[Category:Country France]] [[Category:Country Italia]]
if type(groupCat) ~= "string" then groupCat = "%1" end
if type(groupList) ~= "string" then return "" end
local cats = ""
for i, str in mw.text.gsplit(groupList, ";", true) do
local wkt = viewers.form9user(groupCat, str)
cats = cats .. events.add_cat(groupCat, wkt)
end
local res, evt = events.add("catGroup", groupCat, cats) -- Add an event to a group.
evt.trc = evt.trc .. viewers.form9user("\n* add_cat evt.typ=%1, evt.key=%2, ", evt.typ, evt.key)
return res, evt
end -- function events.add_cat_group(groupCat, groupList)
 
function events.select_typ(typ) -- Select events by one type
local is = {}
for i, evt in pairs(events.test_group) do
if evt.typ == typ then table.insert( is, evt.idargs ) end
end
return is
end
 
function events.sort_typ() -- Sort events by type in wng, err, cat.
local wng, err, cat = {}, {}, {}
for i, evt in pairs(events.test_group) do
if evt.typ == "wng" then table.insert( wng, evt ) end
if evt.typ == "err" then table.insert( err, evt ) end
if evt.typ == "cat" then table.insert( cat, evt ) end
end
return wng, err, cat
end -- function events.sort_typ()
 
function events.selector( tab_view, evt )
if type(evt) ~= "table" then
evt = { -- options for tableview.new() -- Formats a table with lines and columns.
headers = "typ;key;selector-name;wkt",
style = "",
typ = "err",
rowGroup = {},
}
else
evt.headers = evt.headers or "typ;key;else-name;wkt"
evt.tableStyle = evt.tableStyle or ""
evt.name = evt.name or "_"
evt.typ = evt.typ or "nil"
end
if (type(tab_view) == "table") and (type(tab_view.typ) == "string") and (tab_view.typ == evt.typ) then
table.insert( tab_view.test_group, { evt.typ, evt.key, evt.name, evt.wkt } )
elseif (type(tab_view) == "table") and (type(tab_view.typ) == "string") and (tab_view.typ == "v") then
table.insert( tab_view.test_group, { evt.typ, evt.key, evt.name, evt.wkt } )
else
tab_view = {}
table.insert( tab_view.test_group, { evt.typ, evt.key, evt.name, evt.wkt } )
end
end -- function events.selector( tab_view, evt )
 
function events.all_kinds_test_test(t) -- Test: all kinds of events (err, wng, cat)
local memo = viewers.save_configs("events.all_categories_test") -- Save global configuration before eventual changes.
local t = t or "\n* <b>events.all_kinds_test()</b> Test: all kinds of events (err, wng, cat)"
local tab_view = { -- Group datas and options for a table view with lines and columns.
test_group = nil, -- Use default cases.
title_memo = "events_all_kinds_tests_title", -- "events.all_kinds_test() Test: all kinds of events (err, wng, cat)",
headers = "events_all_kinds_tests_headers", -- "typ;key;idargs;result",
}
function tab_view.form_one_case(evt) -- Convert a case from test_group to rowGroup.
return { evt.typ, evt.key, evt.idargs, evt.res }
end
t = t .. tableview.new(tab_view) -- Form a table view with lines and columns.
viewers.restore_configs(memo, "events.all_kinds_test_test") -- Restore global configurations after eventual changes.
return t --, errors -- langs_missing_translations_title
end -- function events.all_kinds_test_test(t)
 
events.errors_list = {} -- Deprecated: Table to collect errors and warnings
events.erron = true -- Activated or not errors. Errores activado o no. Erreurs activées ou non.
events.categories_list = {} -- Table to collect all categories to generate in wikitext
 
function events.errors_lister(title, v1, v2, v3, v4, v5, v6, v7, v8, v9)
local res, msgref = "", ""
local mwtitle = mw.title.getCurrentTitle()
local page = tostring(mwtitle.nsText) .. ":" .. tostring(mwtitle.text)
if type(title) ~= "string" then title = "modes_error_list_header_err" end
res = res .. '\n*' .. viewers.form9user(title, page, v1, v2, v3, v4, v5, v6, v7, v8, v9) -- .. ' - ' .. page
local n = 0
for k, wng in ipairs(events.errors_list) do
msgref = viewers.form9user(wng.ref, wng.v1, wng.v2, wng.v3, wng.v4, wng.v5, wng.v6, wng.v7, wng.v8, wng.v9) -- texte traduit ou direct
if wng.typ == "wng" then
res = res .. '<br>⦁ ' .. viewers.styles_color_warning(msgref)
end
end
for k, wng in ipairs(events.errors_list) do
msgref = viewers.form9user(wng.ref, wng.v1, wng.v2, wng.v3, wng.v4, wng.v5, wng.v6, wng.v7, wng.v8, wng.v9) -- texte traduit ou direct
if wng.typ == "err" then
res = res .. '<br>⦁ ' .. viewers.styles_color_error(msgref)
n = n + 1
end
end
if n > 0 then
events.add_cat("versions_module_with_error_err")
end
return res
end -- function events.errors_lister(title, v1, v2, v3, v4, v5, v6, v7, v8, v9)
 
function events.gener_categories(args_final) -- Only for this library, form categories without activate them
local args_final = args_final
if type(args_final) ~= "table" then args_final = modes.args_final end
if args_final.birthyear then
events.add_cat("p_authors_birthyear_cat", args_final.birthyear)
end
if args_final.deathyear then
events.add_cat("p_authors_deathyear_cat", args_final.deathyear)
end
if args_final.description then
-- events.add_cat("p_authors_deathyear_cat", args_final.description)
end
return
end -- function events.gener_categories(args_final)
 
function events.categories_lister(c) -- Categorize categories, or view categories if c=":".
local res = ""
modes.options_to_cat_view()
-- c can replace cat_view to enforce the documentation or the categorisation
c = c or modes.cat_view or ""
for k, evt in pairs(events.list_all_events) do
if (evt.typ == "cat") then
local keyuser = viewers.form9user(evt.key)
local keycontent = viewers.form9content(evt.key)
res = res .. events.form_cat(evt, keyuser, keycontent, c)
end
end
return res
end -- function events.categories_lister(c)
 
-- cut_libraries
Ligne 2 872 ⟶ 2 500 :
local memo = viewers.save_configs("langs.translations_statistics_report") -- Save global configuration before eventual changes.
local t = t or "\n* <b>langs.translations_statistics_report(t)</b> Statistical report on translations by languages and libraries."
t = t .. "\n* GuidelineTactic for this stat : Count lists of translations by languages and libraries, then convert in a 2D table, then format and report them."
t = t .. "\n* <b>Normal result: Counts are similar in all languages.</b>"
local args_known = args_known or modes.args_known or p.args_known or {} -- modes.args_known = { -- p.args_known = { -- }
Ligne 2 878 ⟶ 2 506 :
local all_stats = {} -- all_stats + Total
local trans_count, case, i18n_group, total_stat, total_stats = 0
-- GuidelineTactic for this stat : Collect counts of translations by languages and libraries, then put them in a 2D table, then format and report them.RIC
for libname, vers in pairs(package.loaded) do -- in reverse order bind_libra
total_stat = { ["libr"] = tostring(vers.libname), ["code"] = "en", ["content"] = 0, ["page"] = 0, ["user"] = 0, ["n_langs"] = 0, ["total"] = 0, }
Ligne 3 005 ⟶ 2 633 :
function langs.init_content_page_user_lang(content_lang, page_lang, user_lang)
-- Initialize or change the content, the page and the user languages and their translations tables.
-- Guide lineTactic: decreasing priority, for each of these 3 languages, is : argument, else MediaWiki, else default values.
-- See also https://meta.wikimedia.org/wiki/Translate_extension and [[Special:PageLanguage]] 2016-12-19
local main_i18n = versions.memo_i18n or langs.main_i18n or versions.main_i18n
Ligne 4 459 ⟶ 4 087 :
mathroman.args_known = { -- Table of the definitions of all known arguments at module level.
-- Arguments in order without names, with their keyword for use as other arguments.
[1] = { ["syn"] = 2, ["need"] = 0"noevent", ["keyword"] = "mode"},
-- Special arguments to modify the fonctions and outputs of this module.
["mode"] = { ["typ"] = "config", ["need"] = 0"noevent", ["keyword"] = "mode"},
["c"] = { ["typ"] = "config", ["need"] = 0"noevent", ["keyword"] = "c"},
["options"] = { ["typ"] = "config", ["need"] = 0"noevent", ["keyword"] = "options"},
-- The userlang argument permits at an administrator in his own langage (errors, warnings, catégories, tests) to help a wiki in any language.
["contentlang"] = { ["typ"] = "config", ["need"] = 0"noevent", ["keyword"] = "contentlang"},
["pagelang"] = { ["typ"] = "config", ["need"] = 0"noevent", ["keyword"] = "pagelang"},
["userlang"] = { ["typ"] = "config", ["need"] = 0"noevent", ["keyword"] = "userlang"},
["birthyear"] = { ["typ"] = "dat", ["need"] = 0"noevent", ["keyword"] = "birthyear", ["prop"] = "P569", ["format"] = "year", },
["deathyear"] = { ["typ"] = "dat", ["need"] = 0"noevent", ["keyword"] = "deathyear", ["prop"] = "P570", ["format"] = "year", },
}
 
function mathroman.roman2int(rm) -- Convert a roman number to integer
-- { ["name"] = "mathroman.roman2int (4)', ["args"] = { "VI", }, ["expect"] = { 123 } }, -- example of test case
local v = 0 -- valeur totale
local v1 = 0 -- valeur de derniere lettre
local v2 = 0 -- valeur de lettre precedente
local v3 = 0 -- valeur de lettre precedente
local x = '-' -- caractere en cours d'evaluation
local i = 1 -- numero du caractere en cours d'evaluation
local j = 0 -- numero du caractere de reference courant (debut en Lua)
local k = 0 -- numero du caractere de reference courant (fin en Lua)
local errs, errtab = "", {}
if type(rm) ~= "string" then
table.insert(errtab, tostring(events.add_err("mathroman_is_not_string_err", tostring(rm) ) ) )
return 0, errs
end -- function events.add_err(
if rm == "" then
errs = errs .. events.add_err("mathroman_is_not_string_err", '""')
table.insert(errtab, tostring(events.add_err("mathroman_is_not_string_err", '""') ) )
return 0, errs
end
if type(rm) ~= "string" then rm = "-" end
local lst = '-MDCLXVIJ' -- caracteres autorises
x = string.sub(rm, i, i) or ''
while (x ~= '') do
v3 = v2
v2 = v1
v1 = 0
if ( x == 'M' ) then v1 = 1000 end
if ( x == 'D' ) then v1 = 500 end
if ( x == 'C' ) then v1 = 100 end
if ( x == 'L' ) then v1 = 50 end
if ( x == 'X' ) then v1 = 10 end
if ( x == 'V' ) then v1 = 5 end
if ( x == 'I' ) then v1 = 1 end
if ( x == 'J' ) then v1 = 1 end
if ( x == 'J' ) and ( i < string.len(rm) ) then
errs = errs .. events.add_err("mathroman_J_before_end_err") -- e4 = 'character J before the end'
table.insert(errtab, tostring(events.add_err("mathroman_J_before_end_err") ) ) -- e4 = 'character J before the end'
end
if ( v1 == 0 ) then
errs = errs .. events.add_err("mathroman_char_X_in_N_err", x, i) -- e3 = "character K in 3"
table.insert(errtab, tostring(events.add_err("mathroman_char_X_in_N_err", x, i) ) )
end
v = v + v1
if ( (v1 == 5*v2) or (v1 == 10*v2) ) then v = v - (2*v2) end -- adjust 4, 9, 40, 90 ...
j, k = string.find(lst, x)
if ( j == nil ) then j = -1 end
if ( k == nil ) then k = -1 end
if (v1 > v2) and (v2 > v3) and (v3 > 0) then
errs = errs .. events.add_err("mathroman_char_increase_err") -- e2 = ' increasing chars.'
table.insert(errtab, tostring(events.add_err("mathroman_char_increase_err") ) )
end
i = i + 1
x = string.sub(rm, i, i) or ''
end
if ( v < 1 ) then -- e0 = ' valeur nulle.'
errs = errs .. events.add_err("mathroman_null_value_err")
table.insert(errtab, tostring(events.add_err("mathroman_null_value_err") ) )
end
if ( v > 4999 ) then -- e1 = ' valeur > 4999.'
errs = errs .. events.add_err("mathroman_greater_4999_err")
table.insert(errtab, tostring(events.add_err("mathroman_greater_4999_err") ) )
end
errs = table.concat(errtab, " ; ")
return v, errs -- with or without errors
end -- v, errs = mathroman.roman2int(rm) -- Convert a roman number to integer
 
function mathroman.romani2r(i, j)
Ligne 4 630 ⟶ 4 191 :
return v, errs
end -- v, errs = mathroman.int2roman(int) -- Convert an integer to a roman number
 
mathroman.roman2intTests = { -- Autotest cases to validate the mathroman library at MediaWiki level.
-- each test_case defines a name, a function, an input, an output. See also viewers.strTestCase. 6 cases
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = "-X", ["expect"] = 10, "mathroman_char_X_in_N_err---1-" },
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = "0", ["expect"] = 0, "null value" },
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = "XIA", ["expect"] = 11, "character A in 3" },
--[
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = "", ["expect"] = 0 },
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = "MCXI", ["expect"] = 1111 },
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = "XIJ", ["expect"] = 12 },
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = "XJI", ["expect"] = 12, "X Y Z" },
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = "XJI", ["expect"] = 12, "mathroman_char_increase_err" },
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = "VLD", ["expect"] = 445 },
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = "IXC", ["expect"] = 89 },
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = "MMMMCMXCIX", ["expect"] = 4999 },
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = "MMMMM", ["expect"] = 5000, "mathroman_J_before_end_err-XJI" },
--]]
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = "MMMMMYJXC", ["expect"] = 5089, ";mathroman_J_before_end_err;mathroman_char_increase_err;mathroman_char_X_in_N_err-Y-6;mathroman_greater_4999_err;" },
}
 
function mathroman.roman2int_tests(t) -- Tests of main central modules -- S170606rmn
local memo = viewers.save_configs("mathroman.roman2int_tests") -- Save global configuration before eventual changes.
local t = t or "\n* <b>mathroman.roman2int(t)</b> Test roman to digital numbers. " .. viewers.form9user("mathroman_roman2int_tests_title")
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "mathroman_roman2int_tests_title", -- "mathroman.roman2int() Test roman to digital numbers"
test_group = mathroman.roman2intTests,
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
local valX, errs = mathroman.roman2int(case["args"]) -- DEBUG : function mathroman.roman2int() can fail without blocking page.
local wordX, errsX = mathroman.int2roman(valX) -- DEBUG : function mathroman.roman2int() can fail without blocking page.
return { case["args"], tostring(valX), tostring(wordX), tostring(errs) .. " " .. tostring(errsX), }
end,
headers = "mathroman_roman2int_tests_headers", -- "Roman number; Digital value; Correct; Error(s)"
headers_class = "wikitable alternative center sortable",
rowGroup = {},
}
t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
t = t .. viewers.ta("#test_group: ", lua_table.level_count(tab_view.test_group) )
t = t .. viewers.ta("#rowGroup: ", lua_table.level_count(tab_view.rowGroup) )
viewers.restore_configs(memo, "mathroman.roman2int_tests") -- Restore global configurations after eventual changes.
return t
end -- function mathroman.roman2int_tests(t)
 
mathroman.int2romanTests = { -- Autotest cases to validate the mathroman library at MediaWiki level.
-- each test_case defines a name, a function, an input, an output. See also viewers.strTestCase. 8 - 1 = 7 + 8 = 15 cases
{ ["errorsKeyint"] = 2-10, ["modulenameexpect"] = "mathromanX", ["funcname"] = "mathroman.int2roman"}, ["args"] =-- "19", ["expect"] =negative value"XII" },
{ ["int"] = 0, ["expect"] = "0", }, -- "null value"
{ ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.int2roman", ["args"] = 4999, ["expect"] = "MMMMCMXCIX" },
{ ["errorsKeyint"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.int2roman", ["args"] = 50001, ["expect"] = "0I", }, -- "current "value > 4999"
{ ["errorsKeyint"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.int2roman", ["args"] = -1011, ["expect"] = "XXI", }, -- "nullcurrent value"
{ ["errorsKeyint"] = 2111, ["modulename"] = "mathroman", ["funcname"] = "mathroman.int2roman", ["args"] = 0, ["expect"] = "0CXI", }, -- "nullcurrent value"
{ ["int"] = 1111, ["expect"] = "MCXI", }, -- "current value"
{ ["int"] = "19", ["expect"] = "IXX" }, -- "string value"
{ ["int"] = 4999, ["expect"] = "MMMMCMXCIX" }, -- "last value"
{ ["int"] = 5000, ["expect"] = "0", }, -- "value > 4999 error"
}
 
Ligne 4 689 ⟶ 4 212 :
local memo = viewers.save_configs("mathroman.int2roman_test") -- Save global configuration before eventual changes.
local t = t or "\n* <b>mathroman.int2roman(t)</b> Test digital to roman numbers."
local group = {}
for i, one_test in pairs(mathroman.int2romanTests) do -- apply the tests cases
one_test["result"] = mathroman.int2roman(one_test.int)
t = t .. "\n* one_test : " .. viewers.ta("one_test.int", one_test.int ) .. viewers.ta("one_test.expect", one_test.expect ) .. viewers.ta("one_test.result", one_test.result )
table.insert(group, one_test)
end
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "mathroman_int2roman_test_title", -- "mathroman.int2roman() Test digital numbers to roman numbers"
test_group = mathroman.int2roman_testgroup,
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
local valX, errs = mathroman.roman2intint2roman(case["argsint"]) -- DEBUG : mathroman.roman2int() can fail without blocking page.
local valX, errsX = mathroman.roman2intint2roman(wordX) -- DEBUG : function mathroman.roman2int() can fail without blocking page.
return { case["argsint"], wordX, valX, tostringviewers.form9tests("errs", errs) .. viewers.form9tests(" errsX", .. tostring(errsX), } -- viewers.form9tests(ref, ...) -- Formats reference_key;v1;v2;v3;... for tests.
end,
headers = "mathroman_int2roman_tests_headers", -- "Digital number; Roman value; Correct; Error(s)"
Ligne 4 707 ⟶ 4 236 :
return t
end -- function mathroman.int2roman_test(t)
 
function mathroman.roman2int(rm) -- Convert a roman number to integer
-- { ["name"] = "mathroman.roman2int (4)', ["args"] = { "VI", }, ["expect"] = { 123 } }, -- example of test case
local v = 0 -- valeur totale
local v1 = 0 -- valeur de derniere lettre
local v2 = 0 -- valeur de lettre precedente
local v3 = 0 -- valeur de lettre precedente
local x = '-' -- caractere en cours d'evaluation
local i = 1 -- numero du caractere en cours d'evaluation
local j = 0 -- numero du caractere de reference courant (debut en Lua)
local k = 0 -- numero du caractere de reference courant (fin en Lua)
local errs, errtab = "", {}
if type(rm) ~= "string" then
table.insert(errtab, tostring(events.add_err("mathroman_is_not_string_err", tostring(rm) ) ) )
return 0, errs
end
if rm == "" then
errs = errs .. events.add_err("mathroman_is_not_string_err", '""')
table.insert(errtab, tostring(events.add_err("mathroman_is_not_string_err", '""') ) )
return 0, errs
end
if type(rm) ~= "string" then rm = "-" end
local lst = '-MDCLXVIJ' -- caracteres autorises
x = string.sub(rm, i, i) or ''
while (x ~= '') do
v3 = v2
v2 = v1
v1 = 0
if ( x == 'M' ) then v1 = 1000 end
if ( x == 'D' ) then v1 = 500 end
if ( x == 'C' ) then v1 = 100 end
if ( x == 'L' ) then v1 = 50 end
if ( x == 'X' ) then v1 = 10 end
if ( x == 'V' ) then v1 = 5 end
if ( x == 'I' ) then v1 = 1 end
if ( x == 'J' ) then v1 = 1 end
if ( x == 'J' ) and ( i < string.len(rm) ) then
errs = errs .. events.add_err("mathroman_J_before_end_err") -- e4 = 'character J before the end'
table.insert(errtab, tostring(events.add_err("mathroman_J_before_end_err") ) ) -- e4 = 'character J before the end'
end
if ( v1 == 0 ) then
errs = errs .. events.add_err("mathroman_char_X_in_N_err", x, i) -- e3 = "character K in 3"
table.insert(errtab, tostring(events.add_err("mathroman_char_X_in_N_err", x, i) ) )
end
v = v + v1
if ( (v1 == 5*v2) or (v1 == 10*v2) ) then v = v - (2*v2) end -- adjust 4, 9, 40, 90 ...
j, k = string.find(lst, x)
if ( j == nil ) then j = -1 end
if ( k == nil ) then k = -1 end
if (v1 > v2) and (v2 > v3) and (v3 > 0) then
errs = errs .. events.add_err("mathroman_char_increase_err") -- e2 = ' increasing chars.'
table.insert(errtab, tostring(events.add_err("mathroman_char_increase_err") ) )
end
i = i + 1
x = string.sub(rm, i, i) or ''
end
if ( v < 1 ) then -- e0 = ' valeur nulle.'
errs = errs .. events.add_err("mathroman_null_value_err")
table.insert(errtab, tostring(events.add_err("mathroman_null_value_err") ) )
end
if ( v > 4999 ) then -- e1 = ' valeur > 4999.'
errs = errs .. events.add_err("mathroman_greater_4999_err")
table.insert(errtab, tostring(events.add_err("mathroman_greater_4999_err") ) )
end
errs = table.concat(errtab, " ; ")
return v, errs -- with or without errors
end -- v, errs = mathroman.roman2int(rm) -- Convert a roman number to integer
 
mathroman.roman2intTests = { -- Autotest cases to validate the mathroman library at MediaWiki level.
-- each test_case defines a name, a function, an input, an output. See also viewers.strTestCase. 6 cases
{ ["rom"] = "-X", ["expect"] = 10, "mathroman_char_X_in_N_err---1-" },
{ ["rom"] = "0", ["expect"] = 0, "null value" },
{ ["rom"] = "XIA", ["expect"] = 11, "character A in 3" },
{ ["rom"] = "", ["expect"] = 0 },
{ ["rom"] = "MCXI", ["expect"] = 1111 },
{ ["rom"] = "XIJ", ["expect"] = 12 },
{ ["rom"] = "XJI", ["expect"] = 12, "X Y Z" },
{ ["rom"] = "XJI", ["expect"] = 12, "mathroman_char_increase_err" },
{ ["rom"] = "VLD", ["expect"] = 445 },
{ ["rom"] = "IXC", ["expect"] = 89 },
{ ["rom"] = "MMMMCMXCIX", ["expect"] = 4999 },
{ ["rom"] = "MMMMM", ["expect"] = 5000, "mathroman_J_before_end_err-XJI" },
{ ["rom"] = "MMMMMYJXC", ["expect"] = 5089, ";mathroman_J_before_end_err;mathroman_char_increase_err;mathroman_char_X_in_N_err-Y-6;mathroman_greater_4999_err;" },
}
 
function mathroman.roman2int_tests(t) -- Tests of main central modules -- S170606rmn
local memo = viewers.save_configs("mathroman.roman2int_tests") -- Save global configuration before eventual changes.
local t = t or "\n* <b>mathroman.roman2int(t)</b> Test roman to digital numbers. " .. viewers.form9user("mathroman_roman2int_tests_title")
local group = {}
for i, one_test in pairs(mathroman.roman2intTests) do -- apply the tests cases
one_test["result"] = mathroman.roman2int(one_test.rom)
t = t .. "\n* one_test : " .. viewers.ta("one_test.rom", one_test.rom ) .. viewers.ta("one_test.expect", one_test.expect ) .. viewers.ta("one_test.result", one_test.result )
table.insert(group, one_test)
end
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "mathroman_roman2int_tests_title", -- "mathroman.roman2int() Test roman to digital numbers"
test_group = group,
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
local valX, errs = mathroman.roman2int(case["rom"]) -- DEBUG : function mathroman.roman2int() can fail without blocking page.
local wordX, errsX = mathroman.int2roman(valX) -- DEBUG : function mathroman.roman2int() can fail without blocking page.
return { case["rom"], tostring(valX), tostring(wordX), tostring(errs) .. ", " .. tostring(errsX), }
end,
headers = "mathroman_roman2int_tests_headers", -- "Roman number; Digital value; Correct; Error(s)"
headers_class = "wikitable alternative center sortable",
rowGroup = {},
}
t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
t = t .. viewers.ta("#test_group: ", lua_table.level_count(tab_view.test_group) )
t = t .. viewers.ta("#rowGroup: ", lua_table.level_count(tab_view.rowGroup) )
viewers.restore_configs(memo, "mathroman.roman2int_tests") -- Restore global configurations after eventual changes.
return t
end -- function mathroman.roman2int_tests(t)
 
 
-- cut_libraries
Ligne 4 744 ⟶ 4 386 :
["userlang"] = "userlang",
["userlang_descr"] = "Language du lecteur de la page.",
--
["personlang"] = "personlang",
["description"] = "description",
["label"] = "label",
["labelcontent"] = "labelcontent",
["labelpage"] = "labelpage",
["labeluser"] = "labeluser",
["labelbylang"] = "labelbylang",
--
["uri"] = 'uri',
Ligne 4 805 ⟶ 4 455 :
--
modes_delete_docbox_wng = "Vous devez suprimer cette documentation avant d'enregistrer.<br>Supprimez tous les modes pour revenir en mode read.",
modes_auto_val_warning_wngmw_wikibase_wng = "Vérifiez l'argument automatique.",
--
modes_assist_user_param_err = "Support aux utilisateurs pour vérifier les paramètres :",
Ligne 4 918 ⟶ 4 568 :
modes_unknown_auto_arg_err = "Interner fehler: Automatisches unbekanntes Argument: <b>%1</b> = <b>%2</b>.",
modes_delete_docbox_wng = "Sie müssen diese Dokumentation vor dem Brennen entfernen.<br>Entfernen Sie alle Modi, um in den Lesemodus zurückzukehren.",
modes_auto_val_warning_wngmw_wikibase_wng = "Überprüfen Sie die automatischen Argumente.",
--
modes_assist_user_param_err = "Benutzerunterstützung zur Überprüfung der Konfiguration:",
Ligne 4 968 ⟶ 4 618 :
["userlang"] = "userlang",
["userlang_descr"] = "Language of the page reader.",
--
["personlang"] = "personlang",
["description"] = "description",
["label"] = "label",
["labelcontent"] = "labelcontent",
["labelpage"] = "labelpage",
["labeluser"] = "labeluser",
["labelbylang"] = "labelbylang",
--
["uri"] = 'uri',
Ligne 5 028 ⟶ 4 686 :
modes_unknown_auto_arg_err = "Internal Error: Unknown automatic argument: <b>%1</b> = <b>%2</b>.",
modes_delete_docbox_wng = "You must remove this documentation before recording.<br>Remove all modes to return to read mode.",
-- modes_auto_val_warning_wngmw_wikibase_wng = "Verify the automatic argument: <b>%1</b> = <b>%2</b>.",
modes_auto_val_warning_wngmw_wikibase_wng = "Verify the automatic arguments.",
--
modes_assist_user_param_err = "User support for checking the settings:",
Ligne 5 080 ⟶ 4 738 :
["userlang"] = "userlang",
["userlang_descr"] = "Idioma del lector de la página.",
--
["personlang"] = "personlang",
["description"] = "description",
["label"] = "label",
["labelcontent"] = "labelcontent",
["labelpage"] = "labelpage",
["labeluser"] = "labeluser",
["labelbylang"] = "labelbylang",
--
["uri"] = 'uri',
Ligne 5 141 ⟶ 4 807 :
modes_unknown_auto_arg_err = "Error interno: Argumento desconocido automático: <b>%1</b> = <b>%2</b>.",
modes_delete_docbox_wng = "Debe quitar esta documentación antes de grabar.<br>Retire todos los modos para volver al modo read.",
modes_auto_val_warning_wngmw_wikibase_wng = "Verifique el argumentos automáticos.",
--
modes_assist_user_param_err = "Apoyo al usuario para comprobar la configuración:",
Ligne 5 191 ⟶ 4 857 :
["userlang"] = "userlang",
["userlang_descr"] = "Language du lecteur de la page.",
--
["personlang"] = "personlang",
["description"] = "description",
["label"] = "label",
["labelcontent"] = "labelcontent",
["labelpage"] = "labelpage",
["labeluser"] = "labeluser",
["labelbylang"] = "labelbylang",
--
["uri"] = 'uri',
Ligne 5 252 ⟶ 4 926 :
--
modes_delete_docbox_wng = "Vous devez suprimer cette documentation avant d'enregistrer.<br>Supprimez tous les modes pour revenir en mode read.",
modes_auto_val_warning_wngmw_wikibase_wng = "Vérifiez l'argument automatique.",
--
modes_assist_user_param_err = "Support aux utilisateurs pour vérifier les paramètres :",
Ligne 5 302 ⟶ 4 976 :
["userlang"] = "userlang",
["userlang_descr"] = "Az oldal olvasó nyelve.",
--
["personlang"] = "personlang",
["description"] = "description",
["label"] = "label",
["labelcontent"] = "labelcontent",
["labelpage"] = "labelpage",
["labeluser"] = "labeluser",
["labelbylang"] = "labelbylang",
--
["uri"] = 'uri',
Ligne 5 364 ⟶ 5 046 :
modes_unknown_auto_arg_err = "Belső hiba: Automatikus ismeretlen argumentum: <b>%1</b> = <b>%2</b>.",
modes_delete_docbox_wng = "Törölje a dokumentációt az égetés előtt.<br> Távolítsa el az összes módot, hogy visszatérjen az olvasási üzemmódba.",
modes_auto_val_warning_wngmw_wikibase_wng = "Ellenőrizze az automatikus érveket.",
--
modes_assist_user_param_err = "Felhasználói támogatás a konfiguráció ellenőrzéséhez:",
Ligne 5 414 ⟶ 5 096 :
["userlang"] = "userlang",
["userlang_descr"] = "Ngôn ngữ để người đọc trang.",
--
["personlang"] = "personlang",
["description"] = "description",
["label"] = "label",
["labelcontent"] = "labelcontent",
["labelpage"] = "labelpage",
["labeluser"] = "labeluser",
["labelbylang"] = "labelbylang",
--
["uri"] = 'uri',
Ligne 5 475 ⟶ 5 165 :
--
modes_delete_docbox_wng = "Bạn phải xóa tài liệu này trước khi lưu.<br> Xóa tất cả các chế độ để trở về chế độ đọc.",
modes_auto_val_warning_wngmw_wikibase_wng = "Kiểm tra đối số tự động.",
--
modes_assist_user_param_err = "Hỗ trợ người dùng để kiểm tra cài đặt:",
Ligne 5 808 ⟶ 5 498 :
for key, elem in pairs(args_known) do
tt = viewers.tam("typ", elem.typ) .. viewers.tam("keyword", elem.keyword) .. viewers.tam("syn", elem.syn)
tt = tt .. viewers.tam("need", elem.need) .. viewers.tam("prop", elem.prop) .. viewers.tam("prop_default", elem.prop_default) .. viewers.tam("format", elem.format)
tt = string.sub(tt, 3, -1)
t = t .. '\n: ' .. tostring(key) .. ' = { ' .. tt .. ' } '
Ligne 6 199 ⟶ 5 889 :
local memo = viewers.save_configs("modes.get_default_args") -- Save global configuration before eventual changes.
local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = { }
-- ["QITEM"] = { ["typ"] = "dat", ["need"] = 0"noevent", ["keyword"] = "QITEM", ["prop"] = "QITEM", ["prop_default"] = "Q307", },
-- keep Galilée (Q307), avoid Victor Hugo (Q535), Rudyard Kipling (Q34743),
-- Galilée (Q307), Victor Hugo (Q535), Aristote (Q868), Albert Einstein (Q937), Mohandas Karamchand Gandhi (Q1001), Christophe Colomb (Q7322),
-- Nelson Mandela (Q8023), Rudyard Kipling (Q34743), Martin Fleischmann (Q899264), Emmanuel Macron (Q3052772)
-- ["QITEM"] = { ["typ"] = "dat", ["need"] = 0"noevent", ["keyword"] = "QITEM", ["prop"] = "QITEM", prop_default = "Q34743", },
for key, one_arg in pairs(args_known) do
if type(one_arg) == "table" then
Ligne 6 306 ⟶ 5 996 :
 
function modes.init_args_mode_options(mix, mode_name, args_template) -- Imports and mixes args mode and options from template and invoke
-- GuidelineTactic: Any combination of options can define a mixture of options to modify options.
-- This function allows any module to modify this process.
-- The default process gives the priority to options from arguments.
Ligne 6 343 ⟶ 6 033 :
 
function modes.args_mixer(args_template) -- S170703amo
-- GuidelineTactic: Any combination of templates can define a mixture of arguments to modify arguments.
-- This function allows any module to modify this process.
-- The default process gives the priority to templates arguments.
Ligne 6 378 ⟶ 6 068 :
 
function modes.options_mixer(args_template) -- S170703amo
-- GuidelineTactic: Any combination of options can define a mixture of options to modify options.
-- This function allows any module to modify this process.
-- The default process gives the priority to options from arguments.
Ligne 6 419 ⟶ 6 109 :
 
function modes.import_args_mode_options(args_template) -- Import and mix args mode and options from template and invoke -- S170703amo
-- GuidelineTactic: Any combination of options can define a mixture of options to modify options.
-- This function allows any module to modify this process.
-- The default process gives the priority to options from arguments.
Ligne 6 460 ⟶ 6 150 :
end
t = t .. "<br>" .. viewers.ta("cherche", cherche) .. viewers.ta("trouve1", trouve1) .. viewers.ta("min1", min1) .. viewers.ta("trouve2", trouve2) .. viewers.ta("min2", min2) .. " " .. t
if trouve1 and (min1 == 0) then t = t .. viewers.styles_color_wikidata(viewers.ta("connu", trouve1)) end
if trouve1 and (min1 <= diffmaxi) then t = t .. viewers.styles_color_wikidata(viewers.ta("min1 "..min1.."<="..diffmaxi, trouve1)) end
if trouve2 and (min2 <= diffmaxi) then t = t .. viewers.styles_color_wikidata(viewers.ta("min2 "..min2.."<="..diffmaxi, trouve2)) end
if trouve3 and (min3 <= diffmaxi) then t = t .. viewers.styles_color_wikidata(viewers.ta("min3 "..min3.."<="..diffmaxi, trouve3)) end
return trouve1, min1, trouve2, min2, t
end -- function modes.similar_args_search(search, list)
Ligne 6 506 ⟶ 6 196 :
datas.prop, datas.props = datas.get_item(modes.args_unknown, QITEM) -- Get datas from mw.wikibase for the page.
-- Try to read all known arguments. Intentar leer todos los argumentos conocidos. Essayer de lire tous les arguments connus.
local local_need, one_arg = 0, {} -- to select
for key_known, argm in pairs(args_known) do
local headers = "modes_args_known_report_headers" -- "key; val; type; need; keyword; syn; prop; format; source"
if type(argm) == "table" then
-- [[ Tactic NOWNOW CentralManual need=0=noevent need=1=depend keyword+default event need=2=permit default need=3=enforce default
argm.src = nil
for key_known, one_arg in pairs(args_known) do
argm.trk = " n"
if args_known["keyword"] and args_known["keyword"]["need"] then local_need = args_known["keyword"]["need"] end -- need=0=noevent
if type(one_arg) == "table" then -- events.add_err(
if (args_known["keyword"] == one_arg["keyword"]) and (local_need == "enforce" ) then -- need=3=enforce default
one_arg["val"] = args_known["keyword"]["prop_default"] -- Wanted even if nil.
elseif (args_known["keyword"] == one_arg["keyword"]) and (local_need == "default" ) then -- need=2=permit default
one_arg["val"] = args_known["keyword"]["prop_default"]
elseif (args_known["keyword"] == one_arg["keyword"]) and (local_need == "default" ) then -- need=1=depend keyword+default event
one_arg["val"] = args_known["keyword"]["prop_default"]
elseif (args_known["keyword"] == one_arg["keyword"]) and (local_need == "" ) then -- need=0=noevent
one_arg["val"] = args_known["keyword"]["prop_default"]
end
one_arg.src = nil
one_arg.trk = " n"
key_known_init = key_known
-- first initialise each known argument
modes.import_arguments_track = tostring(modes.import_arguments_track) .. " - " .. tostring(key_known)
argm_synone_arg_syn = args_known[argmone_arg.keyword]
ARGS.add(viewers.ARGS, 1, "args_known for", { key = key_known, NargmNone_arg = lua_table.level_count(argmone_arg), syn = argmone_arg.syn, } ) -- ARGS.t
if argmone_arg.syn == 2 then
-- Name an unnamed argument, positional, by its synonym. Nommer un argument non nommé, numéroté, par son synonyme.
-- Rename a named argument, by its synonym. Renommer un argument nommé, par son synonyme.
-- argm_origone_arg_orig = key_known -- DEBUG
key_known = argmone_arg.keyword
-- synonyms are defined with the stamp "syn = 2", then here stamp the basic argument with "syn = 1".
args_known[key_known].syn = 1
argmone_arg = args_known[key_known] -- new variable argmone_arg
argmone_arg.src = nil
argmone_arg.trk = "s"
modes.import_arguments_track = tostring(modes.import_arguments_track) .. ">" .. tostring(key_known)
end
Ligne 6 530 ⟶ 6 233 :
arg_found = false
argval = nil
argmone_arg.trk = argmone_arg.trk.."="
-- Import a wikidata argument. Importer un argument wikidata
if type(datas.props) == "table" and datas.props[key_known] then
argmone_arg["val"] = datas.props[key_known]
argval = datas.props[key_known]
argmone_arg.src = "wd"
argmone_arg.trk = argmone_arg.trk.."w"
if argm_origone_arg_orig then
-- args_known[argm_origone_arg_orig].src = "wd"
-- args_known[argm_origone_arg_orig].trk = (args_known[argm_origone_arg_orig].trk or "").."w"
end
arg_found = true
Ligne 6 551 ⟶ 6 254 :
-- if argval then -- the argument value exist and come from template else from invoke else from wikidata
argval = args_source[arglingual]
argmone_arg.src = "args"
argmone_arg.trk = argmone_arg.trk.." a"
arg_found = true
local arg_values = content_translations[argmone_arg.arg_values]
if argmone_arg.keys_values and arg_values then
-- The argument is limited to multiple values with arg_values and keys_values, and the values are defined.
local pos = string.find(arg_values, argval)
if pos then
-- The value of the argument is in the multiple values of the arguments.
-- argmone_arg.src = "args"
argmone_arg.trk = argmone_arg.trk.."m"
-- arg_found = true
if argm_origone_arg_orig then
-- args_known[argm_origone_arg_orig].src = "args"
-- args_known[argm_origone_arg_orig].trk = (args_known[argm_origone_arg_orig].trk or "").."d"
end
else
events.add_err("modes_args_values_err", argmone_arg.keyword, argval, arg_values)
-- function events.add_err( local_need == 2
-- case.res = events.add_record(case.typ, case.key, case.vals ) -- Add a new error, warning or category in a list. function events.add_record(
-- return { case.typ, case.key, case.need, case.res, }
-- function modes.import_arguments(args_known, case.typ, case.key, case.need, case.res events.add_err( local_need == 2
-- argval = nil
end
else
-- argmone_arg.src = "args"
argmone_arg.trk = argmone_arg.trk.."c"
-- arg_found = true
if argm_origone_arg_orig then
-- args_known[argm_origone_arg_orig].src = "args"
-- args_known[argm_origone_arg_orig].trk = (args_known[argm_origone_arg_orig].trk or "").."c"
end
end
Ligne 6 589 ⟶ 6 296 :
key_N = tonumber(key_known_init)
if key_N and not args_known[key_N] then
events.add_err("modes_too_unnamed_arguments_err", key_N, argval) -- local_need
events.add_cat("versions_with_usage_error_cat")
end
-- Record the argument. Guarde el argumento. Enregistrer l'argument.
if arg_found == true then
argmone_arg.found = argmone_arg.found + 1 -- count redifined arguments
argmone_arg.val = argval
args_import[key_known] = argval -- received international arguments table
if modes.args_unknown[arglingual] then
Ligne 6 604 ⟶ 6 311 :
end
-- modes.import_arguments: after import itself, some surrounding checks.
for key_known, argmone_arg in pairs(args_known) do -- For all known arguments
-- Redefined arguments. Argumentos redefinieron. Arguments redéfinis.
-- synonyms are defined with the stamp "syn = 2", then here stamp the basic argument with "syn = 1".
if argmone_arg.keyword and args_known[argmone_arg.keyword] and args_known[argmone_arg.keyword].syn then -- if the argument is a synonym, increase the found level
if argmone_arg.found and (argmone_arg.found > 2) then
events.add_err("modes_value_re_defined_err", (argmone_arg["keyword"] or "**") ) --.. ">2")
events.add_cat("versions_with_usage_error_cat")
end
else
if argmone_arg.found and (argmone_arg.found > 1) then
events.add_err("modes_value_re_defined_err", (argmone_arg["keyword"] or "**") ) --.. ">1")
events.add_cat("versions_with_usage_error_cat")
end
Ligne 6 622 ⟶ 6 329 :
-- need = 2 necessary from argument or module interaction
-- Missing Arguments. Argumentos que faltan. Arguments manquants.
if argmone_arg.need and (argmone_arg.need == 1) and (not argm.val) then
arglingual = content_translations[key_known]
if arglingual then
Ligne 6 999 ⟶ 6 706 :
end -- function modes.init_modes_translate_events(frame, Central_version, mode_name, args_known, options_for_modes, QITEM)
 
-- { "20181204", "20181204", "todo", "Rical", "S181204SCi", "For 'Begin' function modes.get_args_datas(args_known) Simplify Central.init" },
-- p_template_drop_box_name = 'Cuadro desplegable', -- Equivalent templates exist in other wikis
-- { "20181203", "20181204", "todo", "Rical", "S181203mad", "For 'Begin' rename function modes.get_args_datas( to modes.get_mode_args_datas( To simplify Central.init" },
-- p_template_drop_box_name = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.form
-- function modes.get_mode_args_datas(args_known) -- S181203mad To simplify Central.init S181204SCi
-- p_template_drop_box_name = 'Drop-down box', -- Template: Drop-down box for drop_box.form
function modes.get_args_datas(args_known) -- Applies the Tatic for (err, wng, cat) S181124Dng
-- p_template_drop_box_name = 'Cuadro desplegable', -- Modelo: cuadro desplegable :Boîte déroulante for drop_box.form
-- ["QITEM"] = { ["typ"] = "dat", ["need"] = "default", ["keyword"] = "QITEM", ["prop"] = "QITEM", ["prop_default"] = "Q307", }, -- Galilée
-- datas.entity = mw.wikibase.getEntity(datas.QITEM or datas.default_item or "Q34743" ) -- Rudyard Kipling
-- Tactic : p.args_known redefines arguments from submodules then avoid their tactics.
-- Tactic : if the ["QITEM"] = don't exists do not query datas.item.
-- Tactic : if the ["keyword"] = "QITEM" don't exists do not query datas.item.
-- Tactic : if ["QITEM"] exists the decreasing priorities are : .
-- Tactic : if ["prop"] = "QITEM" try to query mw.wikibase.getEntity(...)
-- Tactic : then if not datas.item then try ["prop_default"] = "Q307" -- Galilée
-- Tactic : no other priority. Tactic todo
local args_known = args_known or modes.args_known or p.args_known or {}
local args_known_local = mw.clone(args_known)
local group, one_data, one_QITEM = {}, {}, {}
for i, one_arg in pairs(args_known_local) do
if not one_arg.prop then one_arg.prop = one_arg.prop_default end
if one_arg.prop then
one_arg.prop = datas.one_prop(one_arg)
one_arg["val"] = one_arg.prop
-- function datas.one_prop(one_arg) -- Get datas from mwwikibase for one property of the page.
-- elseif one_arg["prop"] == "labeluser" then one_arg["val"] = mw.wikibase.getLabelByLang(datas.QITEM, langs.user_lang ) -- Rudyard Kipling
-- return one_arg
end
if one_arg["QITEM"] then
-- function datas.get_item(args_known, QITEM) -- Get datas from mw.wikibase for the page.
-- datas.props = props
-- datas.prop = prop
-- return prop, props
datas.prop, datas.props = datas.get_item(args_known, one_arg["QITEM"]) -- Get datas from mwwikibase for one property of the page. function datas.get_item(
if not datas.props then
one_arg["QITEM"] = one_arg.prop_default
datas.prop, datas.props = datas.get_item(args_known, one_arg["QITEM"]) -- function datas.get_item(args_known, one_arg["QITEM"])
one_arg["val"] = datas.prop
end
if datas.props then one_arg["val"] = datas.props end
end
end -- modes.get_args_datas(t) is empty
return args_known
end -- args_known = modes.get_args_datas(args_known)
 
modes.get_args_datas_tests_group = { -- Table of the definitions of all known arguments at module level.
["QITEM"] = { ["typ"] = "dat", ["keyword"] = "QITEM", ["prop"] = "Q1001", ["prop_default"] = "Q307", }, -- Galilée
["label"] = { ["typ"] = "dat", ["keyword"] = "label" , ["prop"] = "label", ["prop_default"] = "label", },
["mode"] = { ["typ"] = "mode", ["keyword"] = "mode", ["prop"] = "edit", ["Tactic"] = "canbenil;nevererror", ["prop_default"] = "read", },
["labelcontent"] = { ["typ"] = "arg", ["keyword"] = "labelcontent",["prop"] = "labelcontent", ["prop_default"] = "Q307", }, -- Galilée
["labelpage"] = { ["typ"] = "arg", ["keyword"] = "labelpage", ["prop"] = "labelpage", ["prop_default"] = "Q307", }, -- Galilée
["labeluser"] = { ["typ"] = "arg", ["keyword"] = "labeluser", ["prop"] = "labeluser", ["prop_default"] = "Q307", }, -- Galilée
["labelbylang"] = { ["typ"] = "arg", ["keyword"] = "labelbylang",["prop"] = "labelbylang", ["prop_default"] = "Q307", }, -- Galilée
["birthyear"] = { ["typ"] = "dat", ["keyword"] = "birthyear", ["prop"] = "P569", ["format"] = "year", ["prop_default"] = "P570", }, -- birthyear else deathyear
["deathyear"] = { ["typ"] = "dat", ["keyword"] = "birthyear", ["prop"] = "P570", ["format"] = "year", ["prop_default"] = "P569", }, -- deathyear else birthyear
["birthyear"] = { ["typ"] = "err", ["keyword"] = "birthyear", ["prop"] = "WANTED ERROR", ["format"] = "year", ["prop_default"] = "P570", }, -- ERROR deathyear
-- Galilée (Q307), Victor Hugo (Q535), Aristote (Q868), Albert Einstein (Q937), Mohandas Karamchand Gandhi (Q1001), Christophe Colomb (Q7322),
}
 
-- { "20181130", "20181203", "todo", "Rical", "S181130mgT", "function modes.get_args_datas_tests(t) Tactic all in one for modes args datas no args_final no origins" },
function modes.get_args_datas_tests(t) -- Test: events.need_tactic for (err, wng, cat)
local memo = viewers.save_configs("modes.get_args_datas_tests") -- Save global configuration before eventual changes.
local args_known = args_known or modes.args_known or p.args_known or {}
local t = t or "\n* <b>modes.get_args_datas(t)</b> -- Test: all kinds of events (err, wng, cat): "
local group = {}
for i, one_event in pairs(modes.get_args_datas_tests_group) do
-- TO TAKE IN ACCOUNT
-- datas.prop, datas.props = datas.get_item(args_known, one_arg["QITEM"]) -- Get datas from mwwikibase for one property of the page. function datas.get_item(
-- t = t .. viewers.ta("keyword", one_event.keyword) .. viewers.ta("prop", one_event.prop) .. viewers.ta("prop_default", one_event.prop_default)
table.insert(group, one_event)
end -- modes.get_args_datas(t) is empty
local tab_view = { -- Group datas and options for a table view with lines and columns.
test_group = group, -- Use default cases
title_memo = "events_one_event_test_title", -- "events.all_kinds_test() Test: all kinds of events (err, wng, cat)",
headers_class = "wikitable alternative center sortable",
headers = "events_all_kinds_tests_headers", -- "typ;key;idargs;result"
headers = " arg name; type; property; prop_default; value",
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
return { tostring(case.keyword), tostring(case.typ), tostring(case.prop), tostring(case.prop_default) , tostring(case.val) }
end,
rowGroup = {},
-- track_on = true,
}
-- res = res .. drop_box.new(selector, "modes_get_args_datas_tests_title", modes.get_args_datas_tests)
t = t .. tableview.new(tab_view) -- Formats a table view with lines and columns.
viewers.restore_configs(memo, "modes.get_args_datas_tests") -- Restore global configurations after eventual changes.
return t
end -- t = t .. modes.get_args_datas_tests(t) -- Tests
 
-- cut_libraries
 
-- - - - ------------------ - - - - ------------------ - - - - -----------------------------
-- - - - ------------------ - - - - ------------------ - - - - -----------------------------
-- The Library:events supports events of types erros, warnings and categories.
-- viewers.save_configs("events.save_configs" memo, tab_view, group ) -- Init a new events group
-- events.add_err(key, ... ) -- Add an error in the actual table of events.
-- events.add_cat_group(groupCat, groupList) -- Add some categories in the actual table of events.
-- events.form(evt) -- Format events types
-- events.all_categories_test(t) -- test categories
-- - - - ------------------ - - - - ---------------------------------
-- - - - ------------------ - - - - ---------------------------------
 
-- events = {} -- already declared by Scribunto, see central_library.new() -- Record a library in package.loadedS
 
events.i18n = {} -- Translations for Library:events
events.i18n.br = {
events_test_tests_title = "List a table, test with limits:",
events_test_resTest_title = "List a table, test with limits:",
events_test_projects_title = "Test and display tests events for projects",
events_test_projects_headers = "Type;Key;Name test and values;result of the test",
events_test_MediaWiki_title = "Test and display tests events for MediaWiki",
events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test",
events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues",
events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)",
events_all_kinds_tests_headers = "typ;key;idargs;result",
events_add_cat_deprecated = "Fonction obsolète dans le module principal.",
events_close_without_memo_err = "viewers.restore_configs(memo, where) sans <b>memo</b> dans le module <b>%1</b>.",
events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.",
} -- events.i18n.br
events.i18n.en = {
events_test_tests_title = "List a table, test with limits:",
events_test_resTest_title = "List a table, test with limits:",
events_test_projects_title = "Test and display tests events for projects",
events_test_projects_headers = "Type;Key;Name test and values;result of the test",
events_test_MediaWiki_title = "Test and display tests events for MediaWiki",
events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test",
events_test_categ_Test_title = "categ_Test test : classes in some languages",
events_all_kinds_tests_title = "events.all_kinds_test() Test: all kinds of events (err, wng, cat)",
events_all_kinds_tests_headers = "typ;key;idargs;result",
events_close_without_memo_err = "viewers.restore_configs(memo, where) without <b>memo</b> in module <b>%1</b>.",
events_antiCrash_protect_err = "The antiCrash() function protects this page against a complete crash due to an internal error: %1.",
} -- events.i18n.en
events.i18n.es = {
events_test_tests_title = "List a table, test with limits:",
events_test_resTest_title = "List a table, test with limits:",
events_test_projects_title = "Test and display tests events for projects",
events_test_projects_headers = "Type;Key;Name test and values;result of the test",
events_test_MediaWiki_title = "Test and display tests events for MediaWiki",
events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test",
events_test_categ_Test_title = "Prueba categ_Test: clases en algunos lenguajes",
events_all_kinds_tests_title = "events.all_kinds_test() Prueba: todo tipo de eventos (err, wng, cat)",
events_all_kinds_tests_headers = "typ;key;idargs;result",
events_add_cat_deprecated = "Función obsoleto en módulo principal.",
events_close_without_memo_err = "viewers.restore_configs(memo, where) sin <b>memo</b> en el módulo <b>%1</b>.",
events_antiCrash_protect_err = "La función antiCrash() protege esta página contra un colapso completo debido a un error interna: %1.",
} -- events.i18n.es
events.i18n.fr = {
events_test_tests_title = "List a table, test with limits:",
events_test_resTest_title = "List a table, test with limits:",
events_test_projects_title = "Test and display tests events for projects",
events_test_projects_headers = "Type;Key;Name test and values;result of the test",
events_test_MediaWiki_title = "Test and display tests events for MediaWiki",
events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test",
events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues",
events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)",
events_all_kinds_tests_headers = "typ;key;idargs;result",
events_add_cat_deprecated = "Fonction obsolète dans le module principal.",
events_close_without_memo_err = "viewers.restore_configs(memo, where) sans <b>memo</b> dans le module <b>%1</b>.",
events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.",
} -- events.i18n.fr
events.i18n.hu = {
events_test_tests_title = "List a table, test with limits:",
events_test_resTest_title = "List a table, test with limits:",
events_test_projects_title = "Test and display tests events for projects",
events_test_projects_headers = "Type;Key;Name test and values;result of the test",
events_test_MediaWiki_title = "Test and display tests events for MediaWiki",
events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test",
events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues",
events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)",
events_all_kinds_tests_headers = "typ;key;idargs;result",
events_add_cat_deprecated = "Fonction obsolète dans le module principal.",
events_close_without_memo_err = "viewers.restore_configs(memo, where) sans <b>memo</b> dans le module <b>%1</b>.",
events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.",
} -- events.i18n.hu
events.i18n.vi = {
events_test_tests_title = "List a table, test with limits:",
events_test_resTest_title = "List a table, test with limits:",
events_test_projects_title = "Test and display tests events for projects",
events_test_projects_headers = "Type;Key;Name test and values;result of the test",
events_test_MediaWiki_title = "Test and display tests events for MediaWiki",
events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test",
events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues",
events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)",
events_all_kinds_tests_headers = "typ;key;idargs;result",
events_add_cat_deprecated = "Fonction obsolète dans le module principal.",
events_close_without_memo_err = "viewers.restore_configs(memo, where) sans <b>memo</b> dans le module <b>%1</b>.",
events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.",
} -- events.i18n.vi
 
 
function events.add_record(typ, key, ... ) -- Add a new error, warning or category in a list.
-- Guide line: all events are in a single table, including categories, without duplication.
-- Guide line: without duplication: events differ if the type, the key or any value of any argument differs.
-- Guide line: We can view or categorize categories.
local intern_or_use = versions.memo_i18n["en"][key]
local evt = events.new(typ, key, ...) -- Initialize and finalize a new event.
local evt = events.add_new(evt) -- Add an error, warning or category in the lists. S170626rev
local res, evt = events.form(evt, c) -- Format an event as an error, warning or category.
events.one_event = evt
return res, evt
end -- local res, evt = events.add_record(typ, key, ... )
 
function events.form(one_event, vals) -- Format an event as an error, warning or category or data.
local one_event = mw.clone(one_event or {}) -- do not disturb input event
-- one_event.res = tostring(one_event.res) .. "? form " .. viewers.form9tests(".form one_event.key=%1, one_event.res=%2, ", one_event.key, one_event.res )
if type(one_event) ~= "table" then
local one_event = {}
one_event.res = lua_table.rough_view(one_event)
return one_event.res, one_event
end
if (one_event.typ ~= "cat") and (one_event.typ ~= "wng") and (one_event.typ ~= "err") then
one_event.res = lua_table.rough_view(evt)
return one_event.res, evt
end
one_event.tableStyle = one_event.tableStyle or "" -- Could change the style of the wikitext. Not available on 20160916
if type(one_event.name) ~= "string" then one_event.name = ""
elseif one_event.name ~= "" then one_event.name = one_event.name .. "_" end
one_event.idargs = one_event.name .. tostring( viewers.form9user( tostring(one_event.key), lua_table.to_list( one_event.vals ) ) )
-- Each type of event formats its own type of wikitext
one_event.content_wkt = viewers.form9content(one_event.key, lua_table.to_list( one_event.vals ) )
one_event.page_wkt = viewers.form9page(one_event.key, lua_table.to_list( one_event.vals ) )
one_event.user_wkt = viewers.form9user(one_event.key, lua_table.to_list( one_event.vals ) )
one_event.res = "" -- multilingual
if one_event.typ == "err" then one_event.res = viewers.styles_color_error(one_event.user_wkt) end
if one_event.typ == "wng" then one_event.res = viewers.styles_color_warning(one_event.user_wkt) end
one_event.ccc = c or one_event.catview or events.catview or ":"
one_event.content_catspace = mw.site.namespaces.Category.name -- name: Local namespace name.
if one_event.typ == "cat" then -- Format a category to display or activate
one_event.res = events.form_cat(one_event)
-- If needed, add a second "Category:Module with internal error" S180604crm
if viewers.is_in("_i_cat", key) then res = res .. events.add_cat("versions_with_internal_error") end
if viewers.is_in("_i_err", key) then res = res .. events.add_cat("versions_with_internal_error") end
-- If needed, add a second "Category:Module with user error"
if viewers.is_in("_u_cat", key) then res = res .. events.add_cat("versions_with_user_error") end
if viewers.is_in("_u_err", key) then res = res .. events.add_cat("versions_with_user_error") end
end
local one_event_data
if (one_event.need == "noevent") then one_event.res = nil end
if (one_event.need == "default") and one_event.res == nil then one_event.res = one_event.prop_default end
if (one_event.need == "enforce") then one_event.res = one_event.prop_default end
if (one_event.need == "data") then
one_event_data = datas.one_prop(one_event) -- Get datas from mwwikibase for one property of the page. function datas.one_prop
one_event.res = one_event_data.val end -- one_arg_properties
-- { ["typ"] = "cat", ["need"] = "data", ["prop_default"] = "P1559", ["key"] = "Q535", ["vals"] = {}, }, -- Property:P1559 ⋅ Property:P1559 ⋅ actions Victor hugo
return one_event.res, one_event
end -- function events.form(one_event, vals) -- Format an event as an error, warning or category or data
 
events.need_one_event_test_group = {
{ ["typ"] = "err", ["need"] = "default", ["prop_default"] = "England", ["key"] = "versions_module_with_error_err", },
{ ["typ"] = "cat", ["need"] = "default", ["prop_default"] = "France", ["key"] = "p_authors_birthyear_cat", },
{ ["typ"] = "err", ["need"] = "default", ["prop_default"] = "España", ["key"] = "modes_no_known_arguments_err", ["vals"] = {}, },
{ ["typ"] = "cat", ["need"] = "default", ["prop_default"] = "Paris", ["key"] = "modes_no_known_arguments_i_cat", ["vals"] = {}, },
{ ["typ"] = "err", ["need"] = "default", ["prop_default"] = "Madrid", ["key"] = "modes_no_source_arguments_err", ["vals"] = {}, },
{ ["typ"] = "cat", ["need"] = "default", ["prop_default"] = "England", ["key"] = "modes_no_source_arguments_cat", ["vals"] = {}, },
{ ["typ"] = "cat", ["need"] = "default", ["prop_default"] = "España", ["key"] = "versions_err_module_miss_i18n_cat", ["vals"] = {}, },
{ ["typ"] = "data", ["need"] = "default", ["prop_default"] = "P1559", ["key"] = "Q535", ["vals"] = {}, },
} -- events.need_one_event_test_group
-- Guide line NOWNOW CentralManual need=0="noevent" need=1=depend keyword+default event need=2=permit default need=3=enforce default
-- Guide line ["need"] = 0, ["need"] = "noevent", ["need"] = 1, ["need"] = "default", ["need"] = 2, ["need"] = "default", ["need"] = 3, ["need"] = "enforce",
 
function events.need_tactic(one_event, ...) -- Formats one_event according to need in known_args or datas_args (err, wng, cat)
local one_event = mw.clone(one_event) -- Do not disturb initial known_args or datas_args.
one_event.vals = lua_table.to_list( ... )
-- if type(one_event.vals) ~= "table" then one_event.vals[1] = "nil table" end
-- if type(one_event.vals) == {} then one_event.vals[1] = "empty table" end
local one_event = events.new(one_event.typ, one_event.key, one_event.vals) -- Initialize and finalize a new event.
local one_event = events.add_new(one_event) -- Add an error, warning or category in the lists. S170626rev
return one_event
end -- local one_event = events.all_kinds_test(t)
 
 
-- old right version begin
 
 
 
function events.add_cat(key, ... ) -- Add a category in the actual table of events.
return events.add_record("cat", key, ...) -- Add a error, warning or category in the lists. S170626rev
end
 
function events.add_err(key, ... ) -- Add an error in the actual table of events.
return events.add_record("err", key, ...) -- Add a error, warning or category in the lists. S170626rev
end
 
function events.add_wng(key, ... ) -- Add a warning in the actual table of events.
return events.add_record("wng", key, ...) -- Add a error, warning or category in the lists. S170626rev
end
 
function events.form_cat(evt, txt, lnk, c, space)
local evt = evt or events.one_event
local space = space or (mw.site.namespaces.Category.name .. ":")
local c = c or evt.ccc or ":"
if evt.typ == "cat" then -- Format a category to display or activate
evt.content_wkt = viewers.form9content(evt.key, lua_table.to_list( evt.vals ) )
evt.page_wkt = viewers.form9page(evt.key, lua_table.to_list( evt.vals ) )
evt.user_wkt = viewers.form9user(evt.key, lua_table.to_list( evt.vals ) )
return " [[" .. c .. space .. (evt.content_wkt or lnk) .. "|" .. (evt.user_wkt or txt) .. "]] "
else
return ""
end
end
 
events.list_all_events = {} -- Table to collect all events types "err", "wng" and "cat".
 
function events.new(typ, key, ...) -- Initialize and finalize a new event.
local evt = {} -- default event
if type(typ) == "table" then
evt = typ -- Use a predefined event
else -- To finalize an existing event.
evt.typ = typ
evt.key = key
end -- Finalize all events
evt.typ = evt.typ or typ -- Type of event: err, wng, cat
evt.key = evt.key or key -- Translation key, simple or extended by name
if type(typ) ~= "string" then typ = "notyp" end -- To debug abnormal type of event
if type(key) ~= "string" then key = "nokey" end -- To debug abnormal translation key
evt.name = evt.typ or evt.key or "name" -- Translation key, simple or extended by name
evt.vals = evt.vals or { ... } -- table of arguments values
evt.catview = evt.catview or ":" -- Default value for eventual use
-- Check, yes or no, to form an event, in special cases
if (evt.typ == "cat") then
evt.res, evt = events.form( evt ) -- Formats the resulting wikitext, can be re-form later
elseif (evt.typ == "err") then
evt.res, evt = events.form( evt ) -- Formats the resulting wikitext, can be re-form later
elseif (evt.typ == "wng") then
evt.res, evt = events.form( evt ) -- Formats the resulting wikitext, can be re-form later
end
events.one_event = evt
return evt
end -- function events.new(typ, key, ...)
 
function events.add_new(evt) -- Add a error, warning or category in the lists. S170626rev
local evt = evt or events.one_event
-- Select only new events
if type(evt) ~= "table" then evt = {} end
local new_evt = viewers.form9tests( tostring(evt.key), lua_table.to_list( evt.vals ) )
for i, event in pairs(events.list_all_events) do
local old_evt = viewers.form9tests( tostring(event.key), lua_table.to_list( event.vals ) )
if new_evt == old_evt then new_evt = nil ; break end -- Add only new events. Reject already seen events.
end
-- events.add_wng("modes_auto_val_warning_wng", langs.user_translations[key], val) -- form_result
if new_evt then table.insert(events.list_all_events, evt) end
events.one_event = evt
return evt
end -- function events.add_new(typ, ref, ...)
 
function events.add_record(typ, key, ... ) -- Add a new error, warning or category in a list.
-- Guide line: all events are in a single table, including categories, without duplication.
-- Guide line: without duplication: events differ if the type, the key or any value of any argument differs.
-- Guide line: We can view or categorize categories.
local intern_or_use = versions.memo_i18n["en"][key]
local evt = events.new(typ, key, ...) -- Initialize and finalize a new event.
local evt = events.add_new(evt) -- Add an error, warning or category in the lists. S170626rev
local res, evt = events.form(evt, c) -- Format an event as an error, warning or category.
events.one_event = evt
return res, evt
end -- local res, evt = events.add_record(typ, key, ... )
 
function events.form(evt, c) -- Format an event as an error, warning or category.
local evt = evt or events.one_event
evt.res = tostring(evt.res) .. "? form " .. viewers.form9tests(".form evt.key=%1, evt.res=%2, ", evt.key, evt.res )
local evt = mw.clone(evt) -- do not disturb input event
if type(evt) ~= "table" then
evt.res = lua_table.rough_view(evt)
return evt.res, evt
end
if (evt.typ ~= "cat") and (evt.typ ~= "wng") and (evt.typ ~= "err") then
evt.res = lua_table.rough_view(evt)
return evt.res, evt
end
evt.tableStyle = evt.tableStyle or "" -- Could change the style of the wikitext. Not available on 20160916
if type(evt.name) ~= "string" then evt.name = ""
elseif evt.name ~= "" then evt.name = evt.name .. "_" end
evt.idargs = evt.name .. tostring( viewers.form9user( tostring(evt.key), lua_table.to_list( evt.vals ) ) )
-- Each type of event formats its own type of wikitext
evt.content_wkt = viewers.form9content(evt.key, lua_table.to_list( evt.vals ) )
evt.page_wkt = viewers.form9page(evt.key, lua_table.to_list( evt.vals ) )
evt.user_wkt = viewers.form9user(evt.key, lua_table.to_list( evt.vals ) )
evt.res = "" -- multilingual
if evt.typ == "err" then evt.res = viewers.styles_color_error(evt.user_wkt) end
if evt.typ == "wng" then evt.res = viewers.styles_color_warning(evt.user_wkt) end
evt.ccc = c or evt.catview or events.catview or ":"
evt.content_catspace = mw.site.namespaces.Category.name -- name: Local namespace name.
if evt.typ == "cat" then -- Format a category to display or activate
evt.res = events.form_cat(evt)
if viewers.is_in("_i_cat", key) then -- If needed, add a second "Category:Module with internal error"
res = res .. events.add_cat("versions_with_internal_error")
end
if viewers.is_in("_u_cat", key) then -- If needed, add a second "Category:Module with user error"
res = res .. events.add_cat("versions_with_user_error")
end
end
events.one_event = evt
return evt.res, evt
end -- function events.form(evt, c)
 
-- if case.code == langs.content_lang then case.content = case.count ; total_stat.content = total_stat.content + case.count end
-- if case.code == langs.page_lang then case.page = case.count ; total_stat.page = total_stat.page + case.count end
-- if case.code == langs.user_lang then case.user = case.count ; total_stat.user = total_stat.user + case.count end
events.get_vals = {}
modes.args_known = modes.args_known or p.args_known or {}
events.all_kinds_test_group = {
--- { ["typ"] = "cat", ["need"] = 0, ["prop_default"] = "España", ["key"] = "p_authors_birthyear_cat", ["vals"] = { modes.args_known["birthyear"], langs.page_lang, events.one_event.vals[3]},
-- ["wikibase"] = "England", },
{ ["typ"] = "err", ["need"] = 0, ["prop_default"] = "Madrid", ["key"] = "versions_module_with_error_err", ["vals"] = {},
["wikibase"] = "England in the UK and Europe.svg", },
{ ["typ"] = "err", ["need"] = 1, ["prop_default"] = "Paris", ["key"] = "versions_module_with_error_err", ["vals"] = {},
["wikibase"] = "St Paul Cathedral.png", },
{ ["typ"] = "err", ["need"] = 2, ["prop_default"] = "England", ["key"] = "versions_module_with_error_err", ["vals"] = {},
["wikibase"] = "España", },
-- { ["typ"] = "cat", ["need"] = "3", ["prop_default"] = "France", ["key"] = "p_authors_birthyear_cat", ["vals"] = { modes.args_known["birthyear"],
-- events.one_event.vals[2], events.one_event.vals[3]},
-- ["wikibase"] = "Flag_of_Spain.svg", },
-- { ["typ"] = "cat", ["need"] = 0, ["prop_default"] = "España", ["key"] = "p_authors_deathyear_cat", ["vals"] = { modes.args_known["deathyear"],
-- events.one_event.vals[2], events.one_event.vals[3]},
-- ["wikibase"] = "Panorama_Madrid_Ayuntamiento_20090417.jpg", },
{ ["typ"] = "cat", ["need"] = 1, ["prop_default"] = "val", ["key"] = "versions_err_module_miss_i18n_cat", ["vals"] = {},
["wikibase"] = "Madrid", },
{ ["typ"] = "err", ["need"] = 1, ["prop_default"] = "España", ["key"] = "modes_no_known_arguments_err", ["vals"] = {},
["wikibase"] = "France", },
{ ["typ"] = "cat", ["need"] = 2, ["prop_default"] = "Paris", ["key"] = "modes_no_known_arguments_i_cat", ["vals"] = {},
["wikibase"] = "flag of France.svg", },
{ ["typ"] = "err", ["need"] = 3, ["prop_default"] = "Madrid", ["key"] = "modes_no_source_arguments_err", ["vals"] = {},
["wikibase"] = "Tour Eiffel", },
{ ["typ"] = "cat", ["need"] = 1, ["prop_default"] = "England", ["key"] = "modes_no_source_arguments_cat", ["vals"] = {},
["wikibase"] = "Paris", },
{ ["typ"] = "cat", ["need"] = 1, ["prop_default"] = "España", ["key"] = "versions_err_module_miss_i18n_cat", ["vals"] = {},
["wikibase"] = "England", },
-- { ["typ"] = "err", ["need"] = 0, ["prop_default"] = "France", ["key"] = "modes_too_unnamed_arguments_err", ["vals"] = { events.one_event.vals[1], events.one_event.vals[2]},
-- ["wikibase"] = "England in the UK and Europe.svg", },
{ ["typ"] = "cat", ["need"] = 3, ["prop_default"] = "España", ["key"] = "versions_with_usage_error_cat", ["vals"] = {},
["wikibase"] = "St Paul Cathedral.png", },
{ ["typ"] = "err", ["need"] = 2, ["prop_default"] = "Madrid", ["key"] = "modes_value_re_defined_err", ["vals"] = { modes.args_known["keyword"], },
["wikibase"] = "España", },
{ ["typ"] = "cat", ["need"] = 0, ["prop_default"] = "Madrid", ["key"] = "versions_with_usage_error_cat", ["vals"] = {},
["wikibase"] = "Flag_of_Spain.svg", },
{ ["typ"] = "err", ["need"] = 1, ["prop_default"] = "England", ["key"] = "modes_value_re_defined_err", ["vals"] = { modes.args_known["keyword"], },
["wikibase"] = "Panorama_Madrid_Ayuntamiento_20090417.jpg", },
{ ["typ"] = "cat", ["need"] = 1, ["prop_default"] = "val", ["key"] = "versions_with_usage_error_cat", ["vals"] = {},
["wikibase"] = "Madrid", },
} -- mw.wikibase.description France
--[[ Guide line NOWNOW CentralManual need=0=no event need=1=depend keyword+default event need=2=permit default need=3=enforce default
And ["prop_default"] depends of need in function datas.one_arg_properties(
cats = cats .. events.add_cat("versions_err_module_miss_i18n_cat")
-- Save as ModuleCentralizer.lua ModuleCentralizer all_kinds_test list type=t key=k argument=i result=r to debug.lua
-- function events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat) NOWNOW
local evt = events.new(typ, key, ...) -- Initialize and finalize a new event.
local evt = events.add_new(evt) -- Add an error, warning or category in the lists. S170626rev
-- And ["prop_default"] depends of need in function modes.one_arg_check_need()
after : function p.interact_args_final(args_import, args_known)
if not a.initial then -- If initial is undefined, enforce it. This property (Q29882054) exist but is not used.
-- https://www.wikidata.org/wiki/Q29882054 La dernière modification de cette page a été faite le 2017-10-21 à 05:18:03.
--]]
 
function events.add_new_test(t) -- Test: all kinds of events (err, wng, cat)
local memo = viewers.save_configs("events.add_new_test") -- Save global configuration before eventual changes.
local evt = events.new(evt.typ, evt.key, evt.vals) -- Initialize and finalize a new event.
-- local vals = lua_table.to_list( ... ) )
local new_evt = viewers.form9tests( tostring(evt.key), lua_table.to_list( evt.vals ) )
local evt = events.add_new(evt) -- Add an error, warning or category in the lists. S170626rev
viewers.restore_configs(memo, "events.add_new_test") -- Restore global configurations after eventual changes.
return evt
end -- function events.all_kinds_test(t)
 
function events.all_kinds_test(t) -- Test: all kinds of events (err, wng, cat)
local memo = viewers.save_configs("events.all_kinds_test") -- Save global configuration before eventual changes.
events.all_kinds_trck = "\n* events.all_kinds_trck: "
local t = t or "\n* <b>events.all_kinds_test(t)</b> -- Test: all kinds of events (err, wng, cat): "
t = t .. events.all_kinds_trck
local tab_view = { -- Group datas and options for a table view with lines and columns.
test_group = events.all_kinds_test_group, -- Use default cases.
title_memo = "events_all_kinds_tests_title", -- "events.all_kinds_test() Test: all kinds of events (err, wng, cat)",
headers = "events_all_kinds_tests_headers", -- "typ;key;idargs;result",
headers_class = "wikitable alternative center sortable",
headers = " type; key; need; res",
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
case.res = events.add_record(case.typ, case.key, case.vals ) -- Add a new error, warning or category in a list. function events.add_record(
return { case.typ, case.key, case.need, case.res, }
end,
-- { ["typ"] = "cat", ["key"] = "modes_auto_val_warning_wng", ["need"] = 2, ["arg1"] = "langs.user_translations", ["prop_default"] = "France", ["wikibase"] = "flag of France.svg", },
rowGroup = {},
-- track_on = true, one_arg_properties mw.wikibase.description
}
t = t .. tableview.new(tab_view) -- Formats a table view with lines and columns.
t = t .. viewers.ta("#test_group", lua_table.level_count(tab_view.test_group) ) -- function tableview.new( nil bug170602
t = t .. viewers.ta("#rowGroup", lua_table.level_count(tab_view.rowGroup) ) -- function tableview.new( nil bug170602
viewers.restore_configs(memo, "events.all_kinds_test") -- Restore global configurations after eventual changes.
return t
end -- function events.all_kinds_test(t)
 
function events.add_cat_group(groupCat, groupList) -- Add some categories in the actual table of events. Separated by ";".
-- catGroup("Country %1", "France,Italia") -> [[Category:Country France]] [[Category:Country Italia]]
if type(groupCat) ~= "string" then groupCat = "%1" end
if type(groupList) ~= "string" then return "" end
local cats = ""
for i, str in mw.text.gsplit(groupList, ";", true) do
local wkt = viewers.form9user(groupCat, str)
cats = cats .. events.add_cat(groupCat, wkt)
end
local res, evt = events.add("catGroup", groupCat, cats) -- Add an event to a group.
evt.trc = evt.trc .. viewers.form9user("\n* add_cat evt.typ=%1, evt.key=%2, ", evt.typ, evt.key)
events.one_event = evt
return res, evt
end -- function events.add_cat_group(groupCat, groupList)
 
function events.select_typ(typ) -- Select events by one type
local is = {}
for i, evt in pairs(events.test_group) do
if evt.typ == typ then table.insert( is, evt.idargs ) end
end
return is
end
 
function events.sort_typ() -- Sort events by type in wng, err, cat.
local wng, err, cat = {}, {}, {}
for i, evt in pairs(events.test_group) do
if evt.typ == "wng" then table.insert( wng, evt ) end
if evt.typ == "err" then table.insert( err, evt ) end
if evt.typ == "cat" then table.insert( cat, evt ) end
end
return wng, err, cat
end -- function events.sort_typ()
 
function events.selector( tab_view, evt )
local evt = evt or events.one_event
if type(evt) ~= "table" then
evt = { -- options for tableview.new() -- Formats a table with lines and columns.
headers = "typ;key;selector-name;wkt",
style = "",
typ = "err",
rowGroup = {},
}
else
evt.headers = evt.headers or "typ;key;else-name;wkt"
evt.tableStyle = evt.tableStyle or ""
evt.name = evt.name or "_"
evt.typ = evt.typ or "nil"
end
if (type(tab_view) == "table") and (type(tab_view.typ) == "string") and (tab_view.typ == evt.typ) then
table.insert( tab_view.test_group, { evt.typ, evt.key, evt.name, evt.wkt } )
elseif (type(tab_view) == "table") and (type(tab_view.typ) == "string") and (tab_view.typ == "v") then
table.insert( tab_view.test_group, { evt.typ, evt.key, evt.name, evt.wkt } )
else
tab_view = {}
table.insert( tab_view.test_group, { evt.typ, evt.key, evt.name, evt.wkt } )
end
events.one_event = evt
end -- function events.selector( tab_view, evt )
 
function events.all_kinds_test_test(t) -- Test: all kinds of events (err, wng, cat)
local memo = viewers.save_configs("events.all_categories_test") -- Save global configuration before eventual changes.
local t = t or "\n* <b>events.all_kinds_test()</b> Test: all kinds of events (err, wng, cat)"
local tab_view = { -- Group datas and options for a table view with lines and columns.
test_group = nil, -- Use default cases.
title_memo = "events_all_kinds_tests_title", -- "events.all_kinds_test() Test: all kinds of events (err, wng, cat)",
headers = "events_all_kinds_tests_headers", -- "typ;key;idargs;result",
}
function tab_view.form_one_case(evt) -- Convert a case from test_group to rowGroup.
return { evt.typ, evt.key, evt.idargs, evt.res }
end
t = t .. tableview.new(tab_view) -- Form a table view with lines and columns.
viewers.restore_configs(memo, "events.all_kinds_test_test") -- Restore global configurations after eventual changes.
return t --, errors -- langs_missing_translations_title
end -- function events.all_kinds_test_test(t)
 
events.errors_list = {} -- Deprecated: Table to collect errors and warnings
events.erron = true -- Activated or not errors. Errores activado o no. Erreurs activées ou non.
events.categories_list = {} -- Table to collect all categories to generate in wikitext
 
function events.errors_lister(title, v1, v2, v3, v4, v5, v6, v7, v8, v9)
local res, msgref = "", ""
local mwtitle = mw.title.getCurrentTitle()
local page = tostring(mwtitle.nsText) .. ":" .. tostring(mwtitle.text)
if type(title) ~= "string" then title = "modes_error_list_header_err" end
res = res .. '\n*' .. viewers.form9user(title, page, v1, v2, v3, v4, v5, v6, v7, v8, v9) -- .. ' - ' .. page
local n = 0
for k, wng in ipairs(events.errors_list) do
msgref = viewers.form9user(wng.ref, wng.v1, wng.v2, wng.v3, wng.v4, wng.v5, wng.v6, wng.v7, wng.v8, wng.v9) -- texte traduit ou direct
if wng.typ == "wng" then
res = res .. '<br>⦁ ' .. viewers.styles_color_warning(msgref)
end
end
for k, wng in ipairs(events.errors_list) do
msgref = viewers.form9user(wng.ref, wng.v1, wng.v2, wng.v3, wng.v4, wng.v5, wng.v6, wng.v7, wng.v8, wng.v9) -- texte traduit ou direct
if wng.typ == "err" then
res = res .. '<br>⦁ ' .. viewers.styles_color_error(msgref)
n = n + 1
end
end
if n > 0 then
events.add_cat("versions_module_with_error_err")
end
return res
end -- function events.errors_lister(title, v1, v2, v3, v4, v5, v6, v7, v8, v9)
 
function events.gener_categories(args_final) -- Only for this library, form categories without activate them
local args_final = args_final
if type(args_final) ~= "table" then args_final = modes.args_final end
if args_final.birthyear then
events.add_cat("p_authors_birthyear_cat", args_final.birthyear)
end
if args_final.deathyear then
events.add_cat("p_authors_deathyear_cat", args_final.deathyear)
end
if args_final.description then
-- events.add_cat("p_authors_deathyear_cat", args_final.description)
end
return
end -- function events.gener_categories(args_final)
 
function events.categories_lister(c) -- Categorize categories, or view categories if c=":".
local res = ""
modes.options_to_cat_view()
-- c can replace cat_view to enforce the documentation or the categorisation
c = c or modes.cat_view or ""
for k, evt in pairs(events.list_all_events) do
if (evt.typ == "cat") then
local keyuser = viewers.form9user(evt.key)
local keycontent = viewers.form9content(evt.key)
res = res .. events.form_cat(evt, keyuser, keycontent, c)
end
end
return res
end -- function events.categories_lister(c)
 
-- cut_libraries
Ligne 7 166 ⟶ 7 490 :
versions_module_miss_i18n_none_err = "OK, none missing translations.",
versions_module_miss_i18n_trad_err = "Internal Error: Module missing i18n translation for the argument <b>i18n.%1.%2</b>.",
versions_err_module_miss_i18n_cat = "Module missing i18n translation",
versions_err_module_miss_i18n_cat = "Module with internal error",
versions_module_miss_i18n_mini_err = "Error: I18n table has only <b>1%</b> translations.",
Ligne 7 961 ⟶ 8 284 :
 
-- - - - ------------------ - - - - ------------------ - - - - -----------------------------
-- GuidelineTactic for modules, arguments, options and default values 20180908.
-- In all cases the main module protects all original tables, including for itself.
-- Permit modules without versions for many existing modules. Modules are also simply tables for data-modules or PageData in Json.
Ligne 8 019 ⟶ 8 342 :
local result_cases = result_cases or versions.args_changes or {}
local tests_cases = {
["birthyear"] = { ["typ"] = "dat", ["need"] = 0"noevent", ["keyword"] = "birthyear", ["prop"] = "P569", ["format"] = "year", },
["deathyear"] = { ["typ"] = "dat", ["need"] = 0"noevent", ["keyword"] = "deathyear", ["prop"] = "P570", ["format"] = "year", },
["lastname"] = { ["typ"] = "dat", ["need"] = 0"noevent", ["keyword"] = "lastname", ["prop"] = "P734", },
["firstname"] = { ["typ"] = "dat", ["need"] = 0"noevent", ["keyword"] = "firstname", ["prop"] = "P735", },
}
local tab_view = { -- Group datas and options for a table view with lines and columns.
Ligne 8 177 ⟶ 8 500 :
local mix = mix or {}
modes.mix = modes.init_args_mode_options(mix, mode_name, args_template) -- Before args_known : Import and mix args mode and options
-- ["QITEM"] = { ["typ"] = "dat", ["need"] = 0"noevent", ["keyword"] = "QITEM", ["prop"] = "QITEM", prop_default = "Q34743", },
local args_known = args_known or modes.args_known or p.args_known or {}
for key, one_arg in pairs(args_known) do
Ligne 9 626 ⟶ 9 949 :
end
end
t = string.gsub(t, p.version.versionName, langs.Central_version or Central.Central_versionCentral_version_name or "versionName")
return t
end -- function viewers.trans9vars(translations, key, ...)
Ligne 9 944 ⟶ 10 267 :
end
end
local dropbox_title = 'Drop--down drop_boxbox' from-- https://fr.wikisource.org/wiki/Modèle:Boîte déroulante =for drop_box from template on 20180505 OK.form
-- p_template_drop_box_name local dropbox_title = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.formBoîte déroulante
local dropbox_title = viewers.form9content('Boîte déroulantep_template_drop_box_name')
--[ [
-- local dropbox_title = viewers.form9content("p_template_drop_box_name")
t = t .. mw.getCurrentFrame():expandTemplate{ title = dropbox_title, args = {
["label"] = d.label, ["titre"] = d.title, ["contenu"] = d.content,
Ligne 10 152 ⟶ 10 473 :
 
function tableview.form_whole_view(tab_view) -- Formats whole the tableview.new()
local memo = viewers.save_configs("tableview.form_all_casesform_whole_view") -- Save global configuration before eventual changes.
local t, err = "", ""
if (lua_table.level_count(tab_view.test_group) == 0) then
Ligne 10 187 ⟶ 10 508 :
 
function tableview.new(tab_view) -- Formats a table with lines and columns. S170610tvf
local memo = viewers.save_configs("tableview.form_whole_viewnew") -- Save global configuration before eventual changes.
if type(tab_view) ~= "table" then tab_view = {} end -- tab_view must be a table
tab_view.t = (tab_view.t or "") .. viewers.ta("tableView: ", "start")
Ligne 10 198 ⟶ 10 519 :
if tab_view.track_on then t = t .. tab_view.t end
-- Counts of selected and sorted sub-tasks: , #test_group = 43 , #rowGroup = 0
viewers.restore_configs(memo, "tableview.form_whole_viewnew") -- Restore global configurations after eventual changes.
return t, err, tab_view
end -- t, err, tab_view = function tableview.new(tab_view)
Ligne 10 243 ⟶ 10 564 :
--
if not mask_sections then res = res .. viewers.doc_section(selector, "Library:datas", "h3") end -- .get_item(
res = res .. drop_box.new(selector, "modes_args_known_report_titledatas_get_item_report_title", datas.get_item_report)
-- res = res .. drop_box.new(selector, "datas_update_Special_PageData_title", datas.update_PageData)
--
if not mask_sections then res = res .. viewers.doc_section(selector, "Library:events", "h3") end
-- functionres events= res .. drop_box.all_kinds_testnew(selector, "modes.get_args_datas(t) -- Test: all kindsevents of(err, eventswng, cat) **", modes.get_args_datas) -- Test: onevent (err, wng, cat)
res = res .. drop_box.new(selector, "events_all_kinds_tests_title", events.all_kinds_test) -- 5 empty rows
res = res .. drop_box.new(selector, "langs_selectLang_tests_title", langs.select_lang_test) -- lang %1 %2 %3
--
if not mask_sections then res = res .. viewers.doc_section(selector, "Library:langs", "h3") end
res = res .. drop_box.new(selector, "langs_selectLang_tests_title", langs.select_lang_test) -- lang %1 %2 %3
res = res .. drop_box.new(selector, "langs_translations_counts_title", langs.translations_counts) -- S170618ltc
-- res = res .. drop_box.new(selector, "langs_changing_translations_title", langs.changing_translations) -- no tabview
Ligne 10 279 ⟶ 10 600 :
if not mask_sections then res = res .. viewers.doc_section(selector, "Library:modes", "h3") end -- function viewers.doc_section(
-- if not mask_sections then res = res .. viewers.doc_section(selector, "viewers_section_title_library_modes", "h3") end
res = res .. drop_box.new(selector, "modes_get_args_datas_tests_title", modes.get_args_datas_tests)
-- end -- t = t .. modes.get_args_datas(t)
-- res = res .. drop_box.new(selector, "modes_args_known_report_title", modes.args_known_report)
res = res .. drop_box.new(selector, "modes_get_args_report_title", modes.get_args_report)
Ligne 10 380 ⟶ 10 703 :
if type(args_final) ~= "table" then args_final = modes.args_final end -- optional arguments
res = res .. viewers.ta("modes.mode_name", modes.mode_name) .. viewers.ta("modes.options", modes.options)
-- if modes.option("box1") then res = (res or "") .. (p.box_read(props) or "") end -- ric (box_read)
if modes.option("box1") or modes.option("catview")
then res = res .. " catview = " .. events.categories_lister(":") end -- Display categories
Ligne 10 559 ⟶ 10 882 :
p.i18n.br = { -- Translations in breton
-- Arguments to import, do not translate. Arguments à importer, ne pas traduire.
["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0"noevent", ["keyword"] = "modules_guide", ["modules_guide_default"] = "Centralizer", },
['p_template_drop_box_name'] = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.form
['c'] = 'c',
Ligne 10 617 ⟶ 10 940 :
p.i18n.en = { -- Translations in English
-- Arguments to import, do not translate.
["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0"noevent", ["keyword"] = "modules_guide", ["modules_guide_default"] = "Centralizer", },
['p_template_drop_box_name'] = 'BoîteDrop-down déroulantebox', -- Modèle:Boîte déroulante for drop_box.form
['c'] = 'c',
['mode'] = 'mode',
Ligne 10 674 ⟶ 10 997 :
p.i18n.es = { -- Translations in espagnol
-- Importar estos argumentos. No traducir.
["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0"noevent", ["keyword"] = "modules_guide", ["modules_guide_default"] = "Centralizer", },
['p_template_drop_box_name'] = 'BoîteCaja déroulantedesplegable', -- Modèle:Boîte déroulante for drop_box.form
['c'] = 'c',
['mode'] = 'mode',
Ligne 10 732 ⟶ 11 055 :
p.i18n.fr = { -- Translations in français
-- Arguments to import, do not translate. Arguments à importer, ne pas traduire.
["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0"noevent", ["keyword"] = "modules_guide", ["modules_guide_default"] = "Centralizer", },
['p_template_drop_box_name'] = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.form
['c'] = 'c',
Ligne 10 791 ⟶ 11 114 :
p.i18n.vi = {
-- Arguments to import, do not translate. Arguments à importer, ne pas traduire.
["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0"noevent", ["keyword"] = "modules_guide", ["modules_guide_default"] = "Centralizer", },
['p_template_drop_box_name'] = 'BoîteHộp déroulantethả xuống', -- Modèle:Boîte déroulante for drop_box.form
['c'] = 'c',
['mode'] = 'mode',
Ligne 10 860 ⟶ 11 183 :
-- Arguments in order without names, with their keyword for use as other arguments.
-- Arguments dans l'ordre, non nommés, avec leur keyword pour traitement comme les autres arguments.
-- [1] = { ["typ"] = "config", ["need"] = 0"noevent", ["keyword"] = "mode", ["syn"] = 2},
 
-- GuidelineTactic to integer i18n translations following a list of sub-modules: modules_guide with their own translations.
-- GuidelineTactic to integer default arguments values: defaults values are always from Centralizer.
-- GuidelineTactic for default arguments values: each main_module can replace any option of any argument from Centralizer.
-- GuidelineTactic for these changes: Centralizer is always protected against any change.
--
-- Special arguments to modify the fonctions and outputs of this module.
-- Arguments speciaux pour modifier le fonctionnement et les sorties de ce module.
["modules_guideitemid"] = { ["typ"] = "ctrconfig", ["need"] = 0"default", ["keyword"] = "modules_guideitemid", ["modules_guide_defaultprop_default"] = "CentralizerQ307", }, -- Galilée
-- datas.entity = mw.wikibase.getEntity(datas.QITEM or datas.default_item or "Q34743" ) -- Rudyard Kipling
["category"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "category"},
["debug"] = { ["typ"] = "opt", ["need"] = 0, ["keyword"] = "debug"},
["c"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "c"},
["docfunc"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "docfunc"},
["dockey"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "dockey"},
["itemid"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "itemid"}, -- Property:P2959 points to a double of the item.
["mode"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "mode"},
["options"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "options"},
["knownversions"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "knownversions"},
["soughtversions"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "soughtversions"},
["contentlang"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "contentlang"},
["pagelang"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "pagelang"},
["userlang"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "userlang"},
["args_known_country"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "args_known_country", ["prop"] = "P18", },
["args_known_flag"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "args_known_flag", ["prop"] = "P18", },
["args_known_monument"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "args_known_monument",["prop"] = "P18", },
["args_known_town"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "args_known_town", ["prop"] = "P18", },
--[[
datas.i18n.en
args_known_country = "London", -- English
args_known_flag = "flag of English.svg", -- English
args_known_monument = "St Paul Cathedral.png", -- English
args_known_town = "London", -- English
datas.i18n.es
args_known_country = "Madrid", -- Spanish
args_known_flag = "flag of .......png", -- Spanish
args_known_monument = "parliament.png", -- Spanish
args_known_town = "Madrid", -- Spanish
datas.i18n.fr
args_known_country = "France", -- French
args_known_flag = "flag of France.svg", -- French
args_known_monument = "Tour Eiffel", -- French
args_known_town = "Paris", -- French
--]]
--[[
for key, trans in pairs(langs.content_translations) do -- Add to function datas.get_item(
if key == "args_known_country" then datas.prop["country"] = langs["args_known_country"] end
if key == "args_known_flag" then datas.prop["country"] = langs["args_known_flag"] end
if key == "args_known_monument" then datas.prop["monument"] = langs["args_known_monument"] end
if key == "args_known_town" then datas.prop["town"] = langs["args_known_town"] end
end
--]]
-- All arguments have a keyword identical to the registration name, except synonyms.
-- Tous les arguments ont un keyword identique au nom d'enregistrement, sauf les synonymes.
["image"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "image", ["prop"] = "P18", },
["country"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "country", ["prop"] = "P27", },
["birthyear"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "birthyear", ["prop"] = "P569", ["format"] = "year", },
["deathyear"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "deathyear", ["prop"] = "P570", ["format"] = "year", },
["lastname"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "lastname", ["prop"] = "P734", },
["lastname2"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "lastname", ["prop"] = "P734", ["syn"] = 2, },
["firstname"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "firstname", ["prop"] = "P735",["prop_default"] = "Galilée", },
["firstname2"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "firstname", ["prop"] = "P735", ["syn"] = 2, ["prop_default"] = "Galilée", },
["initial"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "initial", ["prop"] = "P735", },
["title"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "label", ["prop"] = "P735", ["syn"] = 2, ["prop_default"] = "label", },
["personlang"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "personlang", ["prop"] = "P1412", ["prop_default"] = "en", },
["description"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "description",["prop"] = "description", },
["label"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "label" , ["prop"] = "label", ["prop_default"] = "Aristotelabel", },
["labelcontent"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "labelcontent",["prop"] = "labelcontent", ["prop_default"] = "Q307", }, -- Galilée
["labelpage"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "labelpage", ["prop"] = "labelpage", ["prop_default"] = "Q307", }, -- Galilée
["labeluser"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "labeluser", ["prop"] = "labeluser", ["prop_default"] = "Q307", }, -- Galilée
["labelbylang"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "labelbylang",["prop"] = "labelbylang", ["prop_default"] = "Q307", }, -- Galilée
["QITEM"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "QITEM", ["prop"] = "QITEM", ["prop_default"] = "Q307", }, -- Galilée
["itemid"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "itemid", ["prop"] = "itemid", ["prop_default"] = "Q307", }, -- Galilée
-- Galilée (Q307), Victor Hugo (Q535), Aristote (Q868), Albert Einstein (Q937), Mohandas Karamchand Gandhi (Q1001), Christophe Colomb (Q7322),
-- Nelson Mandela (Q8023), Rudyard Kipling (Q34743), Martin Fleischmann (Q899264), Emmanuel Macron (Q3052772)
["sitelink"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "sitelink", ["prop"] = "sitelink", ["prop_default"] = "sitelink", },
["uri"] = { ["typ"] = "dat", ["need"] = 0"default", ["keyword"] = "uri", ["prop"] = "uri", ["prop_default"] = "uri",},
["sex"] = {["keyword"] = "sex", ["typ"] = "dat", ["need"] = 0"default", ["prop"] = "P21",
["arg_values"] = "sex_values", ["key_values"] = "male;femelle", ["prop_default"] = "male",}, -- wiki_selectors
["region"] = {["keyword"] = "region", ["typ"] = "dat", ["need"] = 0"default", ["prop_default"] = "England",
["arg_values"] = "region_values", ["key_values"] = "other;china;india;century", ["prop"] = "uri",}, -- wiki_selectors
["rights"] = {["keyword"] = "rights", ["typ"] = "dat", ["need"] = 0"default",
["arg_values"] = "rights_values", ["key_values"] = "no;none;ONU;none;cn;50;us;70;mpf", ["prop_default"] = "cn",-- wiki_selectors
["delay_values"] = "0;0;0;0;50;50;70;70;95", ["arg_uses"] = "none;none;none;none;cn;cn;us;us;mpf", ["prop_default"] = "cn" }, -- wiki_selectors
["args_known_monument"] = { ["typ"] = "dat", ["need"] = 0"noevent", ["keyword"] = "args_known_monument", ["prop"] = "P18", ["prop_default"] = "St Paul Cathedral.png",},
["labelbylang"] = { ["typ"] = "dat", ["need"] = 0"noevent", ["keyword"] = "labelbylang", ["prop"] = "P18", ["prop_default"] = "en",},
-- mw_wikibase_country = "England", -- English
-- mw_wikibase_flag = "England in the UK and Europe.svg", -- English
-- mw_wikibase_monument = "St Paul Cathedral.png", -- English St Paul's Cathedral
-- mw_wikibase_town = "London", -- English
-- args_known_monument = "Tour Eiffel", -- French
-- args_known_town = "Paris", -- French
Ligne 11 058 ⟶ 11 340 :
-- clé valeur type nécessaire mot-clé synonyme propriété par défault format source
-- image nil dat 0 image 0 P18
local image
if not prop["image"] then return nil end
local image = viewers.form_image(prop["image"]["val"], 50)
local birthyear_deathyear = " ( " .. (prop.birthyear or "birthyear") .. " - " .. (prop.deathyear or "deathyear") .. " ) "
Ligne 11 126 ⟶ 11 410 :
if not a.lastname2 then i.lastname2 = (i.lastname or a.lastname) end
--
if not a.initial then -- If initial is undefined, enforce it. This property (Q29882054) exist but is not used.
-- https://www.wikidata.org/wiki/Q29882054 La dernière modification de cette page a été faite le 2017-10-21 à 05:18:03.
if a.lastname then
i.initial = string.sub( a.lastname, 1, 1 ) -- selector the first letter
Ligne 11 191 ⟶ 11 476 :
function Central.init(frame, Central_version, mode_name, args_known, options_for_modes)
-- p.version.versionNumber = CentralI18N.version.versionNumber
local res = "\n* Central.init(frame, Central_version, mode_name, args_known, options_for_modes)<br>"
local res = ""
-- res = res .. tracker.init_trakers() -- Initialize some trakers. To run in Central.init()
-- modes.time1 = os.clock()
local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = {...}
Central_version = Central_version or langs.Central_version or Central.Central_versionCentral_version_name
local options_for_modes = options_for_modes or modes.options_for_modes or p.options_for_modes
res = res .. versions.init(frame, Central_version)
versions.memo_i18n = mw.clone(versions.main_i18n or langs.main_i18n)
langs.main_i18n = versions.memo_i18n ; versions.main_i18n = versions.memo_i18n
-- local datas = mw.clone(datas) modes.get_args_datas
res = res .. modes.init_modes_translate_events(frame, Central_version, mode_name, modes.args_known, options_for_modes, QITEM or itemid)
datas.props = datas.get_item(args_known, QITEM) -- Get datas from mw.wikibase for the page.
modes.init_args_mode_options(mix, mode_name, modes.args_template) -- Import and mix args mode and options from template and invoke
modes.args_importargs_final = modes.import_arguments(args_known, args_source, content_translations, args_wikidata) -- function modes.import_arguments()
args_known = modes.get_args_datas(args_known) -- Applies the Tatic for (err, wng, cat) S181124Dng
modes.args_final = p.interact_args_final(modes.args_import) -- Interactions between arguments
modes.get_args(args_known) -- Interactions between arguments
langs.init_content_page_user_lang() -- function langs.init_content_page_user_lang()
Ligne 11 217 ⟶ 11 502 :
-- Helpers or admins can add options to include edit or tests or user language...
local res = ""
local t = Central.init(frame, Central.Central_versionCentral_version_name, "read", p.args_known, p.options_for_modes)
-- res = res .. t
modes.args_final = p.interact_args_final(modes.args_import) -- Interactions between arguments
Ligne 11 228 ⟶ 11 513 :
local res = "</b>"
res = res .. "Library:langs"
local t = Central.init(frame, Central.Central_versionCentral_version_name, "edit", p.args_known, p.options_for_modes)
-- res = res .. t
modes.args_final = p.interact_args_final(modes.args_import) -- Interactions between argumensts
Ligne 11 236 ⟶ 11 521 :
end -- function Central.edit(frame)
 
-- ["docfunc"] = { ["typ"] = "config", ["need"] = 0"noevent", ["keyword"] = "docfunc"},
-- ["dockey"] = { ["typ"] = "config", ["need"] = 0"noevent", ["keyword"] = "dockey"},
function Central.doc(frame) -- Formats a documentation or a test in a drop_box.
local res = ""
Ligne 11 258 ⟶ 11 543 :
local res = ""
res = res .. tracker.init_trakers() -- Initialize some trakers. To run in Central.init()
local t = Central.init(frame, Central.Central_versionCentral_version_name, "tests", p.args_known, p.options_for_modes)
res = res .. t
-- res = res .. "\n* getEntityIdForCurrentPage = " .. tostring( mw.wikibase.getEntityIdForCurrentPage() ) -- Returns the Item id as string, like "Q42"
Ligne 11 408 ⟶ 11 693 :
{ site = "fr.wikisource", verstime = "2018-10-18T22:57:44", versid = "1.32.0-wmf.24 (35fb3b6)", seen_time = "2018-10-17T06:30:00", },
{ site = "fr.wikisource", verstime = "2018-10-20T22:57:44", versid = "1.32.0-wmf.26 (06a4ac1)", seen_time = "2018-10-21T19:22:00", },
-- { site = "fr.wikisource", verstime = "2018-10-23T22:5756:4417", versid = "1.3332.0-wmf.126 (06a4ac1abfc550)", seen_time = "20192018-0210-24T1924T06:2210:00", },
{ site = "www.MediaWiki", verstime = "2018-10-24T00:34:34", versid = "1.33.0-wmf.1 (b1724ee)", seen_time = "2018-10-24T06:10:00", },
{ site = "fr.wikisource", verstime = "2018-10-26T01:30:57", versid = "1.32.0-wmf.1 (ef37e05)", seen_time = "2018-10-27T09:38:00", },
{ site = "fr.wikisource", verstime = "2018-10-29T00:33:47", versid = "1.33.0-wmf.1 (bdf45fc)", seen_time = "2018-10-30T08:50:00", },
{ site = "www.MediaWiki", verstime = "2018-10-30T21:36:59", versid = "1.33.0-wmf.2 (f6c4f5f)", seen_time = "2018-10-31T08:50:00", },
{ site = "fr.wikisource", verstime = "2018-10-29T00:33:47", versid = "1.33.0-wmf.2 (1c41eef)", seen_time = "2018-11-02T08:50:00", },
{ site = "fr.wikisource", verstime = "2018-11-05T20:37:45", versid = "1.33.0-wmf.2 (b6abf62)", seen_time = "2018-11-06T21:46:00", },
{ site = "fr.wikisource", verstime = "2018-11-08T13:23:27", versid = "1.33.0-wmf.3 (d114665)", seen_time = "2018-11-09T00:00:00", },
{ site = "fr.wikisource", verstime = "2018-11-14T19:43:13", versid = "1.33.0-wmf.4 (967d9eb)", seen_time = "2018-11-15T08:27:00", },
{ site = "fr.wikisource", verstime = "2018-11-15T13:12:06", versid = "1.33.0-wmf.4 (b34307c)", seen_time = "2018-11-17T07:35:00", },
{ site = "fr.wikisource", verstime = "2018-11-19T20:59:49", versid = "1.33.0-wmf.4 (bf6a756)", seen_time = "2018-11-21T06:04:00", },
{ site = "fr.wikisource", verstime = "2018-11-27T11:28:27", versid = "1.33.0-wmf.4 (ebeab6e)", seen_time = "2018-11-28T07:47:00", },
{ site = "fr.wikisource", verstime = "2018-11-28T13:29:48", versid = "1.33.0-wmf.6 (19f2ad7)", seen_time = "2018-11-29T08:35:00", },
{ site = "fr.wikisource", verstime = "2018-11-29T14:08:43", versid = "1.33.0-wmf.6 (e5db35f)", seen_time = "2018-11-29T21:51:00", },
{ site = "fr.wikisource", verstime = "2018-11-29T20:09:40", versid = "1.33.0-wmf.6 (e7d6fb2)", seen_time = "2018-11-29T23:33:00", },
} -- MWMW
versions.MediaWiki_version_memo = "1.3233.0-wmf.266 (06a4ac1e7d6fb2)"
versions.MediaWiki_Versions_sort = "<" -- First on end, Last on begin
versions.MediaWiki_Versions_sort = ">" -- First on begin, Last on end
Ligne 11 456 ⟶ 11 755 :
-- Module:Auteur2Tpt -- s.fr.wikisource.Module:Auteur2Tpt in French
-- Module:Auteur2Tpt/Documentation -- s.fr.wikisource.Module:Auteur2Tpt/Documentation in French
-- Module:Centralizer -- s.fr.wikisource.Module:Centralizer-s-fr in French
-- Module:Centralizer/Documentation -- s.fr.wikisource.Module:Centralizer/Tests in French
--