Module:MWgetCurrentFrame

Une page de Wikiversité, la communauté pédagogique libre.

La documentation pour ce module peut être créée à Module:MWgetCurrentFrame/Documentation

--- Save as MdCurrentFrame.lua MdCurrentFrame replace mw.getCurrentFrame() by direct URL 20190213 0046.lua
---  --------da:te-Objet------|File-------Titre--------------- typical length --------------|----------max| DODO
-----------da:te-Objet---------------------|File-------Titre--------------- typical length --------------|----------max| DODO
-- Modèle:Tests mw.getCurrentFrame() permit to test this module
local p = require("Module:Centralizer") -- to test if call mw.getCurrentFrame() results in a nil value

p.activate = "on" -- "Abnormal test case description **"
p.activate = nil -- "Normal test case description **"

function p.current_frame(option)
	local t = ""
	if p.activate then
		t = t .. mw.getCurrentFrame() -- explain what happens in Normal test case
		t = t .. "\n* Normal and Abnormal test cases:" -- results in OK value
		t = t .. "\n* All lua coders can read the usual errors from the compilator." -- results in OK value
		t = t .. "\n* In Abnormal cases there is nothing to see because mw.getCurrentFrame() is nil." -- results in OK value
	else  -- explain what happens in Abnormal test case
		t = t .. "\n* In Abnormal test is not visible in Abnormal case" -- results in a nil value
	end
	return t
end -- function p.current_frame(option)
--	Ludwik Lejzer Zamenhof (Q11758), Galilée (Q307), Victor Hugo (Q535), Aristote (Q868), Albert Einstein (Q937), Mohandas Karamchand Gandhi (Q1001),
--	Christophe Colomb (Q7322), Nelson Mandela (Q8023), Rudyard Kipling (Q34743), Martin Fleischmann (Q899264), Emmanuel Macron (Q3052772),
function p.current_frame(option)
	local t = ""
	if p.activate then
		t = t .. mw.getCurrentFrame() -- explain what happens in Normal test case
		t = t .. "\n* Normal and Abnormal test cases:" -- results in OK value
		t = t .. "\n* All lua coders can read the usual errors from the compilator." -- results in OK value
		t = t .. "\n* In Abnormal cases there is nothing to see because mw.getCurrentFrame() is nil." -- results in OK value
	else  -- explain what happens in Abnormal test case
		t = t .. "\n* In Abnormal test is not visible in Abnormal case" -- results in a nil value
		t = t .. "\n* URL = [https://www.wikidata.org/wiki/Q11758 Ludwik Lejzer Zamenhof]" -- results in OK value
		t = t .. "\n* c: ;;; [https://www.wikidata.org/wiki/Q11758 Ludwik Lejzer Zamenhof]" -- results in OK value
	end -- https://www.wikidata.org/wiki/Q11758
	return t
end -- function p.current_frame(option)

function p.current_frame_tests(option)
	local t = ""
	p.activate = "on" -- To 
	p.activate = nil
	local t = t or "\n* <b>versions.record_mw_changes()</b> : Detect, record and report all date-time changes of MediaWiki, in each wiki."
--	t = t .. drop_box.new("enforce", "Normal test case description **", p.current_frame, nil ) -- OK, show in table ?
--	t = t .. drop_box.new("enforce", "Abnormal test case **",  p.current_frame, "on" ) -- OK, show in table ?
	return t
end -- function Central.tests(frame)

return p
-- Module:MdCurrentFrame.lua/Documentation is the tests page 20190210 2229.lua