Wikipedia:Lua/Modul/Pinging/en

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen
Vorlagenprogrammierung Diskussionen Lua Test Unterseiten
Modul Deutsch English

Modul: Dokumentation

Pinging – Module with functions for any kind of user lists, especially for echo pings.

Functions for templates

[Quelltext bearbeiten]

All functions expect the parameter list from the template transclusion which will embed them. #invoke has no parameters, if not explicitly mentioned. Anything is optional if not explicitly mentioned.

Whitespace ahead and after any content is ignored.

Common optional parameters

[Quelltext bearbeiten]

All functions listing users (ping, noping, massmessage) support common optional parameters. They may be provided both with #invoke as default for a certain template as well as for a particular transclusion – the latter takes precedence.

:
Postfix character/string.
Default: :
Empty assignment makes it disappear.
Terminating or leading _ will be displayed as simple space.
p
Like : (legacy).
@
Prefix character/string.
Default: @
Empty assignment makes it disappear.
Terminating or leading _ will be displayed as simple space.
/
Separator character/string.
Default: like  |_
Terminating or leading _ will be displayed as simple space.

 will be turned into line breaks.

Create a list of user page links from a list of nicks, which should trigger echo mention if occurring in a signed section.

1
User nick (no leading user:).
2 3 4 5 6 7 8 9 ...
Any number of user nicks.
labeln
Assign different displayed link title to nick n.
Legacy for enwiki.
max
0 – Do not show error message if maxecho exceeded.
Chose another limit than by system.
May turn user name list into linklist for other purposes.
Available for both #invoke and template transclusion; the latter takes precedence.
Default: Show error if 50 exceeded.

Like ping, but all links as URL. No mentioning by echo, therefore max out of scope.

Retrieve a list of recipients from a list of massmessage targets. This function is „expensive“. The usage of expensive functions per page is limited to 500.

1
Source page, one of
  • local page name
  • heading #, followed by curid (pageid) surviving page moves.
Available for #invoke only.
Mandatory.
2
List title, will be linked to source page.
Must not contain links.
Members will be shown if omitted.
If _ provided nothing visual will be displayed.
Available for #invoke only.
@
Parameter may be used to show both list title and members.
max
0 – Do not show error message if maxecho exceeded.
Chose another limit than by system.
May turn user name list into linklist for other purposes.
Available for both #invoke and template transclusion; the latter takes precedence.
Default: Show error if 50 exceeded.
subst
Requires that #invoke is directly preceeded by subst: if set in any mode.
Available for #invoke only.
Supposed to be the name of the top including page (template title) which will be shown in error message.

On defining pages, the parser function call {{#target: is supposed to be downcased, with no spaces within.

The parser functions need to be present within the page source itself, not indirectly via templates.

{{#target:Benutzer:PerfektesChaos}}
{{#target:Project:Noticeboard|en.wikipedia.org}}

Just tell the current limitation for pinged users by a single edit: 50

Version identification on this wiki: 2022-11-14

Examples (test page)

[Quelltext bearbeiten]

A test page illustrates practical use.

Functions for Lua modules (API)

[Quelltext bearbeiten]

Some functions may be used by other modules:

local lucky, Pinging = pcall( require, "Module:Pinging" )
if type( Pinging ) == "table" then
    mw.log( Pinging.maxecho() )
else
    -- error; Pinging contains error message
    return "<span class=\"error\">" .. Pinging .. "</span>"
end

If succeeded there are available:

failsafe()
Returns string with ID.
massmessage( args, args2 )
args – table with parameters for #invoke as listed above
args2 – optional table with parameters like for a transclusion
Returns string.
maxecho()
Returns string with digits.

General library; no limitations.

Dependencies

[Quelltext bearbeiten]