« Module:Multilingual » : différence entre les versions
Contenu supprimé Contenu ajouté
MdCentral lua_table.to_list_tests(t) hard bug table structure 190108 1000.lua |
MdCentral sorted phabtasks, update admins counts, debug gsub OK 190119 0015.lua |
||
Ligne 2 :
-- The main central module is mainly an installer of central libraries and a small demonstrator.
-- The main central module installs central libraries and bind the main and its sub-modules
local Central = p -- Save as MdCentral.lua MdCentral
------------------------------------------|------------------------ typical length --------------------------|----------max| DODO
p.teststests = "FAMLTVQDR"
p.version = { -- Modules dependencies. Dependencias del módulo. Dépendances du module.
[
[
[
[
[
[
-- p_template_drop_box_name = 'Cuadro desplegable', -- Equivalent templates exist in other wikis
[
[
[
{ "Centralizer", "Central-s-fr", "Central-2017" }, -- upper
{ "Centralizer/I18N", "Central-s-fr", "Central-2018" }, -- median
Ligne 68 ⟶ 25 :
Central.Central_version_name = Central.version.versionName
p.ModuleNS = mw.site.namespaces.Module.name .. ":" -- translate Module: in other languages
-- only for ModuleCentralizer : restart from : ModuleCentralizer function modes.levenshtein_similar_tests OK.lua DODO
-- only for ModuleCentralizer : then in function p.init_central_module() group only all sub-functions in the original order then delete duplicated one's
-- only for ModuleCentralizer : then use function p.init_central_module() to replace function Central.init()
-- only for ModuleCentralizer : delete tests_groups and args_final and boxviews and update activity.report_subtasks_list
-- cut_libraries
Ligne 427 ⟶ 390 :
activity_phabricator_tasks_headers = "Importance, modifiée le; Tâche; Etat; Titre",
activity_central_functions_report_title = "activity.central_functions_report(t) Lister les fonctions actuelles.",
activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Signaler les déséquilibres des débuts et des fins de gras dans le code.",
activity_space_name_module = "Modulenn", -- br
activity_space_name_template = "Patrom",
Ligne 451 ⟶ 415 :
activity_phabricator_tasks_headers = "Wichtigkeit; modifiziert die; Aufgabe; Status; Titel",
activity_central_functions_report_title = "activity.central_functions_report(t) Listen Sie die aktuellen Funktionen auf.",
activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Melden Sie Ungleichgewichte von Anfang und Ende von Fett im Code.",
activity_space_name_module = "Modul", -- de
activity_space_name_template = "Vorlage",
Ligne 477 ⟶ 442 :
activity_phabricator_tasks_headers = "Importance; modified on; Task; Status; Title",
activity_central_functions_report_title = "activity.central_functions_report(t) List actual functions.",
activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Report imbalances of beginnings and ends of bold in code.",
activity_space_name_module = "Module", -- en
activity_space_name_template = "Template",
Ligne 503 ⟶ 469 :
activity_phabricator_tasks_headers = "Importancia; modificado; Tarea; Estado; Título",
activity_central_functions_report_title = "activity.central_functions_report(t) Listar funciones actuales.",
activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Informe los desequilibrios de los comienzos y los extremos de negrita en el código.",
activity_space_name_module = "Módulo", -- es
activity_space_name_template = "Modelo",
Ligne 529 ⟶ 496 :
activity_phabricator_tasks_headers = "Importance, modifiée le; Tâche; Etat; Titre",
activity_central_functions_report_title = "activity.central_functions_report(t) Lister les fonctions actuelles.",
activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Signaler les déséquilibres des débuts et des fins de gras dans le code.",
activity_space_name_module = "Module", -- fr
activity_space_name_template = "Modèle",
Ligne 555 ⟶ 523 :
activity_phabricator_tasks_headers = "Fontosság; módosította; a Feladat; Állapot; Cím",
activity_central_functions_report_title = "activity.central_functions_report(t) Listázza az aktuális funkciókat.",
activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Jelentés a merész kódok kezdetének és végének egyenlőtlenségeiről.",
activity_space_name_module = "Modul", -- hu
activity_space_name_template = "Sablon",
Ligne 579 ⟶ 548 :
activity_phabricator_tasks_headers = "Tầm quan trọng; sửa đổi; nhiệm vụ; tình trạng; tiêu đề",
activity_central_functions_report_title = "activity.central_functions_report(t) Liệt kê các chức năng hiện tại.",
activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Báo cáo sự mất cân đối của các khởi đầu và kết thúc bằng chữ in đậm.",
activity_space_name_module = "Mô-đun", -- vi
activity_space_name_template = "Mẫu",
Ligne 622 ⟶ 592 :
activity.coder_lang_module = { -- List to report of Module:Centralizer for 'Begin to use' 7 central modules, 7 coders, 7 projets, 7 langs to get.
-- br.wikisource.org/wiki/Modulenn:Centralizer-s-br/doc {{#invoke:Centralizer-s-br|read}} fr = Breton = Breton = Breitz
{ [
[
[
--
-- de.wikisource.org/wiki/Modul:Centralizer/Doku {{#invoke:Centralizer-s-de|read}} de = German = Deutsch
{ [
[
[
-- sur la page de projet je ne vois pas qui d'autre :Hexasoft Tejgad Arkanosis Xfigpower Zebulon84 ;Hlm Z.; Od1n TomT0m Archimëa
-- sur la page de projet je ne vois pas qui d'autre : {{u'|Hexasoft}}, {{u'|Tejgad}}, {{u'|Arkanosis}}, {{u'|Xfigpower}}, {{u'|Zebulon84}},, {{u'|Hlm Z.}}.
-- Je rajoute au hasard {{u'|Od1n}}, {{u'|TomT0m}} et... -- [[Utilisateur:Archimëa|Archimëa]] <
-- en.wikipedia.org/wiki/Module:Centralizer/Documentation {{#invoke:Centralizer-w-en|read}} en = English = English
{ [
[
[
--
-- es.wikipedia.org/wiki/Módulo:Centralizers/Documentación {{#invoke:Centralizer-w-es|read}} es = Spanish = español
{ [
[
[
--
-- es.wikisource.org/wiki/Módulo:Centralizer-s-es/Documentación {{#invoke:Centralizer-s-es|read}} es = Spanish = española
{ [
[
[
--
-- Module br Modulenn, de Modul, en Module, es Módulo, fr Module, hu Modul, vi Mô-đun,
Ligne 653 ⟶ 623 :
-- Docum br Documentation, de Dokumentation, en Documentation, es Documentación, fr Documentation, hu Dokumentáció, vi tài liệu,
-- fr.wikisource.org/wiki/Module:Centralizer-s-fr/Documentation {{#invoke:Centralizer-s-fr|read}} fr = French = Français
{ [
[
[
--
-- fr.wikisource.org/wiki/Module:Auteur2Tpt/Tests {{#invoke:Auteur2Tpt|read}} fr = French = Français
{ [
[
[
--
-- hu.wikipedia.org/wiki/Modul:Centralizer-w-hu/doc {{#invoke:Centralizer-w-hu|read}} hu = Hungarian = Magyar
{ [
[
[
--
-- vi.wikipedia.org/wiki/Mô đun:Centralizer-w-vi/tài liệu {{#invoke:Centralizer-w-vi|read}} vi = Vietnamese = Tiếng Việt
{ [
[
[
-- Projects : MediaWikis wikidata wikipedia wikisource wikiquote meta test2
-- NOWNOW -- User = 2, Module = 828, Template = 10,
Ligne 837 ⟶ 807 :
ftd = ftd .. "lua_table.to_list;lua_table.to_list_tests;lua_table.to_table;lua_table.to_table_test;"
ftd = ftd .. "mathroman.int2roman;mathroman.int2roman_test;mathroman.roman2int;mathroman.roman2int_tests;"
ftd = ftd .. "modes.all_categories_list;modes.all_errors_list;modes.
ftd = ftd .. "modes.multiple_selection_tests;modes.options_from_args_tests;modes.recursive_normal;modes.recursive_normal_tests;modes.similar_args_list;"
ftd = ftd .. "tableview.form_one_case;tableview.new;"
Ligne 846 ⟶ 816 :
ftd = ftd .. "viewers.form_image;viewers.is_in;viewers.is_in_sp;viewers.main_view;viewers.restore_configs;lua_table.rough_view;"
ftd = ftd .. "lua_table.rough_view_test;viewers.save_configs;viewers.save_restore_balance_report;viewers.simple_list;"
ftd = ftd .. "viewers.simple_list_test;viewers.styles_small_caps;viewers.ta;viewers.tam;viewers.table_col;viewers.table_dat;"
ftd = ftd .. "viewers.table_end;viewers.table_head;viewers.table_row;viewers.styles_color_add;viewers.styles_color_colargs;"
ftd = ftd .. "viewers.styles_color_delete;viewers.styles_color_discreet;viewers.styles_color_error;viewers.styles_color_mask;"
Ligne 967 ⟶ 937 :
-- DUPLICATE NOWNOW, in change. toDoc
{ "---", "---", "---", "---", "---", "DUPLICATE NOW, in change", },
{ "
{ "
{ "
{ "
{ "20181020", "20181022", "NOW", "Rical", "S181020umf", "update MediaWiki:Scribunto/Central manual for ;activity.phabricator_tasks_report;activity.rough_date_days;...", },
{ "
{ "
{ "
{ "
{ "
{ "
-- function versioning.antiCrash(options, content_or_func, ...) -- Form the display of a running error. in ModuleCentral 20170902.ModuleCentral 2e no antiCrash ok.lua
{ "
{ "
{ "
{ "
--
-- 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", },
Ligne 1 004 ⟶ 965 :
{ "20171001", "20171002", "todo", "Rical", "S170801cCD", "Create MediaWiki:Scribunto/CentralData (change from admin only)", },
{ "20171001", "20171002", "todo", "Rical", "S170801cCD", "Create Central/PageData/CentralData (change from any user)", },
{ "20170915", "20170917", "
{ "20170910", "20170914", "todo", "Rical", "S170910wpw", "Use: wikidata = { property = 'P84',... syntax like {{Wikidata}} for wikidata", },
-- see 4.2 Paramètre "wikidata" https://fr.wikipedia.org/wiki/Aide:Infobox_en_Lua#Param.C3.A8tre_.22wikidata.22
{ "20170910", "20170914", "
{ "20170828", "20170905", "todo", "Rical", "S170828dut", "delete unused tracker in _G : ARGS, IAMO, MAMO, tests_groups", },
{ "20170828", "20170905", "todo", "Rical", "S170820vtg", "try graphics in viewers.try_graph() -- see Macron", },
{ "20170816", "20170823", "todo", "Rical", "S170901adl", "automatize langs.dummy_languages() using isSupportedLanguage(xx)", },
Ligne 1 051 ⟶ 1 012 :
-- NOWNOW DP, NOW, in change
{ "---", "---", "---", "---", "---", "NOW, in change", },
{ "
{ "
{ "
{ "
{ "20181020", "20181022", "NOW", "Rical", "S181020umf", "update MediaWiki:Scribunto/Central manual for ;activity.phabricator_tasks_report;activity.rough_date_days;...", },
{ "
{ "
{ "
{ "
{ "
{ "
-- function versioning.antiCrash(options, content_or_func, ...) -- Form the display of a running error. in ModuleCentral 20170902.ModuleCentral 2e no antiCrash ok.lua
{ "
{ "
{ "
{ "
-- Already done
{ "---", "~sort~", "---", "---", "---", "Already done", },
{ "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 103 ⟶ 1 055 :
{ "20180419", "20180420", "done", "Rical", "S180419aCv", "add Central version in running_times", },
{ "20180414", "20180414", "done", "Rical", "S180414ust", "Module:Centralizer update subtasks list", },
{ "20180413", "20180416", "done", "Rical", "S180413uia", "Update modes.
{ "---", "---", "---", "---", "---", "STOP the display of this table", },
{ "20170729", "20170729", "done", "STOP", STOP = "STOP", }, -- STOP the display of this table
Ligne 1 193 ⟶ 1 145 :
return t
end -- t = function activity.central_subtasks_report(t) -- Report the current state of subtasks, See "NOW".
activity.phabricator_tasks_Group = { -- toDoc
-- Importance: Important
-- {
{
{ "Important", "20190108", "T107595", 0, "Assigned", "[RFC] Multi-Content Revisions", },
-- CCicalese_WMF removed a subtask: : Introduce a ContentStore service to allow certain types of content to not be stored as serialized blobs..
{
{
{
{
{
{ "Important", "20180626", "T135845", 0, "Assigned", "Convert any module as central or centralisable", },
-- T135845 : Central modules must be really multi wikis.
-- 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.
-- Known Importance: ToCreate, Triage, Stalled, Open, Assigned, Resolved, Close, Declined, Declined, Obsolete, Invalid. Assigned To None = Triage
--
{ "Important", "20180603", "T85461", 0, "Resolved", "Lua error: too many language codes requested", },
{
{
{
{
{
-- Known Importance: ToCreate, Triage, Stalled, Open, Assigned, Resolved, Close, Declined, Declined, Obsolete, Invalid. Assigned To None = Triage
-- T149532 Why Multi-Content-Revisions? Use cases and requirements. Jul 27 2017, 00:40 Assigned: daniel
{ "Important", "20170713", "T163923", 0, "Resolved", "Create Special:PageData as a canonical entry point for machine readable page data.", },
{ "Important", "20170703", "T20170703", 0, "ToCreate", "Standardize content, page and user langages availability", },
-- T20170703 : Rename T68051 : "Central modules need the user language to display errors and category names"
-- T20170703 : Standardize content, page and user langages availability
-- T20170703 : Content, page and user langages are not available nor defined in the same ways for scribunto modules.
-- T20170703 : That complicate modules which use them. Similar ways could enhance efficiency and reduce the development tasks.
{
-- T20170325 : Centralize datas as MediaWiki versions installations in each lang-project, uses of central modules (helpers, projects, languages ...).
{
-- T159322 : Does the community agree to implement central categories and alerts for central modules?
-- T159322 : This enhances the efficiency of the detection and the correction of errors, in some ways:
{
-- T20161220 : ToDo: test: local getContentLanguage = mw.language.getContentLanguage().code -- default content_lang
{
-- T163923: Permit at modules to change PageData (for stat, modules versions, mw versions...).
{
-- T85419: to adapt errors and warning for administrators or modules coders
{
-- T122752: 20161202 18:25 See example https://fr.wikisource.org/wiki/Module:Phab.TestpackG : detect "in " "_G" or package.loaded
-- T122752: 20160102 22:46 See example https://fr.wikisource.org/wiki/Module:TestRequire
Ligne 1 243 ⟶ 1 200 :
-- T122752: (actu | diff) 2016-01-18T02:09:45 Rical (discussion | contributions | bloquer) . . (319 599 octets) (+10 183) . . (translate library.i18n first)
-- T122752: 2016-01-02 phabricator: T122752 Rical created this task. Sat, Jan 2, 2016-01-02 23:08
{
{
--
-- Known Importance: ToCreate, Triage, Stalled, Open, Assigned, Resolved, Close, Declined, Declined, Obsolete, Invalid. Assigned To None = Triage
--
-- Importance: Central
{
{
{
{
-- T41610: subscriber: kaldari 2017-05-20, 16:03
-- T41610: You can include Lua modules in extensions and then register them with Scribunto as global modules.
Ligne 1 257 ⟶ 1 215 :
-- T41610: Wikibase/client/includes/DataAccess/Scribunto/mw.wikibase.entity.lua
-- T41610: Wikibase/client/includes/DataAccess/Scribunto/mw.wikibase.lua
{
-- datas to get for each query: Task number, title, state, priority, Authored By and date, Last event date, number of subscribers, Assigned.
{
-- T20170225: The gerrit team needs the date of a bug and the dates of mw install in each wiki to debug mw.
-- T20170225: We could detect, record and report all date-time changes of MediaWiki, for some weeks.
-- T20170225: We could use {{subst:}} in 2 ways. See https://www.MediaWiki.org/wiki/Manual:Substitution
-- T20170225: duplicate of T121470: Central Global Repository for Templates, Lua modules, and Gadgets.
{
--
-- Importance: Other
{
{
{
{
{
{
-- T161875: Actual: It is enabled, though mw.user.options.get('usecodeeditor') correctly gives 0.
{
{
{
{
--
-- Other, ToCreate or not
{
{
-- T20151215: .. "\n------ " -- This code interact with drop_box and debug the task T20151215 2016-11-13 17:57.
-- T20151215: if there is "\n------ " before editDocBox and then the editDocBox <div> is only a bar of 1 em hight, and its content is after the <div>. Rical 2016-10-24 08:15.
{
-- T20160616: get.is_library = ( true ) -- true if the object is a library
{
-- UTC-20170407-20:21 : reported in T155624 Special:Version not showing SHA info for MediaWiki version on fr.wikisource
--
-- Known Importance: ToCreate, Triage, Stalled, Open, Assigned, Resolved, Close, Declined, Declined, Obsolete, Invalid. Assigned To None = Triage
--
-- Importance: Obsolete: Do not create, these functions come from mw... libraries.
{
-- T20161022: -- Found in Lua_reference_manual but not in Module:Centralizer-s-fr :
-- T20161022: -- 2016-10-22 15:45 : versions.all_G_and_loaded_list() : Variables in _G global space without libraries and modules in packageloaded. ,
Ligne 1 296 ⟶ 1 256 :
-- assert = function , ipairs = function , rawequal = function , getmetatable = function , rawset = function , pcall = function , type = function ,
-- selector = function , rawget = function , tonumber = function , error = function , setmetatable = function
{
{
{
-- T154769: Rical 2017-01-08 My main mistake was to write xpcall() where pcall() is right.
-- T154769: Tests are there https://fr.wikisource.org/wiki/Module:Phab.T154769.Test
-- T154769: versions.anti_crash() preserve pages against residual errors which can crash pages.
{
-- T155898: OK, I will continue to search in JEdit plugins. Perhaps I will ask them an adapted solution.
{
{
{
} -- activity.phabricator_tasks_Group = {...}
Ligne 1 313 ⟶ 1 273 :
local t = t or "\n* <b>activity.phabricator_tasks_report()</b> Monitor states of known phabricator tasks,"
t = t .. "\n* How to well report a task like in <b><big>viewers.phab_task('T149532#2878699', 'that task')</big></b> :"
t = t .. "\n* 1
t = t .. "\n* 4
t = t .. "\n* 5
t = t .. "\n* 7
t = t .. "\n* 8
t = t .. "\n* 10
local mwtitle = mw.title.getCurrentTitle()
local tasks_Group = activity.phabricator_tasks_Group
Ligne 1 613 ⟶ 1 573 :
-- 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.
datas_Wikidata_header = "Datas: ",
datas_known_Datas_header = "Known datas: ",
Ligne 1 645 ⟶ 1 605 :
-- Para traducir, no traduzca partes como estas: <b>%1</b> ; <b>%1</b> = <b>%2</b> (%3) ; <code>Q535</code> ; <br/> ; \n* ; _G.
-- Wikidata
datas_Wikidata_header = "Datos: ",
datas_known_Datas_header = "Datos conocidas: ",
Ligne 1 676 ⟶ 1 636 :
-- 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
datas_Wikidata_header = "Données : ",
datas_known_Datas_header = "Données connues : ",
Ligne 1 764 ⟶ 1 724 :
local i = 0
-- t = t .. "\n* Guideline for this stat : Count lists of translations by languages and libraries, then convert in a 2D table, then format and report them."
local
for key,
if type(
i = i + 1 ; t = t .. viewers.ta(
end
end
Ligne 1 867 ⟶ 1 827 :
end
function datas.property(
datas.QITEM = mw.wikibase.getEntityIdForCurrentPage() -- use props.QITEM Returns the Item id as string, like "Q42"
local QITEM = datas.QITEM or datas.default_item or "Q34743" -- Rudyard Kipling
Ligne 1 875 ⟶ 1 835 :
local label = nil
local val = nil
if
if
elseif
elseif
elseif
elseif
elseif
elseif
elseif
else -- ric (p.box_read)
loc.formatPropertyValues = datas.item:formatPropertyValues(
-- Returns a table like: { value = "Formatted claim value", label = "Label of the Property" }
if loc.wd_RANK_TRUTH then
loc.formatPropertyValues = datas.item:formatPropertyValues(
end
if loc.wd_claimRanks then
loc.formatPropertyValues = datas.item:formatPropertyValues(
end
val = loc.formatPropertyValues.value
end
val = tostring(val)
if
val = tostring(val)
end --function modes.
return
end --
function datas.get_item(
-- from 2016-08-16 ModuleCentral 3a lua_table.to_list.lua
local
local t = "\n* <b>datas.get_item(
local Title, Label, prop, lang, description, val, label, adr, proplabel
local QITEM = QITEM or mw.wikibase.getEntityIdForCurrentPage() or datas.default_item or kipling
datas.QITEM = QITEM
datas.item = mw.wikibase.getEntity(datas.QITEM or "Q34743") -- Rudyard Kipling
local props = {} -- All properties form
local prop = {} -- to collect properties
local loc = {} -- local values
for key,
if type(
if
if
props[
prop[
end
end
Ligne 1 935 ⟶ 1 895 :
datas.prop = prop
return prop, props
end -- local prop, props = datas.get_item(
function datas.get_item_report(t) -- datas.get_item() Report datas from mw.wikibase for the page **
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 for the page **"
local
local prop, props = datas.get_item(
local countprops = tostring( lua_table.level_count(props) ) -- do not follow one_prop structure
local countallprops = tostring( lua_table.level_count(props) ) -- do not follow one_prop structure
Ligne 2 072 ⟶ 2 032 :
-- 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.
-- events.all_categories_test(t) -- test categories
-- - - - ------------------ - - - - ---------------------------------
Ligne 2 182 ⟶ 2 142 :
end
function events.
local space = space or (mw.site.namespaces.Category.name .. ":")
local c = c or
if
return " [[" .. c .. space .. (
else
return ""
Ligne 2 195 ⟶ 2 155 :
end
events.
function events.new(typ, key, ...) -- Initialize and finalize a new event.
local
if type(typ) == "table" then
else -- To finalize an existing event.
end -- Finalize all events
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
-- Check, yes or no, to form an event, in special cases
if (
elseif (
elseif (
end
return
end -- function events.new(typ, key, ...)
function events.add_new(
-- Select only new events
if type(
local
for i, event in pairs(events.
local
if
end
-- events.add_wng("modes_auto_val_warning_wng", langs.user_translations[key], val) -- form_result
if
return
end -- function events.add_new(typ, ref, ...)
Ligne 2 241 ⟶ 2 201 :
-- Guide line: We can view or categorize categories.
local intern_or_use = versions.memo_i18n["en"][key]
local
local
local res,
return res,
end -- local res,
function events.
local
if type(
return
end
if (
return
end
if type(
elseif
-- Each type of event formats its own type of wikitext
if
if
if
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")
Ligne 2 280 ⟶ 2 240 :
end
end
return
end -- function events.
events.all_kinds_test_test_group = {
Ligne 2 303 ⟶ 2 263 :
rowGroup = {},
}
function tab_view.form_one_case(
return {
end
t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
Ligne 2 323 ⟶ 2 283 :
cats = cats .. events.add_cat(groupCat, wkt)
end
local res,
return res,
end -- function events.add_cat_group(groupCat, groupList)
function events.select_typ(typ) -- Select events by one type
local is = {}
for i,
if
end
return is
Ligne 2 338 ⟶ 2 298 :
function events.sort_typ() -- Sort events by type in wng, err, cat.
local wng, err, cat = {}, {}, {}
for i,
if
if
if
end
return wng, err, cat
end -- function events.sort_typ()
function events.selector( tab_view,
if type(
headers = "typ;key;selector-name;wkt",
style = "",
Ligne 2 355 ⟶ 2 315 :
}
else
end
if (type(tab_view) == "table") and (type(tab_view.typ) == "string") and (tab_view.typ ==
table.insert( tab_view.test_group, {
elseif (type(tab_view) == "table") and (type(tab_view.typ) == "string") and (tab_view.typ == "v") then
table.insert( tab_view.test_group, {
else
tab_view = {}
table.insert( tab_view.test_group, {
end
end -- function events.selector( tab_view,
function events.all_kinds_test_test(t) -- Test: all kinds of events (err, wng, cat)
Ligne 2 378 ⟶ 2 338 :
headers = "events_all_kinds_tests_headers", -- "typ;key;idargs;result",
}
function tab_view.form_one_case(
return {
end
t = t .. tableview.new(tab_view) -- Form a table view with lines and columns.
Ligne 2 418 ⟶ 2 378 :
function events.gener_categories() -- Only for this library, form categories without activate them
-- events.gener_categories Only display categories, as a text line, using function events.categories_lister
-- function events.
local gener = {}
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,
table.insert(gener,
end
return gener
end -- function events.gener_categories(
function events.categories_lister(c) -- Categorize categories, or view categories if c=":".
Ligne 2 435 ⟶ 2 395 :
-- c can replace cat_view to enforce the documentation or the categorisation
c = c or modes.cat_view or ""
for k,
if (
local keyuser = viewers.form9user(
local keycontent = viewers.form9content(
res = res .. events.
end
end
Ligne 2 911 ⟶ 2 871 :
t = t .. "\n* Guideline 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
local translate_i18n = versions.memo_i18n
local all_stats = {} -- all_stats + Total
Ligne 3 049 ⟶ 3 009 :
local modesCont, modesPage, modesUser = nil, nil, nil
if modes.args_source then -- and modes.args_source.userlang Does module arguments ask a content_lang?
local modes_args = modes.
modesCont = modes_args.contentlang
modesPage = modes_args.pagelang
Ligne 3 777 ⟶ 3 737 :
return tabN_to_list1(tab, 1, ...)
end -- function lua_table.to_list(tab, ...)
function lua_table.to_list_tests(t) -- Return a list from a Lua table.
Ligne 3 819 ⟶ 3 743 :
local tab_view = { -- Group datas and options for a table view with lines and columns.
test_group = {
{ "Simple table", { 123, "abc",
{ "
{ "10 values in the table", { "a", "b", "c", "d", "e", "f", "g", "h", "i9", "j10" }, },
{ "Any number of values", {
"a", "b", "c", "d", "e", "f", "g", "h", "i09", "j10",
"a", "b", "c", "d", "e", "f", "g", "h", "i19", "j20",
"a", "b", "c", "d", "e", "f", "g", "h", "i29", "j30",
"a", "b", "c", "d", "e", "f", "g", "h", "i39", "j40",
"a", "b", "c", "d", "e", "f", "g", "h", "i49", "j50",
"a", "b", "c", "d", "e", "f", "g", "h", "i59", "j60" }, },
},
title_memo = "luaTable_toList_tests_title", -- "lua_table.to_list() Return a list from a Lua table.",
Ligne 3 841 ⟶ 3 771 :
return t --, errors -- langs_missing_translations_title
end -- function lua_table.to_list_tests(t)
function lua_table.to_table(stringList, pattern, plain) -- convert a string to a table of words
Ligne 4 961 ⟶ 4 834 :
modes_list_all_args_main_title = "modes.list_all_args_main() Liste de tous les arguments acceptés",
modes_levenshtein_similar_tests_title = "modes.levenshtein() Test des distances de <b>[https://fr.wikipedia.org/wiki/Distance_de_Levenshtein Levenshtein]</b> entre mots:",
modes_args_unknown_report_title = "viewers.simple_list_test() Signaler les arguments inconnus",
modes_normal_box_main_text_1 = "Boîte d'information simple : titre de cette page <b>%1</b>, description : <b>%2</b>",
modes_normal_box_main_text_2 = "<br/>Il était <b>%1</b>, se nommait <b>%2</b> <b>%3</b>, il est mort en <b>%4</b>.",
Ligne 4 976 ⟶ 4 849 :
modes_recursive_normal_tests_title = "modes.recursive_normal() Test: Normalise le niveau récursif et la limite récursive",
modes_namespaces_page_list_title = "modes.namespaces_page_list() Module, namespaces, et noms de pages :",
modes_get_args_report_title = "modes.
} -- modes.i18n.br
Ligne 5 072 ⟶ 4 945 :
modes_list_all_args_main_title = "modes.list_all_args_main() Liste aller akzeptierten Argumente",
modes_levenshtein_similar_tests_title= "modes.levenshtein() Beweis der Entfernungen <b>[https://es.wikipedia.org/wiki/Distancia_de_Levenshtein Levenshtein]</b> zwischen den Wörtern:",
modes_args_unknown_report_title = "viewers.simple_list_test() Melden Sie unbekannte Argumente",
modes_normal_box_main_text_1 = "Einfaches Informationsfeld: Titel der Seite: <b>%1</b>, Beschreibung: <b>%2</b>",
modes_normal_box_main_text_2 = "<br/>Er war ein <b>%1</b>, heißt <b>%2</b> <b>%3</b> war in gestorben <b>%4</b>.",
Ligne 5 087 ⟶ 4 960 :
modes_recursive_normal_tests_title = "modes.recursive_normal() Test: Normalisieren Sie die rekursive Ebene und die rekursive Grenze",
modes_namespaces_page_list_title = "modes.namespaces_page_list() Module, Namespaces und Seitennamen:",
modes_get_args_report_title = "modes.
} -- modes.i18n.de
Ligne 5 171 ⟶ 5 044 :
--
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
-- modes_auto_val_warning_wng = "Verify the automatic argument: <b>%1</b> = <b>%2</b>.",
modes_auto_val_warning_wng = "Verify the automatic arguments.",
Ligne 5 185 ⟶ 5 058 :
modes_list_all_args_main_title = "modes.list_all_args_main() List of all accepted arguments",
modes_levenshtein_similar_tests_title= "modes.levenshtein() Test the distances between words <b>[https://en.wikipedia.org/wiki/Levenshtein_distance Levenshtein]</b>:",
modes_args_unknown_report_title = "viewers.simple_list_test() Report unknown arguments",
modes_normal_box_main_text_1 = "Simple infobox: page title: <b>%1</b>, description: <b>%2</b>",
modes_normal_box_main_text_2 = "<br/>He was <b>%1</b>, named <b>%2</b> <b>%3</b> was dead in <b>%4</b>.",
Ligne 5 201 ⟶ 5 074 :
modes_recursive_normal_tests_title = "modes.recursive_normal() Test: Normalize the recursive level and the recursive limit",
modes_namespaces_page_list_title = "modes.namespaces_page_list() Module, namespaces, and page names:",
modes_get_args_report_title = "modes.
} -- modes.i18n.en
Ligne 5 297 ⟶ 5 170 :
modes_list_all_args_main_title = "modes.list_all_args_main() Lista de todos los argumentos aceptados",
modes_levenshtein_similar_tests_title= "modes.levenshtein() Prueba de las distancias <b>[https://es.wikipedia.org/wiki/Distancia_de_Levenshtein Levenshtein]</b> entre las palabras:",
modes_args_unknown_report_title = "viewers.simple_list_test() Informar argumentos desconocidos",
modes_normal_box_main_text_1 = "Simple caja de información: Título de la página: <b>%1</b>, descripción: <b>%2</b>",
modes_normal_box_main_text_2 = "<br/>Él era un <b>%1</b>, es nombrado <b>%2</b> <b>%3</b> había muerto en <b>%4</b>.",
Ligne 5 312 ⟶ 5 185 :
modes_recursive_normal_tests_title = "modes.recursive_normal() Prueba: Normalizar el nivel recursivo y el límite recursiva",
modes_namespaces_page_list_title = "modes.namespaces_page_list() Módulo, namespaces, y nombres de páginas:",
modes_get_args_report_title = "modes.
} -- modes.i18n.es
Ligne 5 408 ⟶ 5 281 :
modes_list_all_args_main_title = "modes.list_all_args_main() Liste de tous les arguments acceptés",
modes_levenshtein_similar_tests_title = "modes.levenshtein() Test des distances de <b>[https://fr.wikipedia.org/wiki/Distance_de_Levenshtein Levenshtein]</b> entre mots:",
modes_args_unknown_report_title = "viewers.simple_list_test() Signaler les arguments inconnus",
modes_normal_box_main_text_1 = "Boîte d'information simple : titre de cette page <b>%1</b>, description : <b>%2</b>",
modes_normal_box_main_text_2 = "<br/>Il était <b>%1</b>, se nommait <b>%2</b> <b>%3</b>, il est mort en <b>%4</b>.",
Ligne 5 423 ⟶ 5 296 :
modes_recursive_normal_tests_title = "modes.recursive_normal() Test: Normalise le niveau récursif et la limite récursive",
modes_namespaces_page_list_title = "modes.namespaces_page_list() Module, namespaces, et noms de pages :",
modes_get_args_report_title = "modes.
} -- modes.i18n.fr
Ligne 5 520 ⟶ 5 393 :
modes_list_all_args_main_title = "modes.list_all_args_main() Az elfogadott érvek listája",
modes_levenshtein_similar_tests_title= "modes.levenshtein() A távolságok igazolása <b>[https://es.wikipedia.org/wiki/Distancia_de_Levenshtein Levenshtein]</b> entre las palabras:",
modes_args_unknown_report_title = "viewers.simple_list_test() Ismeretlen érvek jelentése",
modes_normal_box_main_text_1 = "Egyszerű információs mező: Az oldal címe: <b>%1</b>, leírás: <b>%2</b>",
modes_normal_box_main_text_2 = "<br/><b>%1</b> névvel <b>%2</b> <b>%3</b> meghalt <b>%4</b>.",
Ligne 5 535 ⟶ 5 408 :
modes_recursive_normal_tests_title = "modes.recursive_normal() Teszt: Normalizálja a rekurzív szintet és a rekurzív határt",
modes_namespaces_page_list_title = "modes.namespaces_page_list() Modul, névterek és oldalnevek:",
modes_get_args_report_title = "modes.
} -- modes.i18n.hu
Ligne 5 630 ⟶ 5 503 :
modes_list_all_args_main_title = "modes.list_all_args_main() Danh sách tất cả các đối số được chấp nhận",
modes_levenshtein_similar_tests_title = "modes.levenshtein() Kiểm tra khoảng cách <b>[https://fr.wikipedia.org/wiki/Distance_de_Levenshtein Levenshtein]</b> entre mots:",
modes_args_unknown_report_title = "viewers.simple_list_test() Báo cáo đối số không xác định",
modes_normal_box_main_text_1 = "Hộp thông tin đơn giản: tiêu đề để trang này <b>%1</b>, mô tả: <b>%2</b>",
modes_normal_box_main_text_2 = "<br/>Anh ta <b>%1</b>, tên anh ta <b>%2</b> <b>%3</b>, anh ta đã chết <b>%4</b>.",
Ligne 5 645 ⟶ 5 518 :
modes_recursive_normal_tests_title = "modes.recursive_normal() Kiểm tra: Bình thường hóa mức đệ quy và giới hạn đệ quy",
modes_namespaces_page_list_title = "modes.namespaces_page_list() Mô-đun, namespaces, và tên trang:",
modes_get_args_report_title = "modes.
} -- modes.i18n.vi
Ligne 5 675 ⟶ 5 548 :
-- Manage Library:modes options. Administrar opciones. Gérer les options.
modes.template_options = "" -- Normal options from the template, like {{Bananas|options=docmax docdef}}.
modes.mode_options = "" -- Internal options from the
modes.available_options = "" -- table to collect all available options, at any time.
modes.used_options = {} -- table to collect really or tested options then list them at end of tests.
mathroman.
-- Arguments in order without names, with their keyword for use as other arguments.
[1] = {need = 0, syn = 2, keyword = "mode"},
-- Special arguments to modify the fonctions and outputs of this module.
mode = {typ = "config", need = 0, keyword = "mode"},
Ligne 5 692 ⟶ 5 566 :
}
function modes.
local
if (type(
local
if (type(args_new) ~= "table") then return
for key, props in pairs(args_new) do -- import and mix known args and properties
if (type(props) == "table") then
props.key = key
end -- Add properties for a new argument
end
return
end -- local
function modes.
local
if (type(
local
for key, one_lib in pairs(args_new) do -- import and mix known args and properties
if (type(one_lib) == "table") then
bind_args = modes.
end
end
return
end -- function modes.
function modes.
local memo = viewers.save_configs("modes.
local t = t or "\n* mathroman.
local
local
t = t .. "\n* " .. viewers.ta("#
if (type(
local tab_view = { -- Group datas and options for a table view with lines and columns.
test_group =
rowGroup = {},
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
return { viewers.value(case.key), case.bind, case.typ, case.need, case.keyword, case.prop, case.format, }
end,
title_memo = "
title_memo = "modes.
headers = "
headers = "key;bind;typ;need;keyword;prop;format",
}
t = t .. "<br/>" .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
viewers.restore_configs(memo, "modes.
return t
end -- function modes.
function lua_table.sort_onkey(tab, key) -- Sort a table with any types of keys.
Ligne 5 751 ⟶ 5 625 :
end
function modes.
local memo = viewers.save_configs("modes.
local t = t or "\n* <b>modes.
local
local args_group = {} -- modes.
for key, tab in pairs(
table.insert( args_group, tab )
end
local prop, props = datas.get_item(
table.sort(props, function (a, b) return ( (a.keyword or a.prop) < (b.keyword or b.prop)) end ) -- alphabetic sort of translated arguments
t = t .. "\n* " .. viewers.ta("
local tab_view = { -- Group datas and options for a table view with lines and columns.
test_group = args_group, -- tab_view.test_group or
rowGroup = {},
title_memo = "modes.
title_memo = "
headers = "
form_one_case = function(case) -- Convert a case from test_group to rowGroup. tab_view.form_one_case or
return { (case.keyword), (case.val or "-"), case.typ, case.need, case.keyword, case.syn, case.prop, case.format, case.src
end,
}
t = t .. "<br/>" .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
viewers.restore_configs(memo, "modes.
return t
end -- function modes.
function modes.init_options(template_options)
Ligne 5 956 ⟶ 5 830 :
end -- function modes.change_itemid(id_in)
function modes.
-- if true then return "" end -- to DEBUG : S170606aks
local t = t or "\n* <b>
local tt
local
if type(
for key, elem in pairs(
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("format", elem.format)
Ligne 5 970 ⟶ 5 844 :
end
return t
end -- function modes.
function modes.levenshtein(word1, word2) -- Compute the Levenshtein distance between 2 ASCII words.
Ligne 6 106 ⟶ 5 980 :
-- For an unknown argument, seeks the name of the closest among the known arguments translated
function modes.similar_args_list(
local list, arglingual = {}, "xxx"
local
if type(
for key, argm in pairs(
if not tonumber(key) then -- For named arguments only
key = tostring(key)
Ligne 6 118 ⟶ 5 992 :
end
return list
end -- function modes.similar_args_list(
-- Check if the value of an argument is among the possible values.
-- Vérifier si la valeur d'un argument est parmi les valeurs possibles.
-- local ... = modes.multiple_values(test.argm, test.argvalue, test.
function modes.multiple_values(argname, argvalue,
if type(
local
local argvalue = argvalue or
local arg_values, key_values, keyword, keyval, argval, rank
local
if
arg_values = langs.content_translations[
key_values =
end
if type(arg_values) == "string" and type(key_values) == "string" then
local arg_tab = mw.text.split(arg_values, ';') -- table of
local key_tab = mw.text.split(key_values, ';') -- table of key
-- Default values
Ligne 6 141 ⟶ 6 015 :
keyval = nil -- key value
argval = nil
if
for i, key in ipairs(arg_tab) do
if key == argvalue then -- Search argvalue in arg_tab
Ligne 6 147 ⟶ 6 021 :
keyval = key_tab[i] -- Return correponding keyval in key_tab
argval = argvalue
keyword =
end
end
Ligne 6 153 ⟶ 6 027 :
end
return keyword, keyval, argval, rank, arg_values
end -- function modes.multiple_values(argname, argvalue,
function modes.multiple_values_tests(t) -- Test: convert a string to a table of words
Ligne 6 175 ⟶ 6 049 :
if type(group_test) == "table" then
for i, test in ipairs(group_test) do
local keyword, keyval, argval, rank, arg_values = modes.multiple_values(test.argm, test.argvalue, test.
table.insert( tab_view.rowGroup, { tostring(test.argm or "-"), tostring(arg_values or "-"), tostring(test.argvalue or "-"), tostring(keyword or "-"), tostring(keyval or "-"), tostring(argval or "-"), tostring(rank or "-") } )
end
Ligne 6 286 ⟶ 6 160 :
function modes.verify_args_tables(_known, _source)
-- initialize all the values to "" in
-- if type(_known) ~= "table" then _known = modes.
-- if type(_source) ~= "table" then _source = modes.args_source end
if type(modes.
events.add_err("modes_no_known_arguments_err")
events.add_cat("modes_no_known_arguments_i_cat")
Ligne 6 302 ⟶ 6 176 :
end -- function modes.verify_args_tables(_known, _source)
function modes.
local m, val = modes, nil
local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = {...}
local prop, props = datas.get_item(args_known, QITEM) -- Get datas from mw.wikibase for the page.
local arguments_known = mw.clone(args_known)
local counts = { ["template"] = 0, ["import"] = 0, ["source"] = 0, ["datas"] = 0, ["final"] = 0, ["known"] = 0, }
local arguments = {}
local tt = ""
for key, argmt in pairs(arguments_known) do -- For all known parameters
if type(argmt) == "table" then
-- * These origins of arguments are in the increasig priority: <code>known</code>, <code>import</code>, <code>datas</code>, <code>template</code>, <code>interact_final</code>.
if argmt.keyword then
argmt.val = argmt.default ; argmt.src = "known" ;
counts.known = counts.known+1 ; tt = tt .. viewers.ta(argmt.src, counts.known)
end
if modes.args_import[argmt.keyword] then
argmt.val = modes.args_import[argmt.keyword] ; argmt.src = "import" ;
counts[argmt.src] = counts[argmt.src]+1 ; tt = tt .. viewers.ta(argmt.src, counts[argmt.src])
end
if prop[argmt.keyword] then
argmt.val = prop[argmt.keyword] ; argmt.src = "datas" ;
counts[argmt.src] = counts[argmt.src]+1 ; tt = tt .. viewers.ta(argmt.src, counts[argmt.src])
end
if modes.args_final[argmt.keyword] then
argmt.val = modes.args_final[argmt.keyword] ; argmt.src = "final" ;
counts[argmt.src] = counts[argmt.src]+1 ; tt = tt .. viewers.ta(argmt.src, counts[argmt.src])
end
table.insert(arguments, argmt) -- insert in the arguments their own key
end
end
local labelcontent_memo, label_to_change, has_label = {}, {}, {}
for i, onearg in pairs(arguments) do -- To search the label and labelcontent arguments
if onearg.keyword == "labelcontent" then labelcontent_memo = onearg end
if onearg.keyword == "label" then label_to_change = onearg end
end
if label_to_change and labelcontent_memo then -- To search and change the label argument
label_to_change.val = labelcontent_memo.val
label_to_change.keyword = "label"
label_to_change.prop = "label"
label_to_change.src = "datas"
label_to_change.need = labelcontent_memo.need
end
arguments.label = arguments.label or arguments.labeluser or arguments.labelpage or arguments.labelcontent or arguments.labelbylang -- insure label.val
table.sort(arguments, function (a, b) return ( tostring(a.keyword) < tostring(b.keyword) ) end ) -- alphabetic sort of translated arguments
modes.arguments = arguments
return arguments, counts, tt -- With argmt.val and argmt.src
end -- local arguments = modes.get_args(args_known) -- Update argmt.val and argmt.src in p.args_known{}
function modes.get_default_args(args_known) -- Gets default arguments values
-- List of twice-view cases : in CentralManual modes.get_args_report ; not in ModuleCentral test mode ; yes in ModuleCentral "Doc with function from string". Search ▼
local memo = viewers.save_configs("modes.get_default_args") -- Save global configuration before eventual changes.
local
-- ["QITEM"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "QITEM", ["prop"] = "QITEM", ["prop_default"] = "Q307", },
-- keep Galilée (Q307), avoid Victor Hugo (Q535), Rudyard Kipling (Q34743),
Ligne 6 310 ⟶ 6 233 :
-- Nelson Mandela (Q8023), Rudyard Kipling (Q34743), Martin Fleischmann (Q899264), Emmanuel Macron (Q3052772)
-- ["QITEM"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "QITEM", ["prop"] = "QITEM", prop_default = "Q34743", },
for key, one_arg in pairs(
if type(one_arg) == "table" then
if type(one_arg.default_item == "string") then datas.prop_default = one_arg.prop .. "_default" end -- "Q34743" -- Rudyard Kipling **
Ligne 6 318 ⟶ 6 241 :
modes.arguments = arguments
viewers.restore_configs(memo, "modes.get_default_args") -- Restore global configurations after eventual changes.
return arguments, counts, tt -- With
end -- local arguments = modes.get_default_args(
function modes.get_args_report(t) -- Update modes.get_args()=args_known
-- List of twice-view cases : in CentralManual modes.get_args_report ; not in ModuleCentral test mode ; yes in ModuleCentral "Doc with function from string". Search ▼
local memo = viewers.save_configs("modes.get_args_report") -- Save global configuration before eventual changes.
local t = t or "\n* <b>modes.get_args(args_known)</b>: Update argmt.val and argmt.src in p.args_known{}."
t = t .. '\n* List of twice-view cases : in CentralManual modes.get_args_report ; not in ModuleCentral test mode ; yes in ModuleCentral "Doc with function from string". Search ▼'
local arguments, counts, tt = modes.get_args(p.args_known) -- Update argmt.val and argmt.src in p.args_known{}
local tab_view = { -- Group datas and options for a table view with lines and columns.
test_group = arguments, -- Use default cases.
rowGroup = {},
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
return { case.key, case.val or "-", case.typ, case.need, case.keyword, case.syn, case.prop, case.format, case.src or "-
end,
title_memo = "modes_get_args_report_title", -- "modes.get_args() Values of the arguments in p.args_known{}.", -- en
headers = "modes_args_known_report_headers", -- "key; val; type; need; keyword; syn; prop; format; source"
} -- drop_box.new(
t = t .. "<br/>" .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
t = t .. viewers.ta("
t = t .. "\n* Counts for all
for count, n in pairs(counts) do -- For all known parameters
t = t .. viewers.ta(tostring(count), n)
end
t = t .. "\n* Track argmt.keyword = n : " .. tt
t = t .. "\n* Final content of arguments{}."
for key,
t = t .. viewers.ta(tostring(key),
end
viewers.restore_configs(memo, "modes.
return t
end -- t = t .. modes.
function modes.mix_args(mix, mode_name, args_template) -- Mix arguments from options_for_modes, args_template S170710mix
Ligne 6 498 ⟶ 6 345 :
-- Steps to mix modes values
--
-- Once run mix_args and mix_modes, in case a mode option would change the
mix = modes.mix_args(mix, mode_name, args_template) -- Mix arguments from options_for_modes, args_template
mix = modes.mix_modes(mix, mode_name, args_template) -- Mix some modes from several origins S170710mix
Ligne 6 649 ⟶ 6 496 :
end -- function modes.similar_args_search(search, list)
function modes.import_arguments(
local
modes.
local args_wikidata = args_wikidata or modes.args_wikidata or p.args_wikidata or {} -- optional value from p.
modes.args_wikidata = args_wikidata
local args_import = args_import or modes.args_import or {} -- optional value from p.
modes.args_import = args_import
-- default parameters
Ligne 6 664 ⟶ 6 511 :
local cats = ""
modes.nowyear = tonumber(os.date("%Y") ) -- now_date = os.date("%Y-%m-%d %H:%M:%S")
ARGS.add(viewers.ARGS, 1, "import_arguments", { ["argsknown"] =
modes.import_arguments_err = ""
modes.import_arguments_track = ""
local err = modes.verify_args_tables(
if err then return args_import, err end
---------------------------------------
Ligne 6 678 ⟶ 6 525 :
local key_N, key_NN = 0, 0
local arg_found, rec_found, already_found = false, false, false
-- initialize all arguments to "not found" before import them from p.
for key_known, argm in pairs(
if type(argm) == "table" then argm.found = 0 end
end
Ligne 6 688 ⟶ 6 535 :
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.
for key_known, argm in pairs(
if type(argm) == "table" then
argm.src = nil
Ligne 6 695 ⟶ 6 542 :
-- first initialise each known argument
modes.import_arguments_track = tostring(modes.import_arguments_track) .. " - " .. tostring(key_known)
argm_syn =
ARGS.add(viewers.ARGS, 1, "
if argm.syn == 2 then
-- Name an unnamed argument, positional, by its synonym. Nommer un argument non nommé, numéroté, par son synonyme.
Ligne 6 703 ⟶ 6 550 :
key_known = argm.keyword
-- synonyms are defined with the stamp "syn = 2", then here stamp the basic argument with "syn = 1".
argm =
argm.src = nil
argm.trk = "s"
Ligne 6 720 ⟶ 6 567 :
argm.trk = argm.trk.."w"
if argm_orig then
--
--
end
arg_found = true
Ligne 6 746 ⟶ 6 593 :
-- arg_found = true
if argm_orig then
--
--
end
else
Ligne 6 758 ⟶ 6 605 :
-- arg_found = true
if argm_orig then
--
--
end
end
Ligne 6 770 ⟶ 6 617 :
end
key_N = tonumber(key_known_init)
if key_N and not
events.add_err("modes_too_unnamed_arguments_err", key_N, argval)
events.add_cat("versions_with_usage_error_cat")
Ligne 6 786 ⟶ 6 633 :
end
-- modes.import_arguments: after import itself, some surrounding checks.
for key_known, argm in pairs(
-- 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 argm.keyword and
if argm.found and (argm.found > 2) then
events.add_err("modes_value_re_defined_err", (argm["keyword"] or "**") ) --.. ">2")
Ligne 6 814 ⟶ 6 661 :
-- All arguments sources have they been used?
-- modes.args_unknown -- unknown arguments are source arguments without known arguments.
local args_list = modes.similar_args_list(modes.
for key_src, val_src in pairs(modes.args_unknown) do -- For all unknown source arguments. function tableview.new(
arglingual = tostring(key_src) -- look for the translated argument
Ligne 6 834 ⟶ 6 681 :
end
key_N = tonumber(arglingual)
if key_N and not
events.add_err("modes_too_unnamed_arguments_err", key_N, val_src)
events.add_cat("versions_with_usage_error_cat")
Ligne 6 843 ⟶ 6 690 :
modes.args_import = args_import
return modes.args_import
end -- modes.args_import = modes.import_arguments(
function modes.args_unknown_report(t) -- Report unknown arguments.
Ligne 6 849 ⟶ 6 696 :
local tab_view = { -- Group datas and options for a table view with lines and columns.
test_group = modes.args_unknown, -- Use default cases.
rowGroup = {},
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
return { case.i, case.where, case.save, }
Ligne 6 855 ⟶ 6 703 :
headers = "modes_args_unknown_report_headers",
headers = "i;where;save",
}
t = t .. "<br/>" .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
Ligne 6 867 ⟶ 6 713 :
-- - - - ------------------ - - - - ---------------------------------
function modes.generDoc(opt,
-- List of paramètres for the module documentation
-- Lister des paramètres pour la documentation du module
Ligne 6 881 ⟶ 6 727 :
-- modes.options = " debug tests en es fr " -- for debug or enforce language
-- Option nocatview means "Do not categorize and do not show categories."
local
local err = modes.verify_args_tables(
if err then return err end
if type(module_name) ~= "string" then module_name = modes.module_name end
Ligne 6 888 ⟶ 6 734 :
if type(module_name) ~= "string" then module_name = "Central" end
local n, t, val = 0, "", ""
if type(
if type(
local key, argknw, argval, arglingual = "", "", ""
local lst = true
local lst_doc, lst_1, lst_t = {}, {}, ""
for key, parm in pairs(
val = ""
n = tonumber(key)
if n then key = tostring(parm["keyword"]) end -- key for unnamed arguments, in numeric sort
argknw =
arglingual = viewers.form9user(arglingual) -- multilingual name of the
if arglingual == "nil" then arglingual = key end -- if argument is translatable
val = parm -- tostring(args_import[key])
Ligne 6 907 ⟶ 6 753 :
if modes.option("docdef", opt) and (val ~= "") then lst = true end
if modes.option("docmax", opt) then lst = true end
if not
if key and
if lst then t = t .. viewers.tam( viewers.form9user(key), parm) end -- list if found and selected
end
t = "\n* " .. module_name .. " " .. t -- .. "}}" -- <br>
return t
end -- function modes.generDoc(opt,
function modes.sources_of_datas_colors()
Ligne 7 020 ⟶ 6 866 :
end -- function modes.all_errors_list(t)
function modes.list_all_args_main(t,
local memo = viewers.save_configs("modes.list_all_args_main") -- Save global configuration before eventual changes.
local t = "\n* " .. (t or viewers.form9user("modes_list_all_args_main_title") )
local
if type(
t = t .. viewers.ta("args N", lua_table.level_count(
local descr, description = "", ""
args = mw.clone(
local arglst = {}
langs.init_content_page_user_lang() -- function langs.init_content_page_user_lang()
for key, elem in pairs(args) do
elem.key = tostring(key)
descr = key .. "_descr" -- key for description of an argument
Ligne 7 071 ⟶ 6 918 :
viewers.restore_configs(memo, "modes.list_all_args_main") -- Restore global configurations after eventual changes.
return t
end -- function modes.list_all_args_main(t,
function modes.recursive_normal( recursiveLevel_in, recursive_limit_in, modes_recursiveLevel_err ) -- Normalize recursiveLevel and recursive_limit
Ligne 7 166 ⟶ 7 013 :
end -- function modes.namespaces_page_list()
function modes.init_modes_translate_events(frame, Central_version, mode_name,
-- After versions.init(), initialize modes and their options, known arguments, translations, and default item.
local res = ""
modes.frame = frame
langs.Central_version = Central_version -- To adapt the version of Module:Centralizer in any translated text.
modes.
modes.module_init(frame) -- Get modes.args_source with modes.args_source
modes.mode_name = mode_name or modes.mode_name or "read"
Ligne 7 179 ⟶ 7 026 :
local recursiveLevel, recursive_limit, recursiveLevel_err = modes.recursive_normal(recursiveLevel, modes.recursive_limit)
return res
end -- function modes.init_modes_translate_events(frame, Central_version, mode_name,
-- p_template_drop_box_name = 'Cuadro desplegable', -- Equivalent templates exist in other wikis
Ligne 8 152 ⟶ 7 999 :
local t = "\n* <b>versions.bind_arguments()<b>: Tests of redefine arguments for any cases."
local loaded_pack = loaded_pack or versions.loaded_modules_track()
local
local args_changes = {}
for i, get in pairs(loaded_pack) do -- for all known sub-modules
if (type(get.is_table) == "table") then -- For all types of modules
for one_arg, args in pairs(
for i, get in pairs(one_arg) do -- for all properties of an argument
one_arg.module = one_arg.module or "no module"
Ligne 8 334 ⟶ 8 181 :
end -- function versions.tasks_changes_report(t)
-- function versions.init(frame, mode_name, args_known, options_for_modes, QITEM)
function versions.init(frame, Central_version, mode_name, args_known, options_for_modes, QITEM)
-- Initializes translations, bind_libraries, bind_sub_modules, get arguments, modes, options.
-- Imports arguments from wikidata, module and template with increasing priorities.
Ligne 8 376 ⟶ 8 191 :
versions.setup_central_libraries(versions.bindable_libraries) -- Actual installation of central bindable libraries in package.loaded
versions.bind_all_sub_modules() -- Bind all sub-modules of the main module.
res = res .. modes.init_modes_translate_events(frame, Central_version, mode_name,
if type(langs) == "table" then langs.main_i18n = langs.main_i18n or versions.main_i18n or {} end -- Same pointers insure later same contents.
-- Bind all i18n translations from libraries, modules and their /I18N translations sub-modules
Ligne 8 386 ⟶ 8 201 :
local mix = modes.init_args_mode_options(mix, mode_name, args_template) -- Import and mix args mode and options -- S170710mix
-- ["QITEM"] = { ["typ"] = "dat", ["need"] = 0, ["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
local argskwn = args_known[key]
if type(one_arg) == "table" then
if type(one_arg.default_item == "string") then datas.prop_default = one_arg.default_item end -- "Q34743" -- Rudyard Kipling **
end
end
local mix = mix or {}
modes.mix = mix -- To easy get, track and test the init_args_mode_options process
Ligne 8 394 ⟶ 8 215 :
res = res .. versions.detect_MediaWiki_changes()
return res
end -- res = res .. versions.init(frame, Central_version, mode_name,
function versions.versions_support_test(t) -- Test : List all loaded modules
Ligne 8 825 ⟶ 8 646 :
t = t .. viewers.ta("main_title", modes.main_title )
t = t .. viewers.ta("label", mwuri.label )
-- local label = modes.
t = t .. viewers.ta("text", mwuri.text )
t = t .. viewers.ta("host", mwuri.host )
Ligne 9 375 ⟶ 9 196 :
return output -- .. t
end -- function viewers.simple_list(list, sep1, sep2, sep3)
function viewers.simple_list_test(t) -- Formats whole the result for users and MediaWiki tests cases. S170801rtc
local memo = viewers.save_configs("viewers.simple_list_test") -- Save global configuration before eventual changes.
t = t or "\n* viewers.simple_list_test(t) Formats whole the result for users and MediaWiki tests cases."
local t, tt = t or "\n* viewers.simple_list_test(t) Tests: Formats whole the result for users and MediaWiki tests cases.", "-"
local tt, errors = tests_groups.errors_init(tests_groups.allstatus)
t = t .. "\n* ".. (tt or "*tt*")
local tests_groups = {}
tests_groups.gettests_groups_recursive_limit = 11 -- To protect against unsought loops in recursive tests_groups.
tests_groups.main_groupname = "mathroman.testsGroups"
tests_groups.main_groupname = "tests_groups.main_tests_groups"
local kept_groups, tt = tests_groups.gettestsgroups(tests_groups.main_groupname) -- Get groups of tests cases for MW and users.
tests_groups.kept_groups = kept_groups
t = t .. "\n* ".. (tt or "-tt-")
local result_cases = {}
local result_cases = tests_groups.getcases(kept_groups) -- Run testcases for MediaWiki.
tests_groups.result_cases = result_cases
local mw_cases, tt = tests_groups.getTestProvider(result_cases, n)
local tab_view = { -- Group datas and options for a table view with lines and columns.
test_group = tests_groups,
tests_title = "tests_groups_getTestProvider_tests_title", -- Implement getTestProvider in central modules
headers = "tests_groups_testcase_tests_headers", -- "Digital number; Roman value; Correct; Error(s)"
headers = "case.name; args{}; expect{}; result{}; errors in result{} from expect{}", -- OK or error/s
keys = "name;args;expect;result;errors",
rowGroup = {},
ccc = {},
}
-- Runs tests cases and formats a table view with lines and columns.s
function tab_view.form_one_case(case) -- Convert a case from test_group to rowGroup.
case = tests_groups.run_one_case(case) -- Run one case for users and MediaWiki tests cases.getTestProvider_tests
case.res1 = case.result[1] or "res1" -- DEBUG : mathroman.int2roman() can fail without blocking page.
case.err2 = case.result[case.errorsKey] or "err2" -- DEBUG : mathroman.int2roman() can fail without blocking page.
case.errors = case.errors or status.OK
case.errors = viewers.ta("case.res1", case.res1) .. viewers.ta("case.err2", case.err2) .. viewers.ta("case.errors", case.errors)
-- headers = "case.name; args{}; expect{}; result{}; errors in result{} from expect{}", -- OK or error/s
return { case.name, lua_table.rough_view(case.args), lua_table.rough_view(case.expect), lua_table.rough_view(case.result), case.errors }
end -- errors in result
t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
viewers.restore_configs(memo, "viewers.simple_list_test") -- Restore global configurations after eventual changes.
return t
end -- t = t .. viewers.simple_list_test(t)
function viewers.simple_list_test(t) -- Test of : Sort without repeat a list with separators like "Central01;versions 2.4;tools;two words"
local memo = viewers.save_configs("viewers.simple_list_test") -- Save global configuration before eventual changes.
local t = t or ""
t = t .. "\n* Test <b>viewers.simple_list(list, sep1, sep2, sep3)</b>: "
t = t .. '\n* Remove repeats in a string list with separators. Can also sort.'
local function simpleList_test1(t, input, sep1, sep2, sep3, sep4)
local output = tostring( viewers.simple_list(input, sep1, sep2, sep3, sep4) )
t = t .. viewers.table_row() .. viewers.table_dat(viewers.value(input)) .. viewers.table_dat(viewers.value(sep1)) .. viewers.table_dat(viewers.value(sep2))
t = t .. viewers.table_dat(viewers.value(sep3)) .. viewers.table_dat(viewers.value(sep4)) .. viewers.table_dat(viewers.value(output))
return t
end
t = t .. viewers.table_head() .. viewers.table_col("input") .. viewers.table_col("sep1") .. viewers.table_col("sep2") .. viewers.table_col("sep3") .. viewers.table_col("sep4") .. viewers.table_col("output")
t = simpleList_test1(t, "abc;def;abc", ";", "-", "|")
t = simpleList_test1(t, "xyz;def;abc", ";", "sort")
t = simpleList_test1(t, "abc-def=abc", "-", "=")
t = simpleList_test1(t, "abc - def = abc", "-", "=", "sort")
t = simpleList_test1(t, "abc - def = abc", "-", "=", "sort", "trim")
t = simpleList_test1(t, ";;", ";", ";", ",")
t = simpleList_test1(t, "abc/def;abc", ";", "/")
t = simpleList_test1(t, "abc;def/abc/def;abc;def;abc", ";", "/", "-")
t = simpleList_test1(t, "abc;def;abc", ";", ";", "")
t = t .. viewers.table_end()
viewers.restore_configs(memo, "viewers.simple_list_test") -- Restore global configurations after eventual changes.
return t
end -- viewers.simple_list_test(t)
-- for _test1 search also _test1 simpleList_test1 date_to_part_test1
function viewers.form_one_case(case) -- Convert a case from test_group to rowGroup.
Ligne 9 795 ⟶ 9 684 :
function drop_box.new(selector, title, content_or_func, ...) -- Formats a drop_box for a doc or a group of tests. Take apart dropit options.
-- From 20180503 a bug (in Module:Centralizer or MediaWiki) some Dropboxes display twice : modes.
-- From 20180503 a bug (in Module:Centralizer or MediaWiki) See CentralManual display twice : modes.
-- selector = "allwaysview" -- To allways display one view. -- selector = "enforcerun" -- To debug one box with INTERNAL ERROR.
local memo = viewers.save_configs("drop_box.new") -- Save global configuration before eventual changes.
Ligne 9 982 ⟶ 9 871 :
function tableview.form_whole_view(tab_view) -- Formats whole the tableview.new()
local memo = viewers.save_configs("tableview.
local t, err = "", ""
if (lua_table.level_count(tab_view.test_group) == 0) then
Ligne 10 006 ⟶ 9 895 :
t = t .. viewers.table_row()
for col, val in ipairs(columns_i) do
t = t .. viewers.table_dat(val
end
end
Ligne 10 036 ⟶ 9 925 :
if not mask_sections then res = res .. viewers.doc_section(selector, "viewers_section_title_page", "h2", mask_sections) end
res = res .. drop_box.new(selector, "datas.available_props_report(t) Reports availables datas properties **", datas.available_props_report)
-- res = res .. drop_box.new(selector, "
res = res .. drop_box.new(selector, "modes_get_args_report_title", modes.
res = res .. drop_box.new(selector, "modes_used_options_list_title", modes.used_options_list )
res = res .. drop_box.new(selector, "modes_list_all_args_main_title", modes.list_all_args_main)
Ligne 10 043 ⟶ 9 932 :
-- res = res .. drop_box.new(selector, "langs_translations_counts_title", langs.translations_counts) -- S170618ltc
res = res .. drop_box.new(selector, "luaTable_table_args_source_title", lua_table.structure, modes.args_source, "modes.args_source")
res = res .. drop_box.new(selector, "
return res
end -- function viewers.doc_page(selector, mask_sections)
Ligne 10 050 ⟶ 9 939 :
local res = ""
if not mask_sections then res = res .. viewers.doc_section(selector, "viewers_section_title_module", "h2") end
res = res .. drop_box.new(selector, "modes_args_unknown_report_title", modes.args_unknown_report)
res = res .. drop_box.new(selector, "versions_support_desk_title", versions.form_support_desk_report)
Ligne 10 069 ⟶ 9 957 :
res = res .. drop_box.new(selector, "activity_MW_Versions_report_title", activity.MW_Versions_report)
res = res .. drop_box.new(selector, "activity_central_functions_report_title", activity.central_functions_report)
res = res .. drop_box.new(selector, "activity_check_html_bold_tags_title", activity.check_html_bold_tags)
-- if 1 then return res end -- try to find : {{Centralizer|tests|itemid=Q535}} Erreur Lua : not enough memory
-- activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Report imbalances of beginnings and ends of bold in code.",
--
if not mask_sections then res = res .. viewers.doc_section(selector, "Library:datas", "h3") end -- .get_item(
Ligne 10 109 ⟶ 9 999 :
-- if not mask_sections then res = res .. viewers.doc_section(selector, "viewers_section_title_library_modes", "h3") end
-- res = res .. drop_box.new(selector, "datas.get_item() Report datas from mw.wikibase **", datas.get_item_report)
res = res .. drop_box.new(selector, "modes_get_args_report_title", modes.
res = res .. drop_box.new(selector, "modes_used_options_list_title", modes.used_options_list)
-- res = res .. drop_box.new(selector, "modes.
-- res = res .. drop_box.new(selector, "modes_used_options_list_title", modes.used_options_list )
res = res .. drop_box.new(selector, "versions_bind_arguments_tests_title", modes.options_from_args_tests)
Ligne 10 119 ⟶ 10 009 :
-- res = res .. drop_box.new(selector, "modes_options_uses_tests_title", modes.options_from_mode_tests,
-- d.bg1="yellow", d.border_color="red", d.border_radius="10px 10px 10px 10px", image="Sanscrit dha.svg", } ) -- , cssview=true
res = res .. drop_box.new(selector, "modes_recursive_normal_tests_title", modes.recursive_normal_tests) -- only errors
-- arguments list
-- res = res .. drop_box.new(selector, "modes_all_categories_list_title", modes.all_categories_list) -- n = 0
Ligne 10 128 ⟶ 10 019 :
res = res .. drop_box.new(selector, "modes_namespaces_page_list_title", modes.namespaces_page_list)
res = res .. drop_box.new(selector, "modes_recursive_normal_tests_title", modes.recursive_normal_tests) -- only errors
-- function tab_view.form_one_case)
-- "enforcerun"
-- res = res .. viewers.doc_section(selector, "Library:tests_groups", "h3") -- S170801rtc todo
-- res = res .. drop_box.new(selector, "tests_groups_recursive_tests_title", tests_groups.recursive_tests (t)
-- res = res .. drop_box.new(selector, "tests_groups_getTestProvider_title", viewers.simple_list_test )
--
if not mask_sections then res = res .. viewers.doc_section(selector, "Library:versions", "h3") end
-- if not mask_sections then res = res .. viewers.doc_section(selector, "viewers_section_title_library_versions", "h3") end
Ligne 10 138 ⟶ 10 032 :
res = res .. drop_box.new(selector, "versions_all_G_and_loaded_list_title", versions.all_G_and_loaded_list)
-- res = res .. drop_box.new(selector, "versions_central_changes_title", versions.central_changes) --RIC mw.loadData(
-- res = res .. drop_box.new(selector, "versions_deprecated_function_tests", viewers.simple_list_test)
-- res = res .. drop_box.new(selector, "versions_bind_modules_tests_title", versions.bind_modules_test )
res = res .. drop_box.new(selector, "versions_sort_central_modules_title", versions.sort_central_modules_report ) -- S170606cmr
Ligne 10 148 ⟶ 10 043 :
res = res .. drop_box.new(selector, "langs_form99user_tests_title", viewers.form99user_test )
res = res .. drop_box.new(selector, "viewers_parts_of_date_tests_title", viewers.parts_of_date_tests)
res = res .. drop_box.new(selector, "viewers_simpleList_tests_title", viewers.simple_list_test )
res = res .. drop_box.new("never", "viewers_table_tab_options_title", viewers.table_test )
res = res .. drop_box.new(selector, "viewers_save_restore_balance_title", viewers.save_restore_balance_report) -- to_debug_on_20170507
Ligne 10 205 ⟶ 10 101 :
datas.QITEM = mw.wikibase.getEntityIdForCurrentPage() -- use props.QITEM Returns the Item id as string, like "Q42"
local QITEM = datas.QITEM or datas.default_item or "Q307" -- Keep Galilée (Q307)
datas.prop, datas.props = datas.get_item(modes.
langs.init_content_page_user_lang() -- function langs.init_content_page_user_lang()
local prop = datas.prop
Ligne 10 211 ⟶ 10 107 :
local flag = viewers.form_image("Flag_of_England.svg", 50)
-- local flag = viewers.form_image(viewers.form9user("flag_of_country"), 50)
--
--
--
--
local image = viewers.form_image(prop.image, 50)
local birthyear_deathyear = " ( " .. (prop.birthyear or "birthyear") .. " - " .. (prop.deathyear or "deathyear") .. " ) "
Ligne 10 226 ⟶ 10 122 :
res = '<div style="border-radius:0.7em; margin-right:5px; box-shadow:0.2em 0.3em 0.2em #B7B7B7; background-color:#F1F1DE; padding:0.3em; width=90%; overflow-x:hidden; ">' .. res .. '</div>'
return res
end -- function p.box_read(
-- Display the documentation in an infobox, similar to edit-boxs
-- Affichage de documentation dans un cadre (box), semblable aux boites d'edition
function p.box_edit(
-- read = " box1 ",
-- edit = " box1 docdef docline docsrc docdata catview docview : ",
Ligne 10 236 ⟶ 10 132 :
-- tests = " box1 docdef docline docsrc docdata catview docview : tests ",
local res, props = "", datas.props
if type(
langs.init_content_page_user_lang(modes.args_source.contentlang, modes.args_source.pagelang, modes.args_source.userlang)
-- res = res .. "<center><small>" .. viewers.discreet_main_version() .. viewers.ta("contentlang", langs.content_lang) .. viewers.ta("pagelang", langs.page_lang) .. viewers.ta("userlang", langs.user_lang)
Ligne 10 249 ⟶ 10 145 :
if modes.option("docdata") then res = res .. "\n*" .. modes.generDoc(" docdef docline ", datas.args_wikidata, datas_link) end
res = res .. ", " .. viewers.form9user(" (%1 properties)", (datas.propss_count_all or "") ) -- datas_structured_data_txt
if modes.option("docview") then res = res .. "\n*" .. modes.generDoc("",
if not modes.option("noerr")then res = res .. "\n*" .. events.errors_lister() end
local t = "" -- Formats events views
-- local wng, err, cat = events.sort_typ() -- Sort events by type in wng, err, cat.
-- if
-- if
for key,
if
if
end
end
--
for key,
if
if
end
end
--
for key,
if
if
end
end
Ligne 10 283 ⟶ 10 179 :
-- result = result .. "\n* " .. events.categories_lister(":")
return res
end -- function p.box_edit(
function p.form_result(
local res = ""
local memo = viewers.init_configs("p.form_result") -- Initialize global configurations and save them before eventual changes.
datas.default_item = datas.default_item or "Q307" -- Keep Galilée (Q307)
main_module = main_module or versions.main_module
if type(
res = res .. viewers.ta("modes.mode_name", modes.mode_name) .. viewers.ta("modes.options", modes.options)
-- if modes.option("box1") then res = res .. p.box_read(props) end -- ric (p.box_read)
Ligne 10 297 ⟶ 10 192 :
if modes.option("box1") or modes.option("catview")
then res = res .. " catview = " .. events.categories_lister(":") end -- Display categories
events.gener_categories(
if modes.option("docview") or modes.option(":") or modes.option("tests") or (modes.
res = res .. "\n* datas.default_item = <b>" .. datas.default_item .. "</b>, datas.default_name = <b>" .. datas.default_item .. "</b>\n"
res = res .. p.box_edit(modes.
elseif modes.option("read") or (modes.
res = res .. "\n* datas.default_item = <b>" .. datas.default_item .. "</b>, datas.default_name = <b>" .. datas.default_item .. "</b>\n"
res = res .. p.box_read(modes.
elseif modes.option("edit") or (modes.
end
modes.time3 = os.clock()
if modes.option("tests") then -- or (modes.
res = res .. viewers.doc_group("allwaysview") -- viewers.doc_group(selector, mask_sections) -- To enforce title of sections
-- res = res .. viewers.doc_page("allwaysview") -- included in viewers.doc_group
Ligne 10 316 ⟶ 10 211 :
viewers.restore_configs(memo, "p.form_result") -- Restore global configurations after eventual changes.
return res
end -- res = res .. p.form_result(
function viewers.init_configs(memo, tab_view, group) -- Initialize global configurations and save them before eventual changes.
Ligne 10 360 ⟶ 10 255 :
memo.memo_user_lang = langs.user_lang
memo.memo_user_translations = langs.user_translations
memo.
memo.memo_args_template = modes.args_template
memo.memo_modes_catView = modes.catView
Ligne 10 395 ⟶ 10 290 :
langs.user_translations = memo.memo_user_translations
langs.init_content_page_user_lang(langs.content_lang, langs.page_lang, langs.user_lang)
modes.
modes.args_template = memo.memo_args_template
modes.catView = memo.memo_modes_catView
Ligne 10 473 ⟶ 10 368 :
p.i18n.br = { -- Translations in breton
-- Arguments to import, do not translate. Arguments à importer, ne pas traduire.
["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "modules_guide", ["
['p_template_drop_box_name'] = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.form
['c'] = 'c',
Ligne 10 531 ⟶ 10 426 :
p.i18n.en = { -- Translations in English
-- Arguments to import, do not translate.
["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "modules_guide", ["
['p_template_drop_box_name'] = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.form
['c'] = 'c',
Ligne 10 588 ⟶ 10 483 :
p.i18n.es = { -- Translations in espagnol
-- Importar estos argumentos. No traducir.
["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "modules_guide", ["
['p_template_drop_box_name'] = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.form
['c'] = 'c',
Ligne 10 646 ⟶ 10 541 :
p.i18n.fr = { -- Translations in français
-- Arguments to import, do not translate. Arguments à importer, ne pas traduire.
["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "modules_guide", ["
['p_template_drop_box_name'] = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.form
['c'] = 'c',
Ligne 10 705 ⟶ 10 600 :
p.i18n.vi = {
-- Arguments to import, do not translate. Arguments à importer, ne pas traduire.
["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "modules_guide", ["
['p_template_drop_box_name'] = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.form
['c'] = 'c',
Ligne 10 770 ⟶ 10 665 :
-- - - - ------------------ - - - - ---------------------------------
p.
-- 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.
-- Guideline to integer i18n translations following a list of sub-modules: modules_guide with their own translations.
-- Guideline to integer default arguments values: defaults values are always from Centralizer.
Ligne 10 783 ⟶ 10 678 :
-- Special arguments to modify the fonctions and outputs of this module.
-- Arguments speciaux pour modifier le fonctionnement et les sorties de ce module.
["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "modules_guide", ["
["category"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "category"},
["debug"] = { ["typ"] = "opt", ["need"] = 0, ["keyword"] = "debug"},
Ligne 10 798 ⟶ 10 693 :
["pagelang"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "pagelang"},
["userlang"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "userlang"},
["
["
["
["
--[[
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.
Ligne 10 834 ⟶ 10 757 :
["arg_values"] = "rights_values", ["key_values"] = "no;none;ONU;none;cn;50;us;70;mpf", -- wiki_selectors
["delay_values"] = "0;0;0;0;50;50;70;70;95", ["arg_uses"] = "none;none;none;none;cn;cn;us;us;mpf" }, -- wiki_selectors
["
["labelbylang"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "labelbylang", ["prop"] = "P18", },
--
--
} -- #p.
function p.form_support_desk_report(t) return versions.form_support_desk_report(t) end
Ligne 10 884 ⟶ 10 807 :
return res
end -- function p.form_tests_init(res, args_source)
function p.interact_args_final(args_import, args_known)
local t = ""
local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = { -- }
if type(args_import) ~= "table" then args_import = modes.args_import or {} end
local args_final = mw.clone(args_import) -- do not disturb original args_import
local a = args_import
local i = {} -- interact
datas.prop_default = datas.prop_default or "Q307" -- keep Galilée (Q307)
local tit = nil
if not a.title then -- If title is undefined, enforce it.
if a.lastname and a.firstname then
tit = a.firstname .. " " .. a.lastname
end
i.title = a.label or modes.main_title or a.QITEM or a.itemid or a.title or datas.prop_default
end
--
if a.docfunc then a.docfunc = mw.text.trim(a.docfunc) end -- dockey docitem args_known = { i18n.vi
if a.docitem then a.docitem = mw.text.trim(a.docitem) end -- dockey docitem args_known = { i18n.vi
if a.dockey then a.dockey = mw.text.trim(a.dockey) end -- dockey docitem args_known = { i18n.vi
if not a.QITEM then -- The Title can come from several arguments to insure it.
i.QITEM = a.label or modes.main_title or a.QITEM or a.itemid or a.title
i.QITEM = mw.text.trim(i.QITEM or datas.prop_default) -- Rudyard Kipling
else
a.QITEM = a.QITEM or datas.default_item
a.QITEM = mw.text.trim(a.QITEM)
end
--
-- if absent, synonym of basic arguments, syn = 2
if not a.firstname then i.firstname = (i.firstname2 or a.firstname2) end
if not a.lastname then i.lastname = (i.lastname2 or a.lastname2) end
if not a.firstname2 then i.firstname2 = (i.firstname or a.firstname) end
if not a.lastname2 then i.lastname2 = (i.lastname or a.lastname) end
--
if not a.initial then -- If initial is undefined, enforce it.
if a.lastname then
i.initial = string.sub( a.lastname, 1, 1 ) -- selector the first letter
i.initial = string.upper( i.initial or "*" )
end
end
--
local label = a.label or a.labeluser or a.labelpage or a.labelcontent or a.labelbylang
if label then i.label = label
else
events.add_err( viewers.form9user("versions_with_internal_error") )
events.add_cat( viewers.form9user("versions_with_internal_error_cat") )
end
--
if a.birth and not a.birthyear then
local tt, err = viewers.date_to_part(a.birth, viewers.form9user("modes_date_to_part_format"), "yyyy")
if tt then i.birthyear = tt else
events.add_err(err, viewers.form9user("birthyear"), "yyyy")
events.add_cat("modes_date_to_part_call_cat")
end
end
-- memorize interactions in modes.args_final and show errors or warnings
langs.init_content_page_user_lang() -- function langs.init_content_page_user_lang()
local n = 0
for key, val in pairs(i) do
local argskwn = args_known[key]
if type(argskwn) == "table" then
args_final[key] = val -- = i[key]
args_final.src = "inter"
n = n + 1
if (args_final.need == 2) and not a[key] then --
-- need = 2 necessary from argument or module interaction
events.add_wng("modes_auto_val_warning_wng", langs.user_translations[key], val) -- form_result
end
else
events.add_err("modes_unknown_auto_arg_err", langs.content_translations[key], val)
end
end
modes.args_final = args_final
return args_final, t
end -- args_final = p.interact_args_final(args_import)
Ligne 10 894 ⟶ 10 892 :
-- - - - ------------------ - - - - ---------------------------------
function Central.install(frame, Central_version, mode_name, args_known, options_for_modes)
-- p.version.versionNumber = CentralI18N.version.versionNumber
local res = ""
return "\n* ARGS.t=" .. tostring(ARGS.t) .. ", CNT.t=" .. tostring(CNT.t)
end
function Central.demo(frame, Central_version, mode_name, args_known, options_for_modes)
-- p.version.versionNumber = CentralI18N.version.versionNumber
local res = ""
return "\n* ARGS.t=" .. tostring(ARGS.t) .. ", CNT.t=" .. tostring(CNT.t)
end
function Central.init(frame, Central_version, mode_name,
-- p.version.versionNumber = CentralI18N.version.versionNumber
local res = ""
tracker.init_trakers() -- Initialize some trakers. To run in Central.init()
modes.time1 = os.clock()
local
Central_version = Central_version or langs.Central_version or Central.Central_version
local options_for_modes = options_for_modes or modes.options_for_modes or p.options_for_modes
Ligne 11 069 ⟶ 10 916 :
langs.main_i18n = versions.memo_i18n ; versions.main_i18n = versions.memo_i18n
-- local datas = mw.clone(datas)
res = res .. modes.init_modes_translate_events(frame, Central_version, mode_name, modes.
datas.props = datas.get_item(
modes.init_args_mode_options(mix, mode_name, modes.args_template) -- Import and mix args mode and options from template and invoke -- S170710mix
modes.args_import = modes.import_arguments(
modes.
modes.get_args(args_known) -- Interactions between arguments
langs.init_content_page_user_lang() -- function langs.init_content_page_user_lang()
res = res .. (datas.props_trk or "")
Ligne 11 079 ⟶ 10 927 :
-- p.version.versionNumber = CentralI18N.version.versionNumber
return res
end -- function Central.init(frame, Central_version, mode_name,
function Central.read(frame) -- The read mode generates the normal result for read only users.
-- Helpers or admins can add options to include edit or tests or user language...
local res = ""
local t = Central.init(frame, Central.Central_version, "read", p.
-- res = res .. t
modes.args_final = p.interact_args_final(modes.args_import) -- Interactions between arguments
res = res .. p.form_result(modes.args_final)
res = res .. "\n* " .. datas.track_val
return res
Ligne 11 094 ⟶ 10 943 :
local res = "</b>"
res = res .. "Library:langs"
local t = Central.init(frame, Central.Central_version, "edit", p.
-- res = res .. t
modes.args_final = p.interact_args_final(modes.args_import) -- Interactions between argumensts
res = res .. "</b>"
res = res .. p.form_result(modes.
return res
end -- function Central.edit(frame)
Ligne 11 106 ⟶ 10 956 :
function Central.doc(frame) -- Formats a documentation or a test in a drop_box.
local res = ""
Central.init(frame, p.Module_Central_version, "doc", p.
langs.init_content_page_user_lang() -- function langs.init_content_page_user_lang()
modes.change_itemid() -- default = "Q41568"
modes.args_final = p.interact_args_final(modes.args_import) -- Interactions between argumensts
-- {{Central|doc|versions_support_desk_title}}
local docfunc = modes.
local docitem = modes.
local dockey = modes.
local QITEM = modes.
QITEM = mw.text.trim(QITEM) -- clean spaces in each name
if dockey then
Ligne 11 124 ⟶ 10 975 :
local res = ""
res = res .. tracker.init_trakers() -- Initialize some trakers. To run in Central.init()
local t = Central.init(frame, Central.Central_version, "tests", p.
res = res .. t
-- res = res .. "\n* getEntityIdForCurrentPage = " .. tostring( mw.wikibase.getEntityIdForCurrentPage() ) -- Returns the Item id as string, like "Q42"
p.form_tests_init()
modes.args_final = p.interact_args_final(modes.args_import) -- Interactions between arguments
langs.init_content_page_user_lang(a, b, c, d, "Central.tests")
versions.main_versions = versions.main_versions or { versionName = "versionName", versionNumber = "0.0", }
if not versions.main_versions then versions.main_versions = p.version or versions.version end
modes.mode_name = "tests"
res = res .. p.form_result(modes.
-- res = res .. viewers.try_graph()
return res
Ligne 11 286 ⟶ 11 138 :
{ site = "fr.wikisource", verstime = "2018-12-19T17:52:30", versid = "1.33.0-wmf.9 (7cf3023)", seen_time = "2018-12-20T09:07:00", },
{ site = "fr.wikisource", verstime = "2018-12-20T17:20:46", versid = "1.33.0-wmf.9 (02196d2)", seen_time = "2018-12-20T21:04:00", },
{ site = "www.MediaWiki", verstime = "2019-01-08T21:06:30", versid = "1.33.0-wmf.12 (1bc0e29)", seen_time = "2019-01-09T06:03:00", },
{ site = "fr.wikisource", verstime = "2019-01-10T20:33:38", versid = "1.33.0-wmf.12 (ee22e48)", seen_time = "2019-01-11T09:09:00", },
{ site = "fr.wikisource", verstime = "2019-01-11T21:00:02", versid = "1.33.0-wmf.12 (fd444fe)", seen_time = "2019-01-12T07:02:00", },
{ site = "fr.wikisource", verstime = "2019-01-15T01:25:25", versid = "1.33.0-wmf.12 (21b4e27)", seen_time = "2019-01-16T06:19:00", },
{ site = "www.MediaWiki", verstime = "2019-01-15T19:23:17", versid = "1.33.0-wmf.13 (baa5168)", seen_time = "2019-01-16T06:19:00", },
{ site = "fr.wikisource", verstime = "2019-01-17T20:05:42", versid = "1.33.0-wmf.13 (c8ec225)", seen_time = "2019-01-18T07:40:00", },
} -- MWMW
versions.MediaWiki_version_memo = "1.33.0-wmf.
versions.MediaWiki_Versions_sort = "<" -- First on end, Last on begin
versions.MediaWiki_Versions_sort = ">" -- First on begin, Last on end
Ligne 11 296 ⟶ 11 154 :
local selector = selector or "enforce"
local mask_sections = mask_sections or nil
if p.teststests == "
res = res .. "\n*
res = res .. drop_box.new(
res = res .. drop_box.new(
res = res .. drop_box.new(selector, "p.
res = res .. drop_box.new(selector, "modes Init Frame Args Mode Libraries **", p.init_central_module_tests)
res = res .. drop_box.new(selector, "modes_get_args_datas_tests_title", modes.get_args_datas_tests)
|