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

Contenu supprimé Contenu ajouté
ModuleCentralizer debug datas = mw.clone(datas)
ModuleCentralizer function modes.levenshtein_similar_tests OK
Ligne 1 :
local Centralp = {} -- The main central module install central libraries and bind the main and its sub-modules
local pCentral = Centralp -- Save as ModuleCentralizer.lua ModuleCentralizer debugfunction datasmodes.levenshtein_similar_tests = mw.clone(datas)ok.lua
-- res = res .. drop_box.new(selector, "modes_recursive_normal_tests_title", modes.recursive_normal_tests, function tab_view.form_one_case) -- only errors
-- res = res .. drop_box.new(selector, "modes_namespaces_page_list_title", tab_view.form_one_case)
-- { "20181014", "20181014", "NOW", "Rical", "S181014uft", "update function tab_view.form_one_case + translate from recursive_normal_test1(...", },
-- See the documentation in: MediaWiki:Scribunto/Central_modules_reference_manual
-- ModuleCentralizer only tests sections titles when renew drop_box.lua From 2018-07-19
p.version = { -- Modules dependencies. Dependencias del módulo. Dépendances du module.
versionName = "Central-s-fr", versionNumber = "1.0.0(1810112T10181014T22:250T20:2618)", versionDate = "2018-10-12T1014T22:2518:00", --MWMW NOWNOW
-- UTC version structure : main.fonction.task(yymmddThh:mm)
mainDescription = "Begin to use", functionDescription = "first functional support", taskDescription = "enough advanced to use in CentralSchool OK",
Ligne 940 ⟶ 943 :
-- DUPLICATE NOWNOW, in change. toDoc
{ "---", "---", "---", "---", "---", "DUPLICATE NOW, in change", },
{ "2018102020181101", "2018102120181101", "NOW", "Rical", "S181015tglS181101tgl", "Begin: translate by groups of languages : like for viet, laos, cambodgia, allways with en, es, fr 1 days", },
{ "2018101820181101", "2018102020181101", "NOW", "Rical", "S181015aipS181101aip", "Begin: when 10 used cases, announce that in the phabtask, then when 20, then for xmas 1 days", },
{ "2018101120181023", "2018101820181030", "NOW", "Rical", "S181015s7PS181023s7P", "Begin: search 7 Projects : MediaWikis wikidata wikipedia wikisource wikiquote ? 3 days", },
{ "2018101120181023", "2018101820181030", "NOW", "Rical", "S181015iLCS181023iLC", "Begin: Rical invite 7 Lua-coders : Tpt, Zolo, Od1n, Julien1978, Daehan, VIGNERON ? 3 days", },
{ "2018100920181020", "2018101120181022", "NOW", "Rical", "S181005umfS181020umf", "update MediaWiki:Scribunto/Central manual for ;activity.phabricator_tasks_report;activity.rough_date_days;...", },
{ "2018100620181018", "2018100920181020", "NOW", "Rical", "S181002CrCS181018CrC", "Module:CentralSchool: finish reciprocal adaptation with Module:Centralizer", },
{ "2018100520181016", "2018100620181017", "NOW", "Rical", "S181002uftS181016vap", "updaterestore function tab_viewversions.form_one_caseanti_crash(frame) +if translatenot from multiple_selection_test1pcall() recursive in versions...tree_branch='v1;v2;v3' ", },
{ "2018100520181015", "2018100620181016", "NOW", "Rical", "S181002uftS181015odd", "updateone_arg functionhas tab_view.form_one_casea +arg_default translatein fromp.known_args and a recursive_normal_test1(...delete = 'delete' ", },
{ "2018100520181015", "2018100520181016", "NOW", "Rical", "S181002uptS181015odd", "updateone_data activityhas a data_default in datas.phabricator_tasks_reportknown_datas and a .delete = 'delete' ", },
{ "2018100520181015", "2018100520181016", "NOW", "Rical", "S181002ustS181015odd", "Module:Centralizerone_mode updatehas subtasksa mode_default in modes.known_modes and a .delete = 'delete' list", },
{ "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_version has a version_default in versions.version_args and a .delete = 'delete' ", },
-- function versioning.antiCrash(options, content_or_func, ...) -- Form the display of a running error. in ModuleCentral 20170902.ModuleCentral 2e no antiCrash ok.lua
{ "20181014", "20181014", "NOW", "Rical", "S181014uft", "update function tab_view.form_one_case + translate from multiple_selection_test1(...", },
{ "20181014", "20181014", "NOW", "Rical", "S181014uft", "update function tab_view.form_one_case + translate from recursive_normal_test1(...", },
{ "20181014", "20181014", "NOW", "Rical", "S181014upt", "update activity.phabricator_tasks_report", },
{ "20181014", "20181014", "NOW", "Rical", "S181014ust", "Module:Centralizer update subtasks list", },
--
-- Automatic shift of below "todo" subtasks.
Ligne 1 013 ⟶ 1 022 :
-- NOWNOW DP, NOW, in change
{ "---", "---", "---", "---", "---", "NOW, in change", },
{ "2018102020181101", "2018102120181101", "NOW", "Rical", "S181015tglS181101tgl", "Begin: translate by groups of languages : like for viet, laos, cambodgia, allways with en, es, fr 1 days", },
{ "2018101820181101", "2018102020181101", "NOW", "Rical", "S181015aipS181101aip", "Begin: when 10 used cases, announce that in the phabtask, then when 20, then for xmas 1 days", },
{ "2018101120181023", "2018101820181030", "NOW", "Rical", "S181015s7PS181023s7P", "Begin: search 7 Projects : MediaWikis wikidata wikipedia wikisource wikiquote ? 3 days", },
{ "2018101120181023", "2018101820181030", "NOW", "Rical", "S181015iLCS181023iLC", "Begin: Rical invite 7 Lua-coders : Tpt, Zolo, Od1n, Julien1978, Daehan, VIGNERON ? 3 days", },
{ "2018100920181020", "2018101120181022", "NOW", "Rical", "S181005umfS181020umf", "update MediaWiki:Scribunto/Central manual for ;activity.phabricator_tasks_report;activity.rough_date_days;...", },
{ "2018100620181018", "2018100920181020", "NOW", "Rical", "S181002CrCS181018CrC", "Module:CentralSchool: finish reciprocal adaptation with Module:Centralizer", },
{ "2018100520181016", "2018100620181017", "NOW", "Rical", "S181002uftS181016vap", "updaterestore function tab_viewversions.form_one_caseanti_crash(frame) +if translatenot from multiple_selection_test1pcall() recursive in versions...tree_branch='v1;v2;v3' ", },
{ "2018100520181015", "2018100620181016", "NOW", "Rical", "S181002uftS181015odd", "updateone_arg functionhas tab_view.form_one_casea +arg_default translatein fromp.known_args and a recursive_normal_test1(...delete = 'delete' ", },
{ "2018100520181015", "2018100520181016", "NOW", "Rical", "S181002uptS181015odd", "updateone_data activityhas a data_default in datas.phabricator_tasks_reportknown_datas and a .delete = 'delete' ", },
{ "2018100520181015", "2018100520181016", "NOW", "Rical", "S181002ustS181015odd", "Module:Centralizerone_mode updatehas subtasksa mode_default in modes.known_modes and a .delete = 'delete' list", },
{ "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_version has a version_default in versions.version_args and a .delete = 'delete' ", },
-- function versioning.antiCrash(options, content_or_func, ...) -- Form the display of a running error. in ModuleCentral 20170902.ModuleCentral 2e no antiCrash ok.lua
{ "20181014", "20181014", "NOW", "Rical", "S181014uft", "update function tab_view.form_one_case + translate from multiple_selection_test1(...", },
{ "20181014", "20181014", "NOW", "Rical", "S181014uft", "update function tab_view.form_one_case + translate from recursive_normal_test1(...", },
{ "20181014", "20181014", "NOW", "Rical", "S181014upt", "update activity.phabricator_tasks_report", },
{ "20181014", "20181014", "NOW", "Rical", "S181014ust", "Module:Centralizer update subtasks list", },
-- Already done
{ "---", "~sort~", "---", "---", "---", "Already done", },
Ligne 5 892 ⟶ 5 907 :
end -- function modes.levenshtein(word1, word2)
 
function modes.levenshtein_test_1levenshtein_similar_tests(search,t) word,-- Tests of max)
-- search = mot cherché dans la liste
-- word = un des mot de la liste
if (type(search) ~= "string") then search = "" end
local diffmaxi = modes.similar_args_diffmaxi( string.len(search) )
local len1, len2, lev, tlev, diff
local t = ""
-- t = t .. "<br>- diff: " .. viewers.ta("mot1", mot1) .. viewers.ta("mot2", mot2) .. viewers.ta("diff", diff)
t = "<br>levenshtein : "
if (not search ) or (not word) then
diff = 99
t = t .. viewers.ta("diff", diff) .. " no word. "
elseif search == word then
diff = 0
t = t .. viewers.ta("diff", diff) .. " , " .. search .. " = " .. word .. " "
else
lev, tlev = modes.levenshtein(search, word)
if (lev <= diffmaxi) then
t = t .. viewers.ta("diffmaxi", diffmaxi) .. " >= " .. viewers.ta("lev", lev) .. " <b>" .. search .. " ==> " .. word .. "</b> "
else
t = t .. viewers.ta("diffmaxi", diffmaxi) .. " >= " .. viewers.ta("lev", lev) .. " " .. search .. " / " .. word .. " "
end
diff = lev
end
return diff, t, search, word
end -- function modes.levenshtein_test_1(search, word, max)
 
