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

Contenu supprimé Contenu ajouté
MdCentral from levenshtein_similar_tests OK 190202 0020.lua
MdCentral.lua MdCentral 1.33.0-wmf.20 save as it is ot try it in MdTests.lua 20190306 0840.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 from1.33.0-wmf.20 levenshtein_similar_testssave OKas 190202it 0000is ot try it in MdTests.lua 20190306 0840.lua
------------------------------------------|------------------------ typical length --------------------------|----------max| DODO
-- function drop_box.new(selector, title, content_or_func, ...) -- Formats a drop_box for a doc or a group of tests. Take apart onedrop options.
 
-- MUMU : means to report in the CentralManual.
Ligne 16 ⟶ 15 :
['versionFrom'] = "CentralTest begin debug from function modes.levenshtein_similar_tests OK.lua",
['versionName'] = "Centralizer",
['versionNumber'] = "1.0.0(190202T00190306T07:0040)",
['versionDate'] = "2019-0203-02T0006T07:0040:00", -- UTC version structure MWMW 2019-03-02T09:28:00
['mainDescription'] = "Begin to use",
['functionDescription'] = "first functional support",
Ligne 404 ⟶ 403 :
return "\n* ARGS.t=" .. tostring(ARGS.t) .. ", CNT.t=" .. tostring(CNT.t)
end
-------------------
---- CO
-------------------
 
 
-- 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) -- Runs tests cases and 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() -- 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.form(evt, c) -- Format an event as an error, warning or category.
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, evt in pairs(events.list_all_events) do
evt = events.form(evt, c) -- Format an event as an error, warning or category.
table.insert(gener, evt ) -- Build a table with translations counts.
end
return gener
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)
 
function drop_box.html(title, content_or_func) -- Builds the drop box at the html level.
local memo = viewers.save_configs("onedrop.html") -- Save global configuration before eventual changes.
local t = "\n* onedrop.html() -- Builds the drop box at the html level."
local drop_box_html = drop_box_html_start .. drop_box_html_medium .. drop_box_html_end .. drop_box_look_like
t = t .. drop_box_html_start .. drop_box_html_content
viewers.restore_configs(memo, "onedrop.html") -- Restore global configurations after eventual changes.
return drop_box_html_start
end -- t = t .. onedrop.html(title, content) -- Builds the drop box at the html level.
 
function drop_box.new_title() -- Support desk title of the docDropbox of the edit box.
local t, strings_c, tables_c, strs_on_tabs, subnames = langs.i18n_sub_counts("langs.main_i18n", "langs_main_i18n_languages_count", "user")
local report_main_discreet = viewers.styles_color_discreet( viewers.form_main_version(main_versions) )
local title = viewers.form9user("versions_support_desk_title", report_main_discreet, strs_on_tabs, tables_c)
-- "Support desk for %1 : %2 translations in %3 languages"
return title
end -- function drop_box.new_title()
 
drop_box.css_options = { -- Conventional CSS parameters : See -- https://en.wikisource.org/wiki/Template:drop_box#Parameters
["cssview"] = false, -- cssview : display values of options
["bg1"] = "#FFFFFF", -- bg1 : the background-color for the header
["fs1"] = "100%", -- font-size: 100%;
["fw1"] = "left", -- fw1 : the font-weight for the heading
["ta1"] = "left", -- ta1 : the text-align for the heading
["tc1"] = "black", -- tc1 : the text-color for the heading
--
["bg2"] = "#FFFFFF", -- bg2 : the background-color for the content
["fs2"] = "100%", -- font-size: 100%;
["fw2"] = "left", -- fw2 : the font-weight for the body
["ta2"] = "left", -- ta2 : the text-align for the body
["tc2"] = "black", -- tc2 : the text-color for the body
}
 
viewers.CSS_centralizer = { -- Conventional css parameters : from -- https://en.wikisource.org/wiki/Template:drop_box#Parameters UM
["change"] = "The Module:Centralizer as central changes 2 options like the sun: the typical color and round corners. Used as default in viewers.CSS_centralizer = {...}.",
["height"] = "20px", -- for the round corners
["border-radius"] = "30px", -- for the round corners
["background-color"] = "#ffffcc", -- for the typical color: with a yellow color drawing on the white
["border-color"] = "#ffffcc", -- for the typical color: with a yellow color drawing on the white
}
 
