Modulo:Sandbox/Lucamauri/modulotest: differenze tra le versioni

Da Wikitrek.
Vai alla navigazione Vai alla ricerca
Nessun oggetto della modifica
Nessun oggetto della modifica
 
(2 versioni intermedie di uno stesso utente non sono mostrate)
Riga 20: Riga 20:
end
end
return p
return p
]]--
]]--


Riga 32: Riga 38:
if not text then return end
if not text then return end
text = mw.text.killMarkers(text)
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
return text
end
end


return p
return p

Versione attuale delle 08:22, 13 set 2018

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)


	return text
end

return p