Difference between revisions of "Module:Unstrip"
Jump to navigation
Jump to search
blackwiki>Frietjes |
m (6 revisions imported) |
||
| (4 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
| − | -- This module provides a frontend to the mw.text.unstrip | + | -- This module provides a frontend to the mw.text.unstrip and unstripNoWiki functions |
local p = {} | local p = {} | ||
| + | |||
function p.unstrip(frame) | function p.unstrip(frame) | ||
| − | + | return mw.text.unstrip(frame.args[1] or '') | |
| − | + | end | |
| + | |||
| + | function p.unstripNoWiki(frame) | ||
| + | return mw.text.unstripNoWiki(frame.args[1] or '') | ||
| + | end | ||
| + | function p.killMarkers(frame) | ||
| + | local text = frame.args[1] | ||
| + | text = mw.text.killMarkers(text) | ||
| + | :gsub("^%s+", "") --strip leading | ||
| + | :gsub("%s+$", "") --and trailing spaces | ||
| + | return text | ||
end | end | ||
return p | return p | ||
Latest revision as of 04:54, 30 September 2020
Implements {{unstrip}}, {{UnstripNoWiki}}, and {{KillMarkers}}
- mw:Extension:Scribunto/Lua reference manual#mw.text.unstrip
- mw:Extension:Scribunto/Lua reference manual#mw.text.unstripNoWiki
- mw:Extension:Scribunto/Lua reference manual#mw.text.killMarkers
-- This module provides a frontend to the mw.text.unstrip and unstripNoWiki functions
local p = {}
function p.unstrip(frame)
return mw.text.unstrip(frame.args[1] or '')
end
function p.unstripNoWiki(frame)
return mw.text.unstripNoWiki(frame.args[1] or '')
end
function p.killMarkers(frame)
local text = frame.args[1]
text = mw.text.killMarkers(text)
:gsub("^%s+", "") --strip leading
:gsub("%s+$", "") --and trailing spaces
return text
end
return p