viewers.CSS_drop_down_boxes = { -- Conventional css parameters : from -- https://en.wikisource.org/wiki/Template:drop_box#Parameters UM
["change"] = "Typical style for drop-down boxes.",
["style"] = { -- style : HTML/CSS for affectionates only.
["style"] = "clear:both; margin-bottom:1em; width:99%; border-style:solid; border-radius:0px 0px 0px 0px; border-color:#AAAAAA; background-color:#FFFFFF;",
["title"] = "▼ /▶ ",
},
}
 
-------------------
---- CO CS
-------------------
 
viewers.CSS = { --- Default Conventional css parameters : from -- https://en.wikisource.org/wiki/Template:drop_box#Parameters UM
["margin_all"] = "0px", -- margin
["cssview"] = false, -- cssview : display values of options
["bg1"] = "#FFFFFF", -- bg1 : the background-color for the header
["fs1"] = "100%", -- font-size: 100%;
["fw1"] = "left", -- fw1 : the font-weight for the heading
["ta1"] = "left", -- ta1 : the text-align for the heading
["tc1"] = "black", -- tc1 : the text-color for the heading
--
["bg2"] = "#FFFFFF", -- bg2 : the background-color for the content
["fs2"] = "100%", -- font-size: 100%;
["fw2"] = "left", -- fw2 : the font-weight for the body
["ta2"] = "left", -- ta2 : the text-align for the body
["tc2"] = "black", -- tc2 : the text-color for the body
["change"] = "The Module:Centralizer as central changes 2 options like the sun: the typical color and round corners. Used as default in viewers.CSS_centralizer = {...}.",
["height"] = "20px", -- for the round corners
["border-radius"] = "30px", -- for the round corners
["background-color"] = "#ffffcc", -- for the typical color: with a yellow color drawing on the white
["border-color"] = "#ffffcc", -- for the typical color: with a yellow color drawing on the white
["change"] = "Typical style for drop-down boxes.",
["style"] = { -- style : HTML/CSS for affectionates only.
["style"] = "clear:both; margin-bottom:1em; width:99%; border-style:solid; border-radius:0px 0px 0px 0px; border-color:#AAAAAA; background-color:#FFFFFF;",
["title"] = "▼ /▶ ",
},
["fw1"] = "left", -- fw1 : the font-weight for the heading
-- All values here are default one's.
["fw2"] = "left", -- fw2 : the font-weight for the body
["fs1"] = "100%", -- fs1 : the font-size for the heading
["fs2"] = "100%", -- fs2 : the font-size for the body
["bg1"] = "#FFFFFF", -- bg1 : the background-color for the heading
["bg2"] = "#FFFFFF", -- bg2 : the background-color for the body
["ta1"] = "left", -- ta1 : the text-align for the heading
["ta2"] = "left", -- ta2 : the text-align for the body
["float"] = "none", -- float : should the box be floated? (left, right, or none)
["width"] = "99%", -- width : the width of the box, e.g. 33%
["border-radius"] = "0px 0px 0px 0px", -- border-radius: "15px 50px 30px 5px" : add rounded corners to an element.
["border-color"] = "#ffffcc", -- for the typical color: with a yellow color drawing on the white
["headType"] = "h4", -- -- headType : allows you to set the box header to "h4", e.g. <h4>Box 1.1</h4>
["tc1"] = "black", -- tc1 : the the text-color for the heading
["tc2"] = "black", -- tc1 : the the text-color for the body
["image"] = "Victor Hugo.jpg", -- from datas
}
 
-------------------
---- CO CS
-------------------
 
