Use `pcall` to invoke `getInvokeCallList` from `p._main` to avoid breaking {{Documentation}} when the template page doesn’t yet exist
starcitizen>Alistair3149 Немає опису редагування |
starcitizen>Alistair3149 (Use `pcall` to invoke `getInvokeCallList` from `p._main` to avoid breaking {{Documentation}} when the template page doesn’t yet exist) |
||
| Рядок 6: | Рядок 6: | ||
local param = require( 'Module:Paramtest' ) | local param = require( 'Module:Paramtest' ) | ||
local dpl = require( 'Module:DPLlua' ) | local dpl = require( 'Module:DPLlua' ) | ||
local userError = require("Module:User error") | |||
local mHatnote = require('Module:Hatnote') | local mHatnote = require('Module:Hatnote') | ||
local mHatlist = require('Module:Hatnote list') | local mHatlist = require('Module:Hatnote list') | ||
| Рядок 627: | Рядок 628: | ||
if currentPageName:find( '^Template:' ) then | if currentPageName:find( '^Template:' ) then | ||
local invokeList = getInvokeCallList | local ok, invokeList = pcall(getInvokeCallList, currentPageName) | ||
if ok then | |||
return formatInvokeCallList( currentPageName, addCategories, invokeList ) .. formatTemplateStylesList( currentPageName, addCategories, templateStylesList ) | |||
else | |||
return userError(invokeList) | |||
end | |||
end | end | ||