function modes.levenshtein_similar_tests(t)
local memo = viewers.save_configs("modes.levenshtein_similar_tests") -- Save global configuration before eventual changes.
local t = t or ("\n* " .. viewers.form9user("modes_max_nearest_argument_msg") ) -- "A longer name argument accepts more letter errors."
t = t .. "\n* " .. "Formula to compute the near words limit: Formule de calcul de limite des mots proches : "
local errors, key, argsyn, arglingual, txt = ""
local diffmaxi, tt = modes.similar_args_diffmaxi(10, t .. "diffmaxi = ")
t = t .. "\n* List of diffmaxi / lengths : "
local diffmaxi
for length = 1, 16 do -- For all lengths
for i = 1, 10 do
diffmaxi = modes.similar_args_diffmaxi(length)
diffmaxi, tt = modes.similar_args_diffmaxi( string.sub("azertyuiopqsdfghjklm", 1, i), "azertyuiopqsdfghjklm") -- Format a string from the formula
t = t .. ", " .. tostring(diffmaxi) .. " / " .. tostring(length) .. " "
modes.length_from_i[i] = diffmaxi
t = t .. viewers.ta(tostring(i), diffmaxi)
end
local diffmaxi, tt = modes.similar_args_diffmaxi(10, t .. "diffmaxi = ")
local errors = ""
local group_test = { -- events.test_group
local n, tt = modes.levenshtein_test_1( "nom", "nom")
{ try = "nom", correct = "nom", },
t = t .. tostring(tt)
local { n, tttry = modes.levenshtein_test_1( "nom", correct = "Nom"), },
{ try = "top", correct = "pot", },
t = t .. tostring(tt)
{ try = "ami", correct = "amis", },
local n, tt = modes.levenshtein_test_1( "top", "pot")
{ try = "nom", correct = "name", },
t = t .. tostring(tt)
{ try = "m", correct = "mu", },
local n, tt = modes.levenshtein_test_1( "ami", "amis")
{ try = "m", correct = "mur", },
t = t .. tostring(tt)
{ try = "mur", correct = "m", },
local n, tt = modes.levenshtein_test_1( "nom", "name")
{ try = "c", correct = "c", },
t = t .. tostring(tt)
{ try = "c", correct = "long", },
local n, tt = modes.levenshtein_test_1( "m", "mu")
{ try = "xxx", correct = " ", },
t = t .. tostring(tt)
{ try = "", correct = "xyz", },
local n, tt = modes.levenshtein_test_1( "m", "mur")
{ try = "xxx", correct = "xyz", },
t = t .. tostring(tt)
{ try = "prénom", correct = "Prenom", },
local n, tt = modes.levenshtein_test_1( "mur", "m")
{ try = "catégorie", correct = "Category", },
t = t .. tostring(tt)
{ try = "description", correct = "Description", },
local n, tt = modes.levenshtein_test_1( "c", "C")
{ try = "anneeDeces", correct = "anneeNaissance", },
t = t .. tostring(tt)
{ try = "avant-après", correct = "après-avant", },
local n, tt = modes.levenshtein_test_1( "c", "cf")
}
t = t .. tostring(tt)
local tab_view = { -- Group datas and options for a table view with lines and columns.
local n, tt = modes.levenshtein_test_1( "c", "long")
test_group = group_test,
t = t .. tostring(tt)
title_memo = "modes.recursive_normal() Test: Normalize the recursive level and the recursive limit",
local n, tt = modes.levenshtein_test_1( "xxx", "")
headers = "try; try_length; correct; correct_length; error", -- Test Normalize recursiveLevel and recursive_limit
t = t .. tostring(tt)
headers_class = "wikitable alternative center sortable",
local n, tt = modes.levenshtein_test_1( "", "xyz")
modes_nearest_argument_err = "Error: Do you need the known argument <b>%1</b> ?",
t = t .. tostring(tt)
modes_max_nearest_argument_msg = "A longer name argument accepts more letter errors.",
local n, tt = modes.levenshtein_test_1( "xxx", "xyz")
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
t = t .. tostring(tt)
case.try_length = string.len(case.try)
local n, tt = modes.levenshtein_test_1( "prénom", "Prenom")
case.correct_length = string.len(case.correct)
t = t .. tostring(tt)
case.diffmaxi = modes.similar_args_diffmaxi( string.len(case.try) )
local n, tt = modes.levenshtein_test_1( "catégorie", "Category")
case.diff = modes.similar_args_diffmaxi(case.correct)
t = t .. tostring(tt)
if case.diff > case.diffmaxi then case.errors = viewers.usual_color(case.correct, "error") end
local n, tt = modes.levenshtein_test_1( "description", "Description")
return { case.try, case.try_length, case.correct, case.correct_length, case.errors }
t = t .. tostring(tt)
end,
local n, tt = modes.levenshtein_test_1( "anneeDeces", "anneeNaissance")
rowGroup = {},
t = t .. tostring(tt)
-- track_on == "details",
local n, tt = modes.levenshtein_test_1( "anoNacimiento", "anneeNaissance")
}
t = t .. tostring(tt)
t = t .. "<br/>" .. tableview.new(tab_view) -- Form a table view with lines and columns.
local n, tt = modes.levenshtein_test_1( "avant-après", "après-avant")
t = t .. "\n* <b>levenshtein_test</b> errors = " .. viewers.styles_color_error(errors)
t = t .. tostring(tt)
if errors ~= "" then t = t .. "\n* <b>levenshtein_test</b> errors = " .. viewers.styles_color_error(errors) end
viewers.restore_configs(memo, "modes.levenshtein_similar_tests") -- Restore global configurations after eventual changes.
return t
Ligne 5 986 ⟶ 5 974 :
-- Número máximo de letras diferentes entre 2 nombres de argumento
-- Nombre maximum de lettres différentes entre deux noms d'arguments
modes.length_from_i = {} -- Format a string from the formula
function modes.similar_args_diffmaxi(length, t) -- diffmaxi from length of argmt arglingual name
function modes.similar_args_diffmaxi(word, t) -- Format a string from the formula
local coef = modes.constants.near_word_search_diff_coef or 0.30
local constant = modes.constants.near_word_search_diff_const or 0.82
local word = tostring(word)
local length = string.len(word)
local diffmaxi = math.floor( coef * length + constant )
if type(t) == "string" then t = t .. tostring(coef) .. " * length + " .. tostring(constant) else t = "" end
return diffmaxi, t
end -- local diffmaxi, t = function modes.similar_args_diffmaxi(lengthword, t) -- Format a string from the formula
 
