317
редагувань
starcitizen>Alistair3149 (Use mbox module) |
м (56 ревізій: Template:Infobox_Species from StarCitizenTools) |
||
| (Не показані 8 проміжних версій 2 користувачів) | |||
| Рядок 105: | Рядок 105: | ||
local function getDynamicRequireList( query ) | local function getDynamicRequireList( query ) | ||
local isDynamic = true; | local isDynamic = true; | ||
if query:find( '%.%.' ) then | if query:find( '%.%.' ) then | ||
query = mw.text.split( query, '..', true ) | query = mw.text.split( query, '..', true ) | ||
| Рядок 112: | Рядок 113: | ||
else | else | ||
local _; _, query = query:match( '(["\'])(.-)%1' ) | local _; _, query = query:match( '(["\'])(.-)%1' ) | ||
if query == nil then | |||
return {}, isDynamic | |||
end | |||
local replacements; | local replacements; | ||
query, replacements = query:gsub( '%%%a', '%%' ) | query, replacements = query:gsub( '%%%a', '%%' ) | ||
| Рядок 318: | Рядок 324: | ||
return invokeList | return invokeList | ||
end | end | ||
| Рядок 352: | Рядок 331: | ||
local function messageBoxUnused( pageName, addCategories ) | local function messageBoxUnused( pageName, addCategories ) | ||
local mbox = require( 'Module:Mbox' )._mbox | local mbox = require( 'Module:Mbox' )._mbox | ||
local category = addCategories and '[[Category:Unused modules]]' or '' | |||
return mbox( | return mbox( | ||
'This module is unused.', | 'This module is unused.', | ||
string.format( 'This module is neither invoked by a template nor required/loaded by another module. If this is in error, make sure to add <code>{{[[Template:Documentation|Documentation]]}}</code>/<code>{{[[Template:No documentation|No documentation]]}}</code> to the calling template\'s or parent\'s module documentation.', | string.format( 'This module is neither invoked by a template nor required/loaded by another module. If this is in error, make sure to add <code>{{[[Template:Documentation|Documentation]]}}</code>/<code>{{[[Template:No documentation|No documentation]]}}</code> to the calling template\'s or parent\'s module documentation.', | ||
pageName | pageName | ||
) | ), | ||
) .. | { icon = 'WikimediaUI-Alert.svg' } | ||
) .. category | |||
end | end | ||
| Рядок 610: | Рядок 591: | ||
) | ) | ||
table.insert( res, mHatnote._hatnote( msg, { icon='WikimediaUI-Code.svg' } ) ) | table.insert( res, mHatnote._hatnote( msg, { icon='WikimediaUI-Code.svg' } ) ) | ||
end | end | ||
| Рядок 669: | Рядок 626: | ||
moduleIsUsed = true -- Don't show sandbox modules as unused | moduleIsUsed = true -- Don't show sandbox modules as unused | ||
end | end | ||
if currentPageName:find( '^Template:' ) then | if currentPageName:find( '^Template:' ) then | ||
local ok, invokeList = pcall( getInvokeCallList, currentPageName ) | local ok, invokeList = pcall( getInvokeCallList, currentPageName ) | ||
if ok then | if ok then | ||
return formatInvokeCallList( currentPageName, addCategories, invokeList | return formatInvokeCallList( currentPageName, addCategories, invokeList ) | ||
else | else | ||
return userError(invokeList) | return userError(invokeList) | ||
| Рядок 740: | Рядок 695: | ||
table.insert( res, formatUsedTemplatesList( currentPageName, addCategories, usedTemplateList ) ) | table.insert( res, formatUsedTemplatesList( currentPageName, addCategories, usedTemplateList ) ) | ||
table.insert( res, formatRequiredByList( currentPageName, addCategories, whatModulesLinkHere ) ) | table.insert( res, formatRequiredByList( currentPageName, addCategories, whatModulesLinkHere ) ) | ||
if addCategories then | if addCategories then | ||