Modul:Category handler: Unterschied zwischen den Versionen
allow invocations specifying the page parameter to use the mw.loadData optimisations, and don't call mw.title.new every time
(apply changes from sandbox as requested by User:Jackmcbarn which removes middleclass dependency) |
(allow invocations specifying the page parameter to use the mw.loadData optimisations, and don't call mw.title.new every time) |
||
| Zeile 55: | Zeile 55: | ||
do | do | ||
local pagename = obj:parameter('demopage') | local pagename = obj:parameter('demopage') | ||
local success, titleObj = pcall(mw.title.new, pagename) | local success, titleObj | ||
if pagename then | |||
success, titleObj = pcall(mw.title.new, pagename) | |||
end | |||
if success and titleObj then | if success and titleObj then | ||
obj.title = titleObj | obj.title = titleObj | ||
if titleObj == mw.title.getCurrentTitle() then | |||
obj._usesCurrentTitle = true | |||
end | |||
else | else | ||
obj.title = mw.title.getCurrentTitle() | obj.title = mw.title.getCurrentTitle() | ||