function viewers.CSS_change(CSS, content) -- Changes the drop_box style using any options.
local CSS = mw.clone(CSS) -- Save global style before eventual changes.
if type(CSS) == "table"
then CSS = CSS -- The new CSS style cans change any options. Only options known in CSS and redefined are active.
else CSS = mw.clone(viewers.CSS_centralizer) end -- as default
return CSS
end -- function viewers.CSS_change(CSS) -- Changes the drop_box style using any options.
 
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.get_args_report.
-- From 20180503 a bug (in Module:Centralizer or MediaWiki) See CentralManual display twice : modes.get_args_report.xml
-- 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.
local t = ""
-- t = t .. "<p width:#10%; > ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. </p>"
t = t .. "<p > ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. </p>"
local args = {...}
local content_or_func_error = viewers.form9user("\n* Error : Abnormal content for drop_box.new(%1, %2).\n*", selector, title, content_or_func) -- , %3
if selector == "never" then return "" end
if not ( (selector == true) or (selector == title) or viewers.is_in_sp(selector, "allwaysview alltestsview enforcerun failinref nocontent") ) then return "" end
if (type(title) ~= "string") then title = "Default_title" end
local dropit = nil -- dropit to change the look of the drop_box
-- Style options in dropit{}: ta1, image, ta2, margin_bottom, width, border_radius, border_color, bg1)
for i, args_tab in ipairs(args) do -- Get the dropit options for the drop_box.
modes.recursiveLoop = (modes.recursiveLoop or 0) + 1
if modes.recursiveLoop > 33 then return "" end
-- The last argument can be a dropit to change the look of the drop_box
if (i == lua_table.level_count(args) ) and (type(args_tab) == "table") and (args_tab["dropit"] == "dropit") then
dropit = mw.clone( args_tab )
end
end
local dropit = dropit or {} -- for antiCrash
if type(title) ~= "string" then title = viewers.form9content("viewers_dropdown_missing_title") end
dropit.selector = selector
dropit.title = title
dropit.args = { ... } -- optional arguments for the content_or_func function
local func_from_name = nil
dropit.content = content_or_func -- string or function
if type(content_or_func) == "string" then func_from_name = lua_table.from_subnames_object(content_or_func) end -- Get the last sub-table from its sub-names.
dropit.content_error = ""
dropit.title = dropit.title .. ( dropit.title_errors or "" )
dropit.resultKind = "ref"
local success, result = true, ""
dropit.result = result
dropit.success = success
if type(func_from_name) == "function" then -- In case of named function:
dropit.func_name = content_or_func -- memorise its name
-- dropit.content = func_from_name -- and use it as content form function
end
-- Original code from wikisource : "{{Boîte déroulante/début|titre=" .. title .. "|ta1=" .. ta1 .. "}}" .. content .. "{{Boîte déroulante/fin}}"
local d = dropit
d.CSS = viewers.CSS
d.CSS.title = dropit.title or d.CSS.title
t = t .. '<div align="'.. d.CSS.ta2 ..'" >'
t = t .. '<div class="NavFrame" style="clear:both; margin-bottom; width:'.. d.CSS.width
t = t ..'; border-style:solid; border-radius:'.. d.CSS["border-radius"] ..'; border-color:'.. d.CSS["border-color"]
t = t ..'; background-color:'.. d.CSS.bg1 ..'; " title= >' -- "'.. d.CSS.label ..'"
t = t .. '<div class="NavHead" align="'.. d.CSS.ta1 ..'" style=" height:'.. d.CSS.height ..'; background-color:'.. d.CSS.bg1 ..'; color:'.. d.CSS.tc1 ..'; " >'
t = t .. d.CSS.title
t = t .. '</div>'
t = t .. '<div class="NavContent" align="'.. d.CSS.ta2 ..'" style="margin:'.. d.CSS.margin_all ..'; background-color:'.. d.CSS.bg1 ..'; display=block; " >'
t = t .. d.CSS.image
-- t = t .. d.CSS.content
t = t .. '</div>'
t = t .. '</div>'
t = t .. '</div>'
-- t = t .. "<p width="1004" > ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. ce texte doit etre tres long. </p>"
-- <img src="w3schools.jpg" alt="W3Schools.com" width="104"
--height="142">
-- t = "<style " .. viewers.CSS_change(CSS) ">" .. t .. "</style>" -- example of use to try COCO
viewers.restore_configs(memo, "drop_box.new") -- Restore global configurations after eventual changes.
end -- t = t .. drop_box.new(selector, title, content_or_func, ...) -- Formats a drop_box for a doc or a group of tests. Take apart onedrop options.
 
 
-------------------
---- CO
-------------------
 
 
-- cut_libraries
Ligne 2 063 ⟶ 2 626 :
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) -- Runs tests cases and 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() -- 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.form(evt, c) -- Format an event as an error, warning or category.
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, evt in pairs(events.list_all_events) do
evt = events.form(evt, c) -- Format an event as an error, warning or category.
table.insert(gener, evt ) -- Build a table with translations counts.
end
return gener
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 9 601 ⟶ 9 783 :
dh = drop_box.dh
 
