Modulo:Sandbox/Lucamauri/modulotest
Vai alla navigazione
Vai alla ricerca
La documentazione per questo modulo può essere creata in Modulo:Sandbox/Lucamauri/modulotest/man
--[[
local p = {}
function p.hello(frame)
return 'Hello'
end
return p
local p = {}
local first = {}
function p.toglitag(testo)
first = string.gsub(testo.args[1], string.char(127) .. "<" .. testo.args[2] .. ">", "")
return (string.gsub(first, "</" .. testo.args[2] .. ">", ""))
return mw.text.killMarkers("<pre>Prova</pre>")
return mw.text.killMarkers(testo.args[1])
end
return p
]]--
local p = {}
function p.main(frame)
local text = frame.args[1]
return p._main(text)
end
function p._main(text)
if not text then return end
text = mw.text.killMarkers(text)
:gsub('<span class="nowrap">(.+)</span>', '%1') --remove nowrap while keeping text inside
:gsub('<br ?/?>', ', ') --replace br with commas
:gsub('<.->', '') --strip out tags
:gsub('%[%[%s*[Ff]ile%s*:.-%]%]', '') --strip out files
:gsub('%[%[%s*[Ii]mage%s*:.-%]%]', '') --strip out use of image:
:gsub('%[%[%s*[Cc]ategory%s*:.-%]%]', '') --strip out categories
:gsub('%[%[[^%]]-|', '') --strip out piped link text
:gsub('[%[%]]', '') --then strip out remaining [ and ]
:gsub("'''''", "") --strip out bold italic markup
:gsub("'''?", "") --not stripping out '''' gives correct output for bolded text in quotes
return text
end
return p