| Vorlagenprogrammierung | Diskussionen | Lua | Test | Unterseiten | |||
| Modul | Deutsch | English | Modul: | Dokumentation | |||
Text – Module containing methods for the manipulation of text, wikimarkup and some HTML.
All methods have an unnamed parameter containing the text.
The return value is an empty string if the parameter does not meet the conditions. When the condition is matched or some result is successfully found, strings of at least one character are returned.
0 – Silence errorstable.concat() in Lua.
'.
#invoke:
format – Every list element will first be formatted with this format string; see here for how to construct this string. The string must contain at least one %s sequence.template=1 – List elements should be taken from the calling template.2 for second level quotes. This means the single quote marks in a statement such as: Jack said, “Jill said ‘fish’ last Tuesday.”2 for second level quotes. This means the single quote marks in a statement such as: Jack said, “Jill said ‘fish’ last Tuesday.”&) are converted to & formzip(liste1, liste2, sep = " ", isep = "-", osep = "/")a-1/b-2/c-3
sep – A separator (in Lua regex form) used to split the lists. If empty, the lists are split into individual characters.sep1, sep2, sep3, … – Allows a different separator to be used for each list.isep – Output separator; placed between elements which were at the same index in their lists.osep – Output separator; placed between elements which had different original indices; i.e. between the groups joined with isepThe Failsafe interface is heading for version management of globally distributed Lua modules. It enables modules equipped with this interface to
The Failsafe interface is present both at template level and for direct Lua access.
The functions in detail are (not all supported yet completely by every library):
| Value | Result | current |
|---|---|---|
nothingfalse |
local version ID | »2025-02-06« |
| Minimal version | version ID required at least date in ISO format It will be compared whether the current local implementation matches this version or later.
|
|
wikidata |
version ID of global upstream
|
»2025-02-06« |
item |
ID of the Wikidata item
|
Q29387871 |
~ |
Corresponding version ID locally and registered at Wikidata
|
»« |
@ |
Is the current (module) page linked correctly with Wikidata item?
|
|
The return value is in template programming empty or under Lua false, otherwis a non-empty string as described. | ||
There are tests available to illustrate this in practice.
All of the above functions can be called from other Lua modules, if not Lua library function anyway. Use require(); the below code checks for errors loading it:
local lucky, Text = pcall( require, "Module:Text" )
if type( Text ) == "table" then
Text = Text()
else
-- In the event of errors, Text is an error message.
return "<span class=\"error\">" .. Text .. "</span>"
end
You may then call:
1true|%sfalse if not, else true.false if not, else true.false if not, else true.%s22false if not, else true.wikidata or ~ for synchronisationfalseThis is a general library; use it anywhere.
Follow the steps:
Module:Text into your project.
Text./quoting