-- For an unknown argument, seeks the name of the closest among the known arguments translated
Ligne 6 127 ⟶ 6 118 :
local memo = viewers.save_configs("modes.multiple_selection_tests") -- Save global configuration before eventual changes.
local t = (t or "") .. "\n* <b>multiple_selection</b> options: " .. viewers.ta("=", "equal only") .. viewers.ta("t", "not trim before and after") .. viewers.ta("U", "not lowercase and uppercase")
--[[
local function multiple_selection_test1(t, opt, selector, to_select)
local selected_txt, selected_tab, txt = modes.multiple_selection(opt, selector, to_select)
Ligne 6 132 ⟶ 6 124 :
return t, opt, selector, to_select -- , selected_txt, selected_tab
end
--]]
local opt = "; "
t = t .. "\n: selector = <b>nobel,+1,président,3,député,prix</b> signifie : sélectionner le premier, puis 1 de plus parmi les suivants, puis 3 en tout au maximum."
local head = mw.text.split( viewers.form9user("modes_multiple_selection_test_headers") , ';')
t = t .. viewers.table_head() .. viewers.table_col(head[1]) .. viewers.table_col(head[2]) .. viewers.table_col(head[3]) .. viewers.table_col(head[4])
-- recursiveLevel, recursive_limit, recursiveLevel_err == modes.recursive_normal(recursiveLevel, recursive_limit) -- typical use tab_view
-- Todo ? P39 = fonction = "président de Pologne, député à l'Assemblée, Prix Nehru, Nobel de la paix"
local t = t or "\n* modes.recursive_normal_tests: "
-- modes_multiple_selection_test_select = "2, nobel, president, deputy, price",
local tab_view = { -- Group datas and options for a table view with lines and columns.
t = t .. multiple_selection_test1( t, opt, "2; nobel; président; député; prix", "président de Pologne; député à l'Assemblée; Prix Nehru; Nobel de la paix" )
test_group = {
t = t .. multiple_selection_test1( t, opt, ";U", "2; nobel, président; député; prix", "président de Pologne; député à l'Assemblée; Prix Nehru; Nobel de la paix" )
{ recursiveLevel_in = nil, recursive_limit_in = nil, },
t = t .. multiple_selection_test1( t, opt, "3; député; prix; nobel; président", "président de Pologne; député à l'Assemblée; Prix Nehru, Nobel de la paix" )
{ recursiveLevel_in = -12, recursive_limit_in = 5, },
t = t .. multiple_selection_test1( t, opt, ";=", "3; député; prix; nobel; président", "président de Pologne; député; Prix Nehru; Nobel" )
{ recursiveLevel_in = 1, recursive_limit_in = 5, },
t = t .. multiple_selection_test1( t, opt, ";t", "3; député; prix; nobel; président", "président de Pologne; député; Prix Nehru; Nobel" )
{ recursiveLevel_in = 1, recursive_limit_in = 0, },
t = t .. multiple_selection_test1( t, opt, ";", "3; prix; nobel;+1; président; député", "président de Pologne; député à l'Assemblée; Prix Nehru; Nobel de la paix" )
{ recursiveLevel_in = 2.718, recursive_limit_in = 3.1416, },
t = t .. multiple_selection_test1( t, opt, ";", "3; président; nobel; député; prix", "président de Pologne; député à l'Assemblée; Prix Nehru; Nobel de la paix" )
{ recursiveLevel_in = 3, recursive_limit_in = nil, },
t = t .. multiple_selection_test1( t, opt, ";t", "3; député; prix; nobel; président", "président de Pologne; député; Prix Nehru; Nobel" )
{ recursiveLevel_in = 5, recursive_limit_in = 5, },
t = t .. multiple_selection_test1( t, opt, ";U", "2; nobel; président; député; prix", "président de Pologne; député à l'Assemblée; Prix Nehru; Nobel de la paix" )
{ recursiveLevel_in = 6, recursive_limit_in = 5, },
t = t .. viewers.table_end()
{ recursiveLevel_in = 11111, recursive_limit_in = 5, "versions_module_miss_i18n_count_err" },
viewers.restore_configs(memo, "modes.multiple_selection_tests") -- Restore global configurations after eventual changes.
},
title_memo = "viewers_save_restore_balance_title",
headers = "viewers_save_restore_balance_headers", -- viewers_tableView_default_headers
headers = "select; First alternative; Second alternative; errors",
headers_class = "wikitable alternative center sortable",
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
-- local function recursive_normal_test1(case.recursiveLevel_in, case.recursive_limit_in, case.modes_recursiveLevel_err)
case.recursiveLevel, case.recursive_limit, case.recursiveLevel_err =
modes.recursive_normal( case.recursiveLevel_in or modes.recursive_limit or 1, recursive_limit_in or modes.recursive_limit or 3 )
local t = "\n* " .. viewers.ta("Level_in", case.recursiveLevel_in) .. viewers.ta("Limit_in", recursive_limit_in)
t = t .. viewers.ta("recursiveLevel", recursiveLevel) .. viewers.ta("recursive_limit", recursive_limit) .. viewers.ta("recursiveLevel_err", recursiveLevel_err)
return { case.recursiveLevel_in, case.recursive_limit_in, case.recursiveLevel, case.recursive_limit, case.modes_recursiveLevel_err }
end,
-- headers = "Level_in; Limit_in; recursiveLevel; recursive_limit; recursiveLevel_err", -- viewers_tableView_default_headers
rowGroup = {},
-- track_on == "details",
}
t = t .. "<br/> after convert in form_one_case = function(case)"
t = t .. "<br/>" .. tableview.new(tab_view) -- Form a table view with lines and columns.
viewers.restore_configs(memo, "modes.recursive_normal_tests") -- Restore global configurations after eventual changes.
return t
end -- function modes.multiple_selection_tests(t)
Ligne 6 939 ⟶ 6 952 :
function modes.recursive_normal_tests( t ) -- Test Normalize recursiveLevel and recursive_limit
local memo = viewers.save_configs("modes.recursive_normal_tests") -- Save global configuration before eventual changes.
-- recursiveLevel, recursive_limit, recursiveLevel_err == modes.recursive_normal(recursiveLevel, recursive_limit) -- typical use tab_view
local t = t or "\n* modes.recursive_normal_tests: "
local tab_view = { -- Group datas and options for a table view with lines and columns.
local function recursive_normal_test1(recursiveLevel_in, recursive_limit_in, modes_recursiveLevel_err)
test_group = {
local recursiveLevel, recursive_limit, recursiveLevel_err =
modes.recursive_normal( { recursiveLevel_in or= modes.recursive_limit or 1nil, recursive_limit_in or= modes.recursive_limitnil, or 3 )},
{ recursiveLevel_in = -12, recursive_limit_in = 5, },
local t = "\n* " .. viewers.ta("Level_in", recursiveLevel_in) .. viewers.ta("Limit_in", recursive_limit_in)
{ recursiveLevel_in = 1, recursive_limit_in = 5, },
t = t .. viewers.ta("recursiveLevel", recursiveLevel) .. viewers.ta("recursive_limit", recursive_limit) .. viewers.ta("recursiveLevel_err", recursiveLevel_err)
{ recursiveLevel_in = 1, recursive_limit_in = 0, },
return t
{ recursiveLevel_in = 2.718, recursive_limit_in = 3.1416, },
end
{ recursiveLevel_in = 3, recursive_limit_in = nil, },
t = t .. recursive_normal_test1()
{ recursiveLevel_in = 5, recursive_limit_in = 5, },
t = t .. recursive_normal_test1(-12, 5)
{ recursiveLevel_in = 6, recursive_limit_in = 5, },
t = t .. recursive_normal_test1(0, 5)
{ recursiveLevel_in = 11111, recursive_limit_in = 5, "versions_module_miss_i18n_count_err" },
t = t .. recursive_normal_test1(1, 5)
},
t = t .. recursive_normal_test1(2.718, 3.1416)
title_memo = "modes.recursive_normal() Test: Normalize the recursive level and the recursive limit",
t = t .. recursive_normal_test1(3)
headers = "Level_in; Limit_in; recursiveLevel; recursive_limit; recursiveLevel_err", -- Test Normalize recursiveLevel and recursive_limit
t = t .. recursive_normal_test1(5, 5)
headers_class = "wikitable alternative center sortable",
t = t .. recursive_normal_test1(6, 5)
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
t = t .. recursive_normal_test1(11111, 5, "versions_module_miss_i18n_txt_err")
case.recursiveLevel, case.recursive_limit, case.recursiveLevel_err =
t = t .. recursive_normal_test1(11112, 5, "versions_module_miss_i18n_count_err")
modes.recursive_normal( case.recursiveLevel_in or modes.recursive_limit or 1, case.recursive_limit_in or modes.recursive_limit or 3 )
t = t .. recursive_normal_test1(23456, 5, "modes_recursiveLevel_err")
return { case.recursiveLevel_in, case.recursive_limit_in, case.recursiveLevel, case.recursive_limit, case.modes_recursiveLevel_err }
-- headers = "Level_in; Limit_in; recursiveLevel; recursive_limit; recursiveLevel_err", -- viewers_tableView_default_headers
end,
rowGroup = {},
-- track_on == "details",
}
t = t .. "<br/> after convert in form_one_case = function(case)"
t = t .. "<br/>" .. tableview.new(tab_view) -- Form a table view with lines and columns.
viewers.restore_configs(memo, "modes.recursive_normal_tests") -- Restore global configurations after eventual changes.
return t
Ligne 9 537 ⟶ 9 558 :
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_test_1simpleList_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))
Ligne 9 544 ⟶ 9 565 :
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_test_1simpleList_test1(t, "abc;def;abc", ";", "-", "|")
t = simpleList_test_1simpleList_test1(t, "xyz;def;abc", ";", "sort")
t = simpleList_test_1simpleList_test1(t, "abc-def=abc", "-", "=")
t = simpleList_test_1simpleList_test1(t, "abc - def = abc", "-", "=", "sort")
t = simpleList_test_1simpleList_test1(t, "abc - def = abc", "-", "=", "sort", "trim")
t = simpleList_test_1simpleList_test1(t, ";;", ";", ";", ",")
t = simpleList_test_1simpleList_test1(t, "abc/def;abc", ";", "/")
t = simpleList_test_1simpleList_test1(t, "abc;def/abc/def;abc;def;abc", ";", "/", "-")
t = simpleList_test_1simpleList_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.
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
 
