Jump to content

Module:Text/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 182.239.123.86 (talk) at 14:00, 12 October 2021. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Text – Module containing methods for the manipulation of text, wikimarkup and some HTML.

Anchor

methods text.

The string if meet the conditions the condition is matched or some result is successfully found, strings of at least one character are returned.

char
Creates a string from a list of character codes.
character codes
*
Number of repetitions
0
First element;elements are ignored.
2 3 4 5 6 …
Further list element
table of the apply
Separator |
optional will not applied to each element; must contain %s
whether the input string contains
  • there are CJK characters
wikimarkup (except templates): comments, tags, bold, italic, nbsp
some content, string character that would normally be Latin text.
  • there is a Latin string.
iQuote
content if passed is a single character, and that character is a iquote, such as '.
for multiple characters, or if the character passed a iquote.
listToText
list analogously
The separated word appear
Optiona for
  • – will first be formatted with string; see here construc string. The string must contain %string.
iquote
string in iquotes; iquotes can be language.
Input text (will be matically)
(optional) language code for the iquote
string in quotes; quotes can be for language. Will quote an empty string, and will iquote at the start or string.
Input text
(optional) Format ISO 639
diacritical marks from the input.
Input text
  • the sentence is terminated.
All
The letter of
strin Latin characters are italicized,less they are a Greek letter

– input separator at the index input separator;original

Use in another Lua module

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:

  • Text.char( apply, again, accept )
  • Text.concatParams( args, separator, format )
  • Text.containsCJK( s )
  • Text.getPlain( s )
  • Text.isLatinRange( s )
  • Text.isQuote( c )
  • Text.listToText( table, format )
  • Text.quote( s, lang, mode )
  • Text.quoteUnquoted( s, lang, mode )
  • Text.removeDiacritics( s )
  • Text.sentenceTerminated( s )
  • Text.ucfirstAll( s )
  • Text.uprightNonlatin( s )
  • Text.zip(…)
  • Text.test( s )

Usage

This is a general library; use it anywhere.

Dependencies

None.

See also