Difference between pages "Module:Hidden ping" and "Module:Namespace detect/config"

From Jonesipedia
(Difference between pages)
Jump to navigation Jump to search
m (1 revision imported)
 
m (1 revision imported)
 
Line 1: Line 1:
local p = {}
--------------------------------------------------------------------------------
--                    Namespace detect configuration data                    --
--                                                                            --
-- This module stores configuration data for Module:Namespace detect. Here    --
-- you can localise the module to your wiki's language.                      --
--                                                                            --
-- To activate a configuration item, you need to uncomment it. This means    --
-- that you need to remove the text "-- " at the start of the line.          --
--------------------------------------------------------------------------------


local function makeError(msg, frame)
local cfg = {} -- Don't edit this line.
-- Show error only in preview
if (frame:preprocess( "{{REVISIONID}}" ) ~= "") then return '' end
msg ='<strong>Error in [[Template:Hidden ping]]:</strong> ' .. msg
return mw.text.tag('div', {['class']='error'}, msg)
end


function p.hiddenping(frame)
--------------------------------------------------------------------------------
local origArgs = frame:getParent().args
--                              Parameter names                              --
local args = {}
-- These configuration items specify custom parameter names. Values added    --
local maxArg = 0
-- here will work in addition to the default English parameter names.         --
local usernames = 0
-- To add one extra name, you can use this format:                            --
for k, v in pairs(origArgs) do
--                                                                            --
if type(k) == 'number' and mw.ustring.match(v,'%S') then
-- cfg.foo = 'parameter name'                                                 --
if k > maxArg then maxArg = k end
--                                                                            --
local title = mw.title.new(v)
-- To add multiple names, you can use this format:                            --
if title then
--                                                                            --
args[k] = title.rootText
-- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}    --
usernames = usernames + 1
--------------------------------------------------------------------------------
else
return makeError('Input contains forbidden characters.', frame)
end
end
end


if usernames < 1 then
---- This parameter displays content for the main namespace:
return makeError('Username not given.', frame)
-- cfg.main = 'main'
elseif usernames > (tonumber(frame.args.max) or 50) then
return makeError('More than '..tostring(frame.args.max or 50)..' names specified.', frame)
else
local outStr = ''
for i = 1, maxArg do
if args[i] then outStr = outStr..'[[:User:'..args[i]..'|&#x200B;]]' end
end
return outStr
end
end


return p
---- This parameter displays in talk namespaces:
-- cfg.talk = 'talk'
 
---- This parameter displays content for "other" namespaces (namespaces for which
---- parameters have not been specified):
-- cfg.other = 'other'
 
---- This parameter makes talk pages behave as though they are the corresponding
---- subject namespace. Note that this parameter is used with [[Module:Yesno]].
---- Edit that module to change the default values of "yes", "no", etc.
-- cfg.subjectns = 'subjectns'
 
---- This parameter sets a demonstration namespace:
-- cfg.demospace = 'demospace'
 
---- This parameter sets a specific page to compare:
cfg.demopage = 'page'
 
--------------------------------------------------------------------------------
--                          Table configuration                              --
-- These configuration items allow customisation of the "table" function,    --
-- used to generate a table of possible parameters in the module              --
-- documentation.                                                            --
--------------------------------------------------------------------------------
 
---- The header for the namespace column in the wikitable containing the list of
---- possible subject-space parameters.
-- cfg.wikitableNamespaceHeader = 'Namespace'
 
---- The header for the wikitable containing the list of possible subject-space
---- parameters.
-- cfg.wikitableAliasesHeader = 'Aliases'
 
--------------------------------------------------------------------------------
--                        End of configuration data                          --
--------------------------------------------------------------------------------
 
return cfg -- Don't edit this line.

Revision as of 02:12, 1 April 2020

Documentation for this module may be created at Module:Namespace detect/config/doc

--------------------------------------------------------------------------------
--                    Namespace detect configuration data                     --
--                                                                            --
-- This module stores configuration data for Module:Namespace detect. Here    --
-- you can localise the module to your wiki's language.                       --
--                                                                            --
-- To activate a configuration item, you need to uncomment it. This means     --
-- that you need to remove the text "-- " at the start of the line.           --
--------------------------------------------------------------------------------

local cfg = {} -- Don't edit this line.

--------------------------------------------------------------------------------
--                              Parameter names                               --
-- These configuration items specify custom parameter names. Values added     --
-- here will work in addition to the default English parameter names.         --
-- To add one extra name, you can use this format:                            --
--                                                                            --
-- cfg.foo = 'parameter name'                                                 --
--                                                                            --
-- To add multiple names, you can use this format:                            --
--                                                                            --
-- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}     --
--------------------------------------------------------------------------------

---- This parameter displays content for the main namespace:
-- cfg.main = 'main'

---- This parameter displays in talk namespaces:
-- cfg.talk = 'talk'

---- This parameter displays content for "other" namespaces (namespaces for which
---- parameters have not been specified):
-- cfg.other = 'other'

---- This parameter makes talk pages behave as though they are the corresponding
---- subject namespace. Note that this parameter is used with [[Module:Yesno]].
---- Edit that module to change the default values of "yes", "no", etc.
-- cfg.subjectns = 'subjectns'

---- This parameter sets a demonstration namespace:
-- cfg.demospace = 'demospace'

---- This parameter sets a specific page to compare:
cfg.demopage = 'page'

--------------------------------------------------------------------------------
--                           Table configuration                              --
-- These configuration items allow customisation of the "table" function,     --
-- used to generate a table of possible parameters in the module              --
-- documentation.                                                             --
--------------------------------------------------------------------------------

---- The header for the namespace column in the wikitable containing the list of
---- possible subject-space parameters.
-- cfg.wikitableNamespaceHeader = 'Namespace'

---- The header for the wikitable containing the list of possible subject-space
---- parameters.
-- cfg.wikitableAliasesHeader = 'Aliases'

--------------------------------------------------------------------------------
--                        End of configuration data                           --
--------------------------------------------------------------------------------

return cfg -- Don't edit this line.