![]() | This is a
documentation
subpage for
Module:Text. It may contain usage information, categories and other content that is not part of the original module page. |
![]() | This Lua module is used on
approximately 1,750,000 pages, or roughly 3% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
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.|
%s
.'
.
#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 isep
There are tests available (in German) to illustrate this in practice.
All of the above functions can be called from other Lua modules. Use require()
; the below code checks for errors loading it:
local lucky, Text = pcall( require, "Module:Text" )
if type( Text ) == "table" then
Text = Text.Text()
else
-- In the event of errors, Text is an error message.
return "<span class=\"error\">" .. Text .. "</span>"
end
You may then call:
This is a general library; use it anywhere.
None.
![]() | This is a
documentation
subpage for
Module:Text. It may contain usage information, categories and other content that is not part of the original module page. |
![]() | This Lua module is used on
approximately 1,750,000 pages, or roughly 3% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
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.|
%s
.'
.
#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 isep
There are tests available (in German) to illustrate this in practice.
All of the above functions can be called from other Lua modules. Use require()
; the below code checks for errors loading it:
local lucky, Text = pcall( require, "Module:Text" )
if type( Text ) == "table" then
Text = Text.Text()
else
-- In the event of errors, Text is an error message.
return "<span class=\"error\">" .. Text .. "</span>"
end
You may then call:
This is a general library; use it anywhere.
None.