This module is rated as ready for general use. It has reached a mature form and is thought to be bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
This module provides access to various lua functions from the mw.text library. See corresponding lua manual entries for more information.
{{#invoke:Text|function_name|args}}
See also[Quelltext bearbeiten]
- Module:String for accessing functions of the string library
--[[
This library provides access to some lua methods of the mw.text library for
mediawiki templates/articles.
]]
local text = {}
local getArgs = require('Module:Arguments').getArgs
function text.killMarkers(frame)
local args = getArgs(frame)
return mw.text.killMarkers(args[1] or args.text )
end
function text.nowiki(frame)
local args = getArgs(frame)
local result = ''
local separator = '\n\n'
if args.sep then
separator = args.sep
args.sep = nil
end
if args.separator then
separator = args.separator
args.separator = nil
end
for _, v in pairs(args) do
result = result .. '(' .. #v .. '): ' .. mw.text.nowiki(v) .. separator
end
return result
end
function text.unstrip(frame)
local args = getArgs(frame)
return mw.text.decode( mw.text.unstrip(args[1] or args.text) )
end
return text