function drop_box.html(title, content_or_func) -- Builds the drop box at the html level.
local memo = viewers.save_configs("drop_box.html") -- Save global configuration before eventual changes.
local t = "\n* drop_box.html() -- Builds the drop box at the html level."
local drop_box_html = drop_box_html_start .. drop_box_html_medium .. drop_box_html_end .. drop_box_look_like
t = t .. drop_box_html_start .. drop_box_html_content
viewers.restore_configs(memo, "drop_box.html") -- Restore global configurations after eventual changes.
return drop_box_html_start
end -- t = t .. drop_box.html(title, content) -- Builds the drop box at the html level.
 
function drop_box.new_title() -- Support desk title of the docDropbox of the edit box.
local t, strings_c, tables_c, strs_on_tabs, subnames = langs.i18n_sub_counts("langs.main_i18n", "langs_main_i18n_languages_count", "user")
local report_main_discreet = viewers.styles_color_discreet( viewers.form_main_version(main_versions) )
local title = viewers.form9user("versions_support_desk_title", report_main_discreet, strs_on_tabs, tables_c)
-- "Support desk for %1 : %2 translations in %3 languages"
return title
end -- function drop_box.new_title()
 
drop_box.css_options = { -- Conventional CSS parameters : See -- https://en.wikisource.org/wiki/Template:drop_box#Parameters
Ligne 9 722 ⟶ 9 888 :
return t
end -- function drop_box.form(title, content, dropit)
 
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.get_args_report.
-- From 20180503 a bug (in Module:Centralizer or MediaWiki) See CentralManual display twice : modes.get_args_report.xml
-- 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.
local t = ""
local args = {...}
local content_or_func_error = viewers.form9user("\n* Error : Abnormal content for drop_box.new(%1, %2).\n*", selector, title, content_or_func) -- , %3
if selector == "never" then return "" end
if not ( (selector == true) or (selector == title) or viewers.is_in_sp(selector, "allwaysview alltestsview enforcerun failinref nocontent") ) then return "" end
if (type(title) ~= "string") then title = "Default_title" end
local dropit = nil -- dropit to change the look of the drop_box
-- Style options in dropit{}: ta1, image, ta2, margin_bottom, width, border_radius, border_color, bg1)
for i, args_tab in ipairs(args) do -- Get the dropit options for the drop_box.
modes.recursiveLoop = (modes.recursiveLoop or 0) + 1
if modes.recursiveLoop > 33 then return "" end
-- The last argument can be a dropit to change the look of the drop_box
if (i == lua_table.level_count(args) ) and (type(args_tab) == "table") and (args_tab["dropit"] == "dropit") then
dropit = mw.clone( args_tab )
end
end
local dropit = dropit or {} -- for antiCrash
if type(title) ~= "string" then title = "viewers_dropdown_missing_title" end
dropit.selector = selector
dropit.title = title
dropit.args = { ... } -- optional arguments for the content_or_func function
local func_from_name = nil
dropit.content = content_or_func -- string or function
if type(content_or_func) == "string" then func_from_name = lua_table.from_subnames_object(content_or_func) end -- Get the last sub-table from its sub-names.
dropit.content_error = ""
dropit.title = dropit.title .. ( dropit.title_errors or "" )
dropit.resultKind = "ref"
local success, result = true, ""
dropit.result = result
dropit.success = success
if type(func_from_name) == "function" then -- In case of named function:
dropit.func_name = content_or_func -- memorise its name
-- dropit.content = func_from_name -- and use it as content form function
end
local res = drop_box.form(dropit.title, dropit.content, dropit)
if not dropit.success then
dropit.content_ref = "content_error<ref>" .. viewers.styles_color_error( dropit.content_error) .. "</ref>"
dropit.content = dropit.content_ref
end
local list, count, level, split = lua_table.level_list(package.loaded) -- subtasks S170813lll
viewers.restore_configs(memo, "drop_box.new") -- Restore global configurations after eventual changes.
-- res = t .. res
return res
end -- function drop_box.new(selector, title, content, ...)
 
 
Ligne 11 164 ⟶ 11 280 :
{ 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-1011-29T00:33:47", versid = "1.33.0-wmf.2 (1c41eef)", seen_time = "2018-11-02T0829T08:50:00", },
{ site = "fr.wikisource", verstime = "2018-1112-05T20:37:45", versid = "1.33.0-wmf.2 (b6abf62)", seen_time = "2018-1112-06T21:46:00", },
{ site = "fr.wikisource", verstime = "2018-1112-08T13:23:27", versid = "1.33.0-wmf.3 (d114665)", seen_time = "2018-1112-09T00:00:00", },
{ site = "fr.wikisource", verstime = "2018-1112-14T19:43:13", versid = "1.33.0-wmf.4 (967d9eb)", seen_time = "2018-1112-15T08:27:00", },
{ site = "fr.wikisource", verstime = "2018-1112-15T13:12:06", versid = "1.33.0-wmf.4 (b34307c)", seen_time = "2018-1112-17T07:35:00", },
{ site = "fr.wikisource", verstime = "2018-1112-19T20:59:49", versid = "1.33.0-wmf.4 (bf6a756)", seen_time = "2018-1112-21T06:04:00", },
{ site = "fr.wikisource", verstime = "2018-1112-27T11:28:27", versid = "1.33.0-wmf.4 (ebeab6e)", seen_time = "2018-1112-28T07:47:00", },
{ site = "fr.wikisource", verstime = "2018-1112-28T13:29:48", versid = "1.33.0-wmf.6 (19f2ad7)", seen_time = "2018-1112-29T08:35:00", },
{ site = "fr.wikisource", verstime = "2018-1112-29T14:08:43", versid = "1.33.0-wmf.6 (e5db35f)", seen_time = "2018-1112-29T21:51:00", },
{ site = "fr.wikisource", verstime = "2018-1112-29T20:09:40", versid = "1.33.0-wmf.6 (e7d6fb2)", seen_time = "2018-1112-29T23:33:00", },
{ site = "fr.wikisource", verstime = "20182019-1201-13T01:34:02", versid = "1.33.0-wmf.8 (2859494)", seen_time = "20182019-1201-17T08:33:00", },
{ site = "www.MediaWiki", verstime = "20182019-1201-18T14:22:32", versid = "1.33.0-wmf.9 (b5ca53a)", seen_time = "20182019-1201-18T18:00:00", },
{ site = "fr.wikisource", verstime = "20182019-1201-19T17:52:30", versid = "1.33.0-wmf.9 (7cf3023)", seen_time = "20182019-1201-20T09:07:00", },
{ site = "fr.wikisource", verstime = "20182019-1201-20T17:20:46", versid = "1.33.0-wmf.9 (02196d2)", seen_time = "20182019-1201-20T21:04:00", },
{ site = "fr.wikisource", verstime = "2019-01-21T07∶35∶30", versid = "1.33.0-wmf.18 (6deca5e)", seen_time = "2019-01-21T20∶35∶30", },
} -- MWMW
{ site = "fr.wikisource", verstime = "2019-02-25T20:29:29", versid = "1.33.0-wmf.18 (3456bc6)", seen_time = "2019-02-26T07:40:00", },
versions.MediaWiki_version_memo = "1.33.0-wmf.9 (02196d2)"
{ site = "www.MediaWiki", verstime = "2019-02-26T15:56:32", versid = "1.33.0-wmf.19 (c76e64a)", seen_time = "2019-02-26T07:40:00", },
{ site = "fr.wikisource", verstime = "2019-02-28T15:24:15", versid = "1.33.0-wmf.19 (e53935b)", seen_time = "2019-03-02T09:28:00", },
{ site = "www.MediaWiki", verstime = "2019-03-05T14:50:49", versid = "1.33.0-wmf.20 (e66958a)", seen_time = "2019-03-06T07:40:00", },
} -- MWMW
versions.MediaWiki_version_memo = "1.33.0-wmf.20 (e66958a)"
versions.MediaWiki_Versions_sort = "<" -- First on end, Last on begin
versions.MediaWiki_Versions_sort = ">" -- First on begin, Last on end
Ligne 11 239 ⟶ 11 360 :
-- 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
-- Auteur:Utilisateur.Rical/Auteur:VictorHugo -- Tester Module:Centalizer pour l'auteur Victor Hugo
--