function viewers.day_to_stamp(jj, mm, aaaa)
Ligne 9 575 ⟶ 9 607 :
function viewers.parts_of_date_tests(t)
local memo = viewers.save_configs("viewers.parts_of_date_tests") -- Save global configuration before eventual changes.
local function date_to_part_test_1date_to_part_test1(t, nom, date, part)
local t = t .. viewers.table_row() .. viewers.table_dat(nom) .. viewers.table_dat(date) .. viewers.table_dat(part) .. viewers.table_dat(tostring(viewers.date_to_part(date, part)))
return t
Ligne 9 582 ⟶ 9 614 :
t = t .. "\n* Verify each value of part of date:"
t = t .. viewers.table_head() .. viewers.table_col("Example") .. viewers.table_col("date") .. viewers.table_col("part") .. viewers.table_col("value")
t = date_to_part_test_1date_to_part_test1(t, "Socrate birth", "470 BCE", "era")
t = date_to_part_test_1date_to_part_test1(t, "Tite-Live birth", "59 BCE", "yyyy")
t = date_to_part_test_1date_to_part_test1(t, "Tite-Live death", "17", "yyyy")
t = date_to_part_test_1date_to_part_test1(t, "empty", "", "yyyy")
t = date_to_part_test_1date_to_part_test1(t, "Revolution", "14 July 1789", "mmmm")
t = date_to_part_test_1date_to_part_test1(t, "Walk on Moon", "20 July 1969", " ")
t = date_to_part_test_1date_to_part_test1(t, "English date", "July 20 1969", "yyyy")
t = date_to_part_test_1date_to_part_test1(t, "English date", "July 20 1969", "mmmm")
t = date_to_part_test_1date_to_part_test1(t, "Nelson Mandela birth", "July 1918", "yyyy")
t = date_to_part_test_1date_to_part_test1(t, "Nelson Mandela death", "5 Decembre 2013", "dd")
t = t .. viewers.table_end()
-- see https://fr.wikipedia.org/wiki/Discussion:ISO_8601#Av._J.C._:_contradiction_avec_l.27article_anglais
Ligne 10 302 ⟶ 10 334 :
res = res .. drop_box.new(selector, "modes_levenshtein_similar_tests_title", modes.levenshtein_similar_tests)
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
res = res .. drop_box.new(selector, "modes_namespaces